summaryrefslogtreecommitdiff
path: root/sapi
diff options
context:
space:
mode:
Diffstat (limited to 'sapi')
-rw-r--r--sapi/apache2handler/apache_config.c8
-rw-r--r--sapi/apache2handler/config.m415
-rw-r--r--sapi/apache2handler/config.w326
-rw-r--r--sapi/apache2handler/mod_php.c (renamed from sapi/apache2handler/mod_php7.c)10
-rw-r--r--sapi/apache2handler/php.sym2
-rw-r--r--sapi/apache2handler/php_apache.h6
-rw-r--r--sapi/apache2handler/php_functions.c109
-rw-r--r--sapi/apache2handler/php_functions.stub.php24
-rw-r--r--sapi/apache2handler/php_functions_arginfo.h64
-rw-r--r--sapi/apache2handler/sapi_apache2.c20
-rw-r--r--sapi/cgi/cgi_main.c102
-rw-r--r--sapi/cgi/cgi_main.stub.php12
-rw-r--r--sapi/cgi/cgi_main_arginfo.h26
-rw-r--r--sapi/cgi/config9.m42
-rw-r--r--sapi/cgi/tests/003.phpt12
-rw-r--r--sapi/cgi/tests/004.phpt6
-rw-r--r--sapi/cgi/tests/005-win32.phpt2
-rw-r--r--sapi/cgi/tests/005.phpt2
-rw-r--r--sapi/cgi/tests/006.phpt10
-rw-r--r--sapi/cgi/tests/007.phpt2
-rw-r--r--sapi/cgi/tests/008.phpt10
-rw-r--r--sapi/cgi/tests/011.phpt14
-rw-r--r--sapi/cgi/tests/apache_request_headers.phpt6
-rw-r--r--sapi/cgi/tests/apache_response_headers.phpt2
-rw-r--r--sapi/cgi/tests/bug61605.phpt1
-rw-r--r--sapi/cgi/tests/bug75574_utf8.phpt2
-rw-r--r--sapi/cgi/tests/include.inc103
-rw-r--r--sapi/cgi/tests/skipif.inc4
-rw-r--r--sapi/cli/cli.h4
-rw-r--r--sapi/cli/config.m42
-rw-r--r--sapi/cli/config.w324
-rwxr-xr-xsapi/cli/generate_mime_type_map.php68
-rw-r--r--sapi/cli/mime_type_map.h1875
-rw-r--r--sapi/cli/php_cli.c129
-rw-r--r--sapi/cli/php_cli_process_title.c12
-rw-r--r--sapi/cli/php_cli_process_title.h9
-rw-r--r--sapi/cli/php_cli_process_title.stub.php5
-rw-r--r--sapi/cli/php_cli_process_title_arginfo.h9
-rw-r--r--sapi/cli/php_cli_server.c174
-rw-r--r--sapi/cli/php_cli_server.h2
-rw-r--r--sapi/cli/php_cli_server.stub.php7
-rw-r--r--sapi/cli/php_cli_server_arginfo.h9
-rw-r--r--sapi/cli/php_http_parser.c4
-rw-r--r--sapi/cli/php_http_parser.h2
-rw-r--r--sapi/cli/ps_title.h2
-rw-r--r--sapi/cli/tests/002-unix.phpt2
-rw-r--r--sapi/cli/tests/003-2.phpt4
-rw-r--r--sapi/cli/tests/003.phpt2
-rw-r--r--sapi/cli/tests/004.phpt5
-rw-r--r--sapi/cli/tests/005.phpt64
-rw-r--r--sapi/cli/tests/006.phpt114
-rw-r--r--sapi/cli/tests/007.phpt12
-rw-r--r--sapi/cli/tests/008.phpt4
-rw-r--r--sapi/cli/tests/010-2.phpt2
-rw-r--r--sapi/cli/tests/010.phpt4
-rw-r--r--sapi/cli/tests/011.phpt6
-rw-r--r--sapi/cli/tests/013.phpt2
-rw-r--r--sapi/cli/tests/014.phpt10
-rw-r--r--sapi/cli/tests/015.phpt2
-rw-r--r--sapi/cli/tests/016.phpt8
-rw-r--r--sapi/cli/tests/017.phpt10
-rw-r--r--sapi/cli/tests/018.phpt2
-rw-r--r--sapi/cli/tests/019.phpt2
-rw-r--r--sapi/cli/tests/020.phpt2
-rw-r--r--sapi/cli/tests/021.phpt2
-rw-r--r--sapi/cli/tests/022.phpt12
-rw-r--r--sapi/cli/tests/023.phpt8
-rw-r--r--sapi/cli/tests/argv_mb.phpt2
-rw-r--r--sapi/cli/tests/argv_mb_bug77111.phpt8
-rw-r--r--sapi/cli/tests/bug43177.phpt46
-rw-r--r--sapi/cli/tests/bug44564.phpt2
-rw-r--r--sapi/cli/tests/bug62294.inc5
-rw-r--r--sapi/cli/tests/bug62294.phpt12
-rw-r--r--sapi/cli/tests/bug64529.phpt10
-rw-r--r--sapi/cli/tests/bug64544.phpt2
-rw-r--r--sapi/cli/tests/bug65066_100.phpt6
-rw-r--r--sapi/cli/tests/bug65066_422.phpt6
-rw-r--r--sapi/cli/tests/bug65066_511.phpt6
-rw-r--r--sapi/cli/tests/bug65275.inc7
-rw-r--r--sapi/cli/tests/bug65275.phpt12
-rw-r--r--sapi/cli/tests/bug66606_2.phpt6
-rw-r--r--sapi/cli/tests/bug69655.phpt6
-rw-r--r--sapi/cli/tests/bug70264.phpt4
-rw-r--r--sapi/cli/tests/bug70470.phpt2
-rw-r--r--sapi/cli/tests/bug71005.phpt6
-rw-r--r--sapi/cli/tests/bug71624.phpt10
-rw-r--r--sapi/cli/tests/bug74600.phpt8
-rw-r--r--sapi/cli/tests/bug77561.inc4
-rw-r--r--sapi/cli/tests/bug77561.phpt10
-rw-r--r--sapi/cli/tests/emptyheader.phpt2
-rw-r--r--sapi/cli/tests/ext_loading.phpt65
-rw-r--r--sapi/cli/tests/php_cli_server.inc40
-rw-r--r--sapi/cli/tests/php_cli_server_004.phpt6
-rw-r--r--sapi/cli/tests/php_cli_server_005.phpt6
-rw-r--r--sapi/cli/tests/php_cli_server_006.phpt6
-rw-r--r--sapi/cli/tests/php_cli_server_007.phpt6
-rw-r--r--sapi/cli/tests/php_cli_server_008.phpt12
-rw-r--r--sapi/cli/tests/php_cli_server_009.phpt20
-rw-r--r--sapi/cli/tests/php_cli_server_010.phpt12
-rw-r--r--sapi/cli/tests/php_cli_server_012.phpt6
-rw-r--r--sapi/cli/tests/php_cli_server_013.phpt18
-rw-r--r--sapi/cli/tests/php_cli_server_014.phpt12
-rw-r--r--sapi/cli/tests/php_cli_server_015.phpt6
-rw-r--r--sapi/cli/tests/php_cli_server_016.phpt6
-rw-r--r--sapi/cli/tests/php_cli_server_017.phpt6
-rw-r--r--sapi/cli/tests/php_cli_server_020.phpt6
-rw-r--r--sapi/cli/tests/sapi_windows_set_ctrl_handler.phpt78
-rw-r--r--sapi/cli/tests/skipif.inc2
-rw-r--r--sapi/cli/tests/upload_2G.phpt32
-rw-r--r--sapi/embed/config.m43
-rw-r--r--sapi/embed/php_embed.c15
-rw-r--r--sapi/embed/php_embed.h2
-rw-r--r--sapi/fpm/config.m435
-rw-r--r--sapi/fpm/fpm/events/devpoll.c8
-rw-r--r--sapi/fpm/fpm/events/devpoll.h2
-rw-r--r--sapi/fpm/fpm/events/epoll.c8
-rw-r--r--sapi/fpm/fpm/events/epoll.h2
-rw-r--r--sapi/fpm/fpm/events/kqueue.c8
-rw-r--r--sapi/fpm/fpm/events/kqueue.h2
-rw-r--r--sapi/fpm/fpm/events/poll.c10
-rw-r--r--sapi/fpm/fpm/events/poll.h2
-rw-r--r--sapi/fpm/fpm/events/port.c8
-rw-r--r--sapi/fpm/fpm/events/port.h2
-rw-r--r--sapi/fpm/fpm/events/select.c8
-rw-r--r--sapi/fpm/fpm/events/select.h2
-rw-r--r--sapi/fpm/fpm/fpm_atomic.h6
-rw-r--r--sapi/fpm/fpm/fpm_children.c2
-rw-r--r--sapi/fpm/fpm/fpm_clock.c2
-rw-r--r--sapi/fpm/fpm/fpm_conf.c73
-rw-r--r--sapi/fpm/fpm/fpm_conf.h1
-rw-r--r--sapi/fpm/fpm/fpm_events.c2
-rw-r--r--sapi/fpm/fpm/fpm_log.c2
-rw-r--r--sapi/fpm/fpm/fpm_main.c104
-rw-r--r--sapi/fpm/fpm/fpm_main.stub.php12
-rw-r--r--sapi/fpm/fpm/fpm_main_arginfo.h27
-rw-r--r--sapi/fpm/fpm/fpm_php.c6
-rw-r--r--sapi/fpm/fpm/fpm_php_trace.c8
-rw-r--r--sapi/fpm/fpm/fpm_process_ctl.c7
-rw-r--r--sapi/fpm/fpm/fpm_request.h18
-rw-r--r--sapi/fpm/fpm/fpm_scoreboard.c7
-rw-r--r--sapi/fpm/fpm/fpm_scoreboard.h1
-rw-r--r--sapi/fpm/fpm/fpm_signals.c2
-rw-r--r--sapi/fpm/fpm/fpm_sockets.h2
-rw-r--r--sapi/fpm/fpm/fpm_status.c38
-rw-r--r--sapi/fpm/fpm/fpm_stdio.c2
-rw-r--r--sapi/fpm/fpm/fpm_trace_pread.c6
-rw-r--r--sapi/fpm/fpm/fpm_worker_pool.h1
-rw-r--r--sapi/fpm/tests/bug76601-reload-child-signals.phpt6
-rw-r--r--sapi/fpm/tests/fcgi.inc4
-rw-r--r--sapi/fpm/tests/getallheaders.phpt42
-rw-r--r--sapi/fpm/tests/response.inc2
-rw-r--r--sapi/fpm/tests/status-basic.phpt2
-rw-r--r--sapi/fpm/tests/status-listen.phpt51
-rw-r--r--sapi/fpm/www.conf.in26
-rw-r--r--sapi/fuzzer/Makefile.frag24
-rw-r--r--sapi/fuzzer/README.md77
-rw-r--r--sapi/fuzzer/config.m493
-rw-r--r--sapi/fuzzer/corpus/exif/bug34704.jpgbin0 -> 9976 bytes
-rw-r--r--sapi/fuzzer/corpus/exif/bug34704_2.jpgbin0 -> 9976 bytes
-rw-r--r--sapi/fuzzer/corpus/exif/bug48378.jpegbin0 -> 2566 bytes
-rw-r--r--sapi/fuzzer/corpus/exif/bug54002_1.jpegbin0 -> 87599 bytes
-rw-r--r--sapi/fuzzer/corpus/exif/bug54002_2.jpegbin0 -> 87599 bytes
-rw-r--r--sapi/fuzzer/corpus/exif/bug62523_1.jpg9
-rw-r--r--sapi/fuzzer/corpus/exif/bug62523_3.jpg12
-rw-r--r--sapi/fuzzer/corpus/exif/bug68113.jpgbin0 -> 368 bytes
-rw-r--r--sapi/fuzzer/corpus/exif/bug68113_2.jpgbin0 -> 368 bytes
-rw-r--r--sapi/fuzzer/corpus/exif/bug68799.jpgbin0 -> 735 bytes
-rw-r--r--sapi/fuzzer/corpus/exif/bug72094_1.jpgbin0 -> 140 bytes
-rw-r--r--sapi/fuzzer/corpus/exif/bug72094_2.jpgbin0 -> 140 bytes
-rw-r--r--sapi/fuzzer/corpus/exif/bug72094_3.jpgbin0 -> 112 bytes
-rw-r--r--sapi/fuzzer/corpus/exif/bug72094_4.jpgbin0 -> 32 bytes
-rw-r--r--sapi/fuzzer/corpus/exif/bug72603.jpegbin0 -> 3711 bytes
-rw-r--r--sapi/fuzzer/corpus/exif/bug72618.jpgbin0 -> 3711 bytes
-rw-r--r--sapi/fuzzer/corpus/exif/bug72627.tiffbin0 -> 1250 bytes
-rw-r--r--sapi/fuzzer/corpus/exif/bug73737.tiffbin0 -> 48 bytes
-rw-r--r--sapi/fuzzer/corpus/exif/bug76130_1.jpgbin0 -> 3396 bytes
-rw-r--r--sapi/fuzzer/corpus/exif/bug76130_2.jpgbin0 -> 1632 bytes
-rw-r--r--sapi/fuzzer/corpus/exif/bug76423.jpgbin0 -> 1537 bytes
-rw-r--r--sapi/fuzzer/corpus/exif/bug76557.jpgbin0 -> 2372 bytes
-rw-r--r--sapi/fuzzer/corpus/exif/bug77540.jpgbin0 -> 91 bytes
-rw-r--r--sapi/fuzzer/corpus/exif/bug77563.jpgbin0 -> 63 bytes
-rw-r--r--sapi/fuzzer/corpus/exif/bug77753.tiffbin0 -> 873 bytes
-rw-r--r--sapi/fuzzer/corpus/exif/bug77831.tiffbin0 -> 49 bytes
-rw-r--r--sapi/fuzzer/corpus/exif/bug77950.tiffbin0 -> 1267 bytes
-rw-r--r--sapi/fuzzer/corpus/exif/bug77988.jpgbin0 -> 1202 bytes
-rw-r--r--sapi/fuzzer/corpus/exif/duplicate_copyright_tag_leak.tiffbin0 -> 9397 bytes
-rw-r--r--sapi/fuzzer/corpus/exif/exif_encoding_crash.jpgbin0 -> 7599 bytes
-rw-r--r--sapi/fuzzer/corpus/exif/image007.jpgbin0 -> 283 bytes
-rw-r--r--sapi/fuzzer/corpus/exif/image008.jpgbin0 -> 527 bytes
-rw-r--r--sapi/fuzzer/corpus/exif/image009.jpgbin0 -> 527 bytes
-rw-r--r--sapi/fuzzer/corpus/exif/image010.jpgbin0 -> 741 bytes
-rw-r--r--sapi/fuzzer/corpus/exif/image011.jpgbin0 -> 741 bytes
-rw-r--r--sapi/fuzzer/corpus/exif/image012.jpgbin0 -> 721 bytes
-rw-r--r--sapi/fuzzer/corpus/exif/image013.jpgbin0 -> 721 bytes
-rw-r--r--sapi/fuzzer/corpus/exif/image014.jpgbin0 -> 935 bytes
-rw-r--r--sapi/fuzzer/corpus/exif/image015.jpgbin0 -> 935 bytes
-rw-r--r--sapi/fuzzer/corpus/exif/image016.tiffbin0 -> 1874 bytes
-rw-r--r--sapi/fuzzer/corpus/exif/image017.tiffbin0 -> 1874 bytes
-rw-r--r--sapi/fuzzer/corpus/exif/image018.tiffbin0 -> 2088 bytes
-rw-r--r--sapi/fuzzer/corpus/exif/image020.tiffbin0 -> 2068 bytes
-rw-r--r--sapi/fuzzer/corpus/exif/image021.tiffbin0 -> 2068 bytes
-rw-r--r--sapi/fuzzer/corpus/exif/image022.tiffbin0 -> 2282 bytes
-rw-r--r--sapi/fuzzer/corpus/exif/image023.tiffbin0 -> 2282 bytes
-rw-r--r--sapi/fuzzer/corpus/exif/image024.jpgbin0 -> 417 bytes
-rw-r--r--sapi/fuzzer/corpus/exif/image025.jpgbin0 -> 417 bytes
-rw-r--r--sapi/fuzzer/corpus/exif/image026.tiffbin0 -> 1984 bytes
-rw-r--r--sapi/fuzzer/corpus/exif/image027.tiffbin0 -> 1984 bytes
-rw-r--r--sapi/fuzzer/corpus/exif/tag_with_illegal_zero_components.jpegbin0 -> 43 bytes
-rw-r--r--sapi/fuzzer/corpus/exif/temporary_buffer_leak.jpgbin0 -> 46 bytes
-rw-r--r--sapi/fuzzer/corpus/exif/test1.jpgbin0 -> 523 bytes
-rw-r--r--sapi/fuzzer/corpus/exif/test2.jpgbin0 -> 1240 bytes
-rw-r--r--sapi/fuzzer/corpus/exif/test22.jpgbin0 -> 1240 bytes
-rw-r--r--sapi/fuzzer/corpus/exif/test3.jpgbin0 -> 1240 bytes
-rw-r--r--sapi/fuzzer/corpus/exif/test4.jpgbin0 -> 713 bytes
-rw-r--r--sapi/fuzzer/corpus/exif/test5.jpgbin0 -> 603 bytes
-rw-r--r--sapi/fuzzer/corpus/exif/test6.jpgbin0 -> 1240 bytes
-rw-r--r--sapi/fuzzer/corpus/exif/zero_length_makernote_leak.tiffbin0 -> 164 bytes
-rw-r--r--sapi/fuzzer/corpus/json/1.json1
-rw-r--r--sapi/fuzzer/corpus/json/10.json1
-rw-r--r--sapi/fuzzer/corpus/json/11.json1
-rw-r--r--sapi/fuzzer/corpus/json/12.json2
-rw-r--r--sapi/fuzzer/corpus/json/13.json1
-rw-r--r--sapi/fuzzer/corpus/json/14.json2
-rw-r--r--sapi/fuzzer/corpus/json/15.json1
-rw-r--r--sapi/fuzzer/corpus/json/16.json1
-rw-r--r--sapi/fuzzer/corpus/json/17.json1
-rw-r--r--sapi/fuzzer/corpus/json/18.json1
-rw-r--r--sapi/fuzzer/corpus/json/19.json1
-rw-r--r--sapi/fuzzer/corpus/json/2.json1
-rw-r--r--sapi/fuzzer/corpus/json/3.json1
-rw-r--r--sapi/fuzzer/corpus/json/4.json1
-rw-r--r--sapi/fuzzer/corpus/json/5.json5
-rw-r--r--sapi/fuzzer/corpus/json/6.json1
-rw-r--r--sapi/fuzzer/corpus/json/7.json2
-rw-r--r--sapi/fuzzer/corpus/json/8.json1
-rw-r--r--sapi/fuzzer/corpus/json/9.json1
-rw-r--r--sapi/fuzzer/corpus/json/fail1.json1
-rw-r--r--sapi/fuzzer/corpus/json/fail10.json1
-rw-r--r--sapi/fuzzer/corpus/json/fail11.json1
-rw-r--r--sapi/fuzzer/corpus/json/fail12.json1
-rw-r--r--sapi/fuzzer/corpus/json/fail13.json1
-rw-r--r--sapi/fuzzer/corpus/json/fail14.json1
-rw-r--r--sapi/fuzzer/corpus/json/fail15.json1
-rw-r--r--sapi/fuzzer/corpus/json/fail16.json1
-rw-r--r--sapi/fuzzer/corpus/json/fail17.json1
-rw-r--r--sapi/fuzzer/corpus/json/fail18.json1
-rw-r--r--sapi/fuzzer/corpus/json/fail19.json1
-rw-r--r--sapi/fuzzer/corpus/json/fail2.json1
-rw-r--r--sapi/fuzzer/corpus/json/fail20.json1
-rw-r--r--sapi/fuzzer/corpus/json/fail21.json1
-rw-r--r--sapi/fuzzer/corpus/json/fail22.json1
-rw-r--r--sapi/fuzzer/corpus/json/fail23.json1
-rw-r--r--sapi/fuzzer/corpus/json/fail24.json1
-rw-r--r--sapi/fuzzer/corpus/json/fail25.json1
-rw-r--r--sapi/fuzzer/corpus/json/fail26.json1
-rw-r--r--sapi/fuzzer/corpus/json/fail27.json2
-rw-r--r--sapi/fuzzer/corpus/json/fail28.json2
-rw-r--r--sapi/fuzzer/corpus/json/fail29.json1
-rw-r--r--sapi/fuzzer/corpus/json/fail3.json1
-rw-r--r--sapi/fuzzer/corpus/json/fail30.json1
-rw-r--r--sapi/fuzzer/corpus/json/fail31.json1
-rw-r--r--sapi/fuzzer/corpus/json/fail32.json1
-rw-r--r--sapi/fuzzer/corpus/json/fail33.json1
-rw-r--r--sapi/fuzzer/corpus/json/fail4.json1
-rw-r--r--sapi/fuzzer/corpus/json/fail5.json1
-rw-r--r--sapi/fuzzer/corpus/json/fail6.json1
-rw-r--r--sapi/fuzzer/corpus/json/fail7.json1
-rw-r--r--sapi/fuzzer/corpus/json/fail8.json1
-rw-r--r--sapi/fuzzer/corpus/json/fail9.json1
-rw-r--r--sapi/fuzzer/corpus/json/pass1.json58
-rw-r--r--sapi/fuzzer/corpus/json/pass2.json1
-rw-r--r--sapi/fuzzer/corpus/json/pass3.json6
-rw-r--r--sapi/fuzzer/corpus/unserialize/__serialize_0071
-rw-r--r--sapi/fuzzer/corpus/unserialize/bug71311
-rw-r--r--sapi/fuzzer/corpus/unserialize/bug713131
-rw-r--r--sapi/fuzzer/corpus/unserialize/bug73144_11
-rw-r--r--sapi/fuzzer/corpus/unserialize/bug73144_21
-rw-r--r--sapi/fuzzer/corpus/unserialize/bug738251
-rw-r--r--sapi/fuzzer/corpus/unserialize/bug741011
-rw-r--r--sapi/fuzzer/corpus/unserialize/bug741031
-rw-r--r--sapi/fuzzer/corpus/unserialize/bug741111
-rw-r--r--sapi/fuzzer/corpus/unserialize/bug746141
-rw-r--r--sapi/fuzzer/corpus/unserialize/bug750541
-rw-r--r--sapi/fuzzer/corpus/unserialize/int_min_iv1
-rw-r--r--sapi/fuzzer/corpus/unserialize/leak_176281
-rw-r--r--sapi/fuzzer/corpus/unserialize/leak_176391
-rw-r--r--sapi/fuzzer/corpus/unserialize/leak_176461
-rw-r--r--sapi/fuzzer/corpus/unserialize/oss_fuzz_276281
-rw-r--r--sapi/fuzzer/corpus/unserialize/oss_fuzz_278761
-rw-r--r--sapi/fuzzer/corpus/unserialize/oss_fuzz_279781
-rw-r--r--sapi/fuzzer/corpus/unserialize/splobjectstorage_negative_count1
-rw-r--r--sapi/fuzzer/dict/parser85
-rw-r--r--sapi/fuzzer/fuzzer-execute.c90
-rw-r--r--sapi/fuzzer/fuzzer-exif.c72
-rw-r--r--sapi/fuzzer/fuzzer-json.c62
-rw-r--r--sapi/fuzzer/fuzzer-mbstring.c78
-rw-r--r--sapi/fuzzer/fuzzer-parser.c49
-rw-r--r--sapi/fuzzer/fuzzer-sapi.c304
-rw-r--r--sapi/fuzzer/fuzzer-sapi.h25
-rw-r--r--sapi/fuzzer/fuzzer-unserialize.c67
-rw-r--r--sapi/fuzzer/fuzzer-unserializehash.c82
-rw-r--r--sapi/fuzzer/fuzzer.h18
-rw-r--r--sapi/fuzzer/generate_all.php5
-rw-r--r--sapi/fuzzer/generate_execute_corpus.php38
-rw-r--r--sapi/fuzzer/generate_parser_corpus.php24
-rw-r--r--sapi/fuzzer/generate_unserialize_dict.php9
-rw-r--r--sapi/fuzzer/generate_unserializehash_corpus.php10
-rw-r--r--sapi/fuzzer/json.dict52
-rw-r--r--sapi/litespeed/config.m42
-rw-r--r--sapi/litespeed/lsapi_main.c108
-rw-r--r--sapi/litespeed/lsapi_main.stub.php20
-rw-r--r--sapi/litespeed/lsapi_main_arginfo.h37
-rw-r--r--sapi/litespeed/lsapidef.h2
-rw-r--r--sapi/litespeed/lsapilib.c6
-rw-r--r--sapi/litespeed/lsapilib.h2
-rw-r--r--sapi/litespeed/lscriu.c14
-rw-r--r--sapi/litespeed/lscriu.h2
-rw-r--r--sapi/phpdbg/Makefile.frag2
-rw-r--r--sapi/phpdbg/README.md78
-rw-r--r--sapi/phpdbg/config.m46
-rwxr-xr-xsapi/phpdbg/create-test.php2
-rw-r--r--sapi/phpdbg/phpdbg.c238
-rw-r--r--sapi/phpdbg/phpdbg.h8
-rw-r--r--sapi/phpdbg/phpdbg.stub.php25
-rw-r--r--sapi/phpdbg/phpdbg_arginfo.h73
-rw-r--r--sapi/phpdbg/phpdbg_bp.c22
-rw-r--r--sapi/phpdbg/phpdbg_bp.h2
-rw-r--r--sapi/phpdbg/phpdbg_break.c2
-rw-r--r--sapi/phpdbg/phpdbg_break.h2
-rw-r--r--sapi/phpdbg/phpdbg_btree.c2
-rw-r--r--sapi/phpdbg/phpdbg_btree.h2
-rw-r--r--sapi/phpdbg/phpdbg_cmd.c36
-rw-r--r--sapi/phpdbg/phpdbg_cmd.h10
-rw-r--r--sapi/phpdbg/phpdbg_eol.c2
-rw-r--r--sapi/phpdbg/phpdbg_eol.h2
-rw-r--r--sapi/phpdbg/phpdbg_frame.c4
-rw-r--r--sapi/phpdbg/phpdbg_frame.h2
-rw-r--r--sapi/phpdbg/phpdbg_help.c6
-rw-r--r--sapi/phpdbg/phpdbg_help.h2
-rw-r--r--sapi/phpdbg/phpdbg_info.c6
-rw-r--r--sapi/phpdbg/phpdbg_info.h2
-rw-r--r--sapi/phpdbg/phpdbg_io.c2
-rw-r--r--sapi/phpdbg/phpdbg_io.h2
-rw-r--r--sapi/phpdbg/phpdbg_lexer.h2
-rw-r--r--sapi/phpdbg/phpdbg_list.c11
-rw-r--r--sapi/phpdbg/phpdbg_list.h2
-rw-r--r--sapi/phpdbg/phpdbg_opcode.c2
-rw-r--r--sapi/phpdbg/phpdbg_opcode.h2
-rw-r--r--sapi/phpdbg/phpdbg_out.c2
-rw-r--r--sapi/phpdbg/phpdbg_out.h2
-rw-r--r--sapi/phpdbg/phpdbg_parser.y30
-rw-r--r--sapi/phpdbg/phpdbg_print.c14
-rw-r--r--sapi/phpdbg/phpdbg_print.h4
-rw-r--r--sapi/phpdbg/phpdbg_prompt.c48
-rw-r--r--sapi/phpdbg/phpdbg_prompt.h2
-rw-r--r--sapi/phpdbg/phpdbg_rinit_hook.c4
-rw-r--r--sapi/phpdbg/phpdbg_rinit_hook.h2
-rw-r--r--sapi/phpdbg/phpdbg_set.c2
-rw-r--r--sapi/phpdbg/phpdbg_set.h2
-rw-r--r--sapi/phpdbg/phpdbg_sigio_win32.c2
-rw-r--r--sapi/phpdbg/phpdbg_sigio_win32.h2
-rw-r--r--sapi/phpdbg/phpdbg_utils.c7
-rw-r--r--sapi/phpdbg/phpdbg_utils.h2
-rw-r--r--sapi/phpdbg/phpdbg_wait.c14
-rw-r--r--sapi/phpdbg/phpdbg_wait.h2
-rw-r--r--sapi/phpdbg/phpdbg_watch.c22
-rw-r--r--sapi/phpdbg/phpdbg_watch.h2
-rw-r--r--sapi/phpdbg/phpdbg_webdata_transfer.c4
-rw-r--r--sapi/phpdbg/phpdbg_webdata_transfer.h2
-rw-r--r--sapi/phpdbg/phpdbg_win.c2
-rw-r--r--sapi/phpdbg/phpdbg_win.h2
-rw-r--r--sapi/phpdbg/tests/bug78297.phpt4
-rw-r--r--sapi/phpdbg/tests/exceptions_003.phpt2
-rw-r--r--sapi/phpdbg/tests/info_001.phpt2
-rw-r--r--sapi/phpdbg/tests/match_breakpoints_001.phpt30
-rw-r--r--sapi/phpdbg/tests/match_breakpoints_002.phpt32
-rw-r--r--sapi/phpdbg/tests/match_breakpoints_003.phpt32
-rw-r--r--sapi/phpdbg/tests/match_breakpoints_004.phpt34
378 files changed, 4337 insertions, 2440 deletions
diff --git a/sapi/apache2handler/apache_config.c b/sapi/apache2handler/apache_config.c
index d0913c250e..0079ac7fea 100644
--- a/sapi/apache2handler/apache_config.c
+++ b/sapi/apache2handler/apache_config.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
@@ -19,6 +17,12 @@
#define ZEND_INCLUDE_FULL_WINDOWS_HEADERS
#include "php.h"
+#ifdef strcasecmp
+# undef strcasecmp
+#endif
+#ifdef strncasecmp
+# undef strncasecmp
+#endif
#include "php_ini.h"
#include "php_apache.h"
diff --git a/sapi/apache2handler/config.m4 b/sapi/apache2handler/config.m4
index 55c16179b8..bcdb188d1b 100644
--- a/sapi/apache2handler/config.m4
+++ b/sapi/apache2handler/config.m4
@@ -67,20 +67,23 @@ if test "$PHP_APXS2" != "no"; then
if test -z `$APXS -q SYSCONFDIR`; then
INSTALL_IT="\$(mkinstalldirs) '$APXS_LIBEXECDIR' && \
$APXS -S LIBEXECDIR='$APXS_LIBEXECDIR' \
- -i -n php7"
+ -i -n php"
else
APXS_SYSCONFDIR='$(INSTALL_ROOT)'`$APXS -q SYSCONFDIR`
INSTALL_IT="\$(mkinstalldirs) '$APXS_LIBEXECDIR' && \
\$(mkinstalldirs) '$APXS_SYSCONFDIR' && \
$APXS -S LIBEXECDIR='$APXS_LIBEXECDIR' \
-S SYSCONFDIR='$APXS_SYSCONFDIR' \
- -i -a -n php7"
+ -i -a -n php"
fi
+ LIBPHP_CFLAGS="-shared"
+ PHP_SUBST(LIBPHP_CFLAGS)
+
case $host_alias in
*aix*)
EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-brtl -Wl,-bI:$APXS_LIBEXECDIR/httpd.exp"
- PHP_SELECT_SAPI(apache2handler, shared, mod_php7.c sapi_apache2.c apache_config.c php_functions.c, $APACHE_CFLAGS)
+ PHP_SELECT_SAPI(apache2handler, shared, mod_php.c sapi_apache2.c apache_config.c php_functions.c, $APACHE_CFLAGS)
INSTALL_IT="$INSTALL_IT $SAPI_LIBTOOL"
;;
*darwin*)
@@ -95,12 +98,12 @@ if test "$PHP_APXS2" != "no"; then
fi
MH_BUNDLE_FLAGS="-bundle -bundle_loader $APXS_HTTPD $MH_BUNDLE_FLAGS"
PHP_SUBST(MH_BUNDLE_FLAGS)
- PHP_SELECT_SAPI(apache2handler, bundle, mod_php7.c sapi_apache2.c apache_config.c php_functions.c, $APACHE_CFLAGS)
- SAPI_SHARED=libs/libphp7.so
+ PHP_SELECT_SAPI(apache2handler, bundle, mod_php.c sapi_apache2.c apache_config.c php_functions.c, $APACHE_CFLAGS)
+ SAPI_SHARED=libs/libphp.so
INSTALL_IT="$INSTALL_IT $SAPI_SHARED"
;;
*)
- PHP_SELECT_SAPI(apache2handler, shared, mod_php7.c sapi_apache2.c apache_config.c php_functions.c, $APACHE_CFLAGS)
+ PHP_SELECT_SAPI(apache2handler, shared, mod_php.c sapi_apache2.c apache_config.c php_functions.c, $APACHE_CFLAGS)
INSTALL_IT="$INSTALL_IT $SAPI_LIBTOOL"
;;
esac
diff --git a/sapi/apache2handler/config.w32 b/sapi/apache2handler/config.w32
index 45d6353d28..12dd50332a 100644
--- a/sapi/apache2handler/config.w32
+++ b/sapi/apache2handler/config.w32
@@ -10,7 +10,7 @@ if (PHP_APACHE2HANDLER != "no") {
CHECK_LIB("libapr.lib", "apache2handler", PHP_PHP_BUILD + "\\lib\\apache2") &&
CHECK_LIB("libaprutil.lib", "apache2handler", PHP_PHP_BUILD + "\\lib\\apache2")
) {
- SAPI('apache2handler', 'mod_php7.c sapi_apache2.c apache_config.c php_functions.c',
+ SAPI('apache2handler', 'mod_php.c sapi_apache2.c apache_config.c php_functions.c',
'php' + PHP_VERSION + 'apache2.dll',
'/D PHP_APACHE2_EXPORTS /I win32 /DZEND_ENABLE_STATIC_TSRMLS_CACHE=1');
} else {
@@ -28,7 +28,7 @@ if (PHP_APACHE2_2HANDLER != "no") {
CHECK_LIB("libapr-1.lib", "apache2_2handler", PHP_PHP_BUILD + "\\lib\\apache2_2") &&
CHECK_LIB("libaprutil-1.lib", "apache2_2handler", PHP_PHP_BUILD + "\\lib\\apache2_2")
) {
- SAPI('apache2_2handler', 'mod_php7.c sapi_apache2.c apache_config.c php_functions.c',
+ SAPI('apache2_2handler', 'mod_php.c sapi_apache2.c apache_config.c php_functions.c',
'php' + PHP_VERSION + 'apache2_2.dll',
'/D PHP_APACHE2_EXPORTS /I win32 /DZEND_ENABLE_STATIC_TSRMLS_CACHE=1',
'sapi\\apache2_2handler');
@@ -46,7 +46,7 @@ if (PHP_APACHE2_4HANDLER != "no") {
CHECK_LIB("libapr-1.lib", "apache2_4handler", PHP_PHP_BUILD + "\\lib\\apache2_4") &&
CHECK_LIB("libaprutil-1.lib", "apache2_4handler", PHP_PHP_BUILD + "\\lib\\apache2_4")
) {
- SAPI('apache2_4handler', 'mod_php7.c sapi_apache2.c apache_config.c php_functions.c',
+ SAPI('apache2_4handler', 'mod_php.c sapi_apache2.c apache_config.c php_functions.c',
'php' + PHP_VERSION + 'apache2_4.dll',
'/D PHP_APACHE2_EXPORTS /I win32 /DZEND_ENABLE_STATIC_TSRMLS_CACHE=1',
'sapi\\apache2handler');
diff --git a/sapi/apache2handler/mod_php7.c b/sapi/apache2handler/mod_php.c
index 6c44dbaa2c..e8e97fabeb 100644
--- a/sapi/apache2handler/mod_php7.c
+++ b/sapi/apache2handler/mod_php.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
@@ -21,9 +19,15 @@
#define ZEND_INCLUDE_FULL_WINDOWS_HEADERS
#include "php.h"
+#ifdef strcasecmp
+# undef strcasecmp
+#endif
+#ifdef strncasecmp
+# undef strncasecmp
+#endif
#include "php_apache.h"
-AP_MODULE_DECLARE_DATA module php7_module = {
+AP_MODULE_DECLARE_DATA module php_module = {
STANDARD20_MODULE_STUFF,
create_php_config, /* create per-directory config structure */
merge_php_config, /* merge per-directory config structures */
diff --git a/sapi/apache2handler/php.sym b/sapi/apache2handler/php.sym
index 1469b0314d..571f27e01c 100644
--- a/sapi/apache2handler/php.sym
+++ b/sapi/apache2handler/php.sym
@@ -1 +1 @@
-php7_module
+php_module
diff --git a/sapi/apache2handler/php_apache.h b/sapi/apache2handler/php_apache.h
index 423ada1f9b..d6c67c8a8d 100644
--- a/sapi/apache2handler/php_apache.h
+++ b/sapi/apache2handler/php_apache.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
@@ -29,11 +27,11 @@
/* Enable per-module logging in Apache 2.4+ */
#ifdef APLOG_USE_MODULE
-APLOG_USE_MODULE(php7);
+APLOG_USE_MODULE(php);
#endif
/* Declare this so we can get to it from outside the sapi_apache2.c file */
-extern module AP_MODULE_DECLARE_DATA php7_module;
+extern module AP_MODULE_DECLARE_DATA php_module;
/* A way to specify the location of the php.ini dir in an apache directive */
extern char *apache2_php_ini_path_override;
diff --git a/sapi/apache2handler/php_functions.c b/sapi/apache2handler/php_functions.c
index c82b93f965..e7d29450ee 100644
--- a/sapi/apache2handler/php_functions.c
+++ b/sapi/apache2handler/php_functions.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
@@ -19,6 +17,12 @@
#define ZEND_INCLUDE_FULL_WINDOWS_HEADERS
#include "php.h"
+#ifdef strcasecmp
+# undef strcasecmp
+#endif
+#ifdef strncasecmp
+# undef strncasecmp
+#endif
#include "zend_smart_str.h"
#include "ext/standard/info.h"
#include "ext/standard/head.h"
@@ -45,6 +49,7 @@
#endif
#include "php_apache.h"
+#include "php_functions_arginfo.h"
#ifdef ZTS
int php_apache2_info_id;
@@ -65,8 +70,7 @@ static request_rec *php_apache_lookup_uri(char *filename)
return ap_sub_req_lookup_uri(filename, ctx->r, ctx->r->output_filters);
}
-/* {{{ proto bool virtual(string uri)
- Perform an apache sub-request */
+/* {{{ Perform an apache sub-request */
PHP_FUNCTION(virtual)
{
char *filename;
@@ -74,7 +78,7 @@ PHP_FUNCTION(virtual)
request_rec *rr;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "p", &filename, &filename_len) == FAILURE) {
- return;
+ RETURN_THROWS();
}
if (!(rr = php_apache_lookup_uri(filename))) {
@@ -120,7 +124,7 @@ PHP_FUNCTION(apache_lookup_uri)
size_t filename_len;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "p", &filename, &filename_len) == FAILURE) {
- return;
+ RETURN_THROWS();
}
if (!(rr = php_apache_lookup_uri(filename))) {
@@ -166,8 +170,7 @@ PHP_FUNCTION(apache_lookup_uri)
RETURN_FALSE;
}
-/* {{{ proto array getallheaders(void)
- Fetch all HTTP request headers */
+/* {{{ Fetch all HTTP request headers */
PHP_FUNCTION(apache_request_headers)
{
php_struct *ctx;
@@ -175,7 +178,7 @@ PHP_FUNCTION(apache_request_headers)
char *key, *val;
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
array_init(return_value);
@@ -190,8 +193,7 @@ PHP_FUNCTION(apache_request_headers)
}
/* }}} */
-/* {{{ proto array apache_response_headers(void)
- Fetch all HTTP response headers */
+/* {{{ Fetch all HTTP response headers */
PHP_FUNCTION(apache_response_headers)
{
php_struct *ctx;
@@ -199,7 +201,7 @@ PHP_FUNCTION(apache_response_headers)
char *key, *val;
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
array_init(return_value);
@@ -214,8 +216,7 @@ PHP_FUNCTION(apache_response_headers)
}
/* }}} */
-/* {{{ proto string apache_note(string note_name [, string note_value])
- Get and set Apache request notes */
+/* {{{ Get and set Apache request notes */
PHP_FUNCTION(apache_note)
{
php_struct *ctx;
@@ -223,8 +224,8 @@ PHP_FUNCTION(apache_note)
size_t note_name_len, note_val_len;
char *old_note_val=NULL;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "s|s", &note_name, &note_name_len, &note_val, &note_val_len) == FAILURE) {
- return;
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "s|s!", &note_name, &note_name_len, &note_val, &note_val_len) == FAILURE) {
+ RETURN_THROWS();
}
ctx = SG(server_context);
@@ -244,8 +245,7 @@ PHP_FUNCTION(apache_note)
/* }}} */
-/* {{{ proto bool apache_setenv(string variable, string value [, bool walk_to_top])
- Set an Apache subprocess_env variable */
+/* {{{ Set an Apache subprocess_env variable */
/*
* XXX this doesn't look right. shouldn't it be the parent ?*/
PHP_FUNCTION(apache_setenv)
@@ -258,7 +258,7 @@ PHP_FUNCTION(apache_setenv)
request_rec *r;
if (zend_parse_parameters(arg_count, "ss|b", &variable, &variable_len, &string_val, &string_val_len, &walk_to_top) == FAILURE) {
- return;
+ RETURN_THROWS();
}
ctx = SG(server_context);
@@ -278,8 +278,7 @@ PHP_FUNCTION(apache_setenv)
}
/* }}} */
-/* {{{ proto bool apache_getenv(string variable [, bool walk_to_top])
- Get an Apache subprocess_env variable */
+/* {{{ Get an Apache subprocess_env variable */
/*
* XXX: shouldn't this be the parent not the 'prev'
*/
@@ -294,7 +293,7 @@ PHP_FUNCTION(apache_getenv)
request_rec *r;
if (zend_parse_parameters(arg_count, "s|b", &variable, &variable_len, &walk_to_top) == FAILURE) {
- return;
+ RETURN_THROWS();
}
ctx = SG(server_context);
@@ -327,8 +326,7 @@ static char *php_apache_get_version()
#endif
}
-/* {{{ proto string apache_get_version(void)
- Fetch Apache version */
+/* {{{ Fetch Apache version */
PHP_FUNCTION(apache_get_version)
{
char *apv = php_apache_get_version();
@@ -341,8 +339,7 @@ PHP_FUNCTION(apache_get_version)
}
/* }}} */
-/* {{{ proto array apache_get_modules(void)
- Get a list of loaded Apache modules */
+/* {{{ Get a list of loaded Apache modules */
PHP_FUNCTION(apache_get_modules)
{
int n;
@@ -477,62 +474,10 @@ PHP_MINFO_FUNCTION(apache)
}
}
-/* {{{ arginfo */
-ZEND_BEGIN_ARG_INFO_EX(arginfo_apache2handler_lookup_uri, 0, 0, 1)
- ZEND_ARG_INFO(0, filename)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_apache2handler_virtual, 0, 0, 1)
- ZEND_ARG_INFO(0, uri)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_apache2handler_response_headers, 0)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_apache2handler_getallheaders, 0)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_apache2handler_note, 0, 0, 1)
- ZEND_ARG_INFO(0, note_name)
- ZEND_ARG_INFO(0, note_value)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_apache2handler_setenv, 0, 0, 2)
- ZEND_ARG_INFO(0, variable)
- ZEND_ARG_INFO(0, value)
- ZEND_ARG_INFO(0, walk_to_top)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_apache2handler_getenv, 0, 0, 1)
- ZEND_ARG_INFO(0, variable)
- ZEND_ARG_INFO(0, walk_to_top)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_apache2handler_get_version, 0)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_apache2handler_get_modules, 0)
-ZEND_END_ARG_INFO()
-/* }}} */
-
-static const zend_function_entry apache_functions[] = {
- PHP_FE(apache_lookup_uri, arginfo_apache2handler_lookup_uri)
- PHP_FE(virtual, arginfo_apache2handler_virtual)
- PHP_FE(apache_request_headers, arginfo_apache2handler_getallheaders)
- PHP_FE(apache_response_headers, arginfo_apache2handler_response_headers)
- PHP_FE(apache_setenv, arginfo_apache2handler_setenv)
- PHP_FE(apache_getenv, arginfo_apache2handler_getenv)
- PHP_FE(apache_note, arginfo_apache2handler_note)
- PHP_FE(apache_get_version, arginfo_apache2handler_get_version)
- PHP_FE(apache_get_modules, arginfo_apache2handler_get_modules)
- PHP_FALIAS(getallheaders, apache_request_headers, arginfo_apache2handler_getallheaders)
- {NULL, NULL, NULL}
-};
-
PHP_INI_BEGIN()
- STD_PHP_INI_ENTRY("xbithack", "0", PHP_INI_ALL, OnUpdateBool, xbithack, php_apache2_info_struct, php_apache2_info)
- STD_PHP_INI_ENTRY("engine", "1", PHP_INI_ALL, OnUpdateBool, engine, php_apache2_info_struct, php_apache2_info)
- STD_PHP_INI_ENTRY("last_modified", "0", PHP_INI_ALL, OnUpdateBool, last_modified, php_apache2_info_struct, php_apache2_info)
+ STD_PHP_INI_BOOLEAN("xbithack", "0", PHP_INI_ALL, OnUpdateBool, xbithack, php_apache2_info_struct, php_apache2_info)
+ STD_PHP_INI_BOOLEAN("engine", "1", PHP_INI_ALL, OnUpdateBool, engine, php_apache2_info_struct, php_apache2_info)
+ STD_PHP_INI_BOOLEAN("last_modified", "0", PHP_INI_ALL, OnUpdateBool, last_modified, php_apache2_info_struct, php_apache2_info)
PHP_INI_END()
static PHP_MINIT_FUNCTION(apache)
@@ -553,7 +498,7 @@ static PHP_MSHUTDOWN_FUNCTION(apache)
zend_module_entry php_apache_module = {
STANDARD_MODULE_HEADER,
"apache2handler",
- apache_functions,
+ ext_functions,
PHP_MINIT(apache),
PHP_MSHUTDOWN(apache),
NULL,
diff --git a/sapi/apache2handler/php_functions.stub.php b/sapi/apache2handler/php_functions.stub.php
new file mode 100644
index 0000000000..93955c7181
--- /dev/null
+++ b/sapi/apache2handler/php_functions.stub.php
@@ -0,0 +1,24 @@
+<?php
+
+/** @generate-function-entries */
+
+function apache_lookup_uri(string $filename): object|false {}
+
+function virtual(string $uri): bool {}
+
+function apache_request_headers(): array {}
+
+/** @alias apache_request_headers */
+function getallheaders(): array {}
+
+function apache_response_headers(): array {}
+
+function apache_note(string $note_name, ?string $note_value = null): string|false {}
+
+function apache_setenv(string $variable, string $value, bool $walk_to_top = false): bool {}
+
+function apache_getenv(string $variable, bool $walk_to_top = false): string|false {}
+
+function apache_get_version(): string|false {}
+
+function apache_get_modules(): array {}
diff --git a/sapi/apache2handler/php_functions_arginfo.h b/sapi/apache2handler/php_functions_arginfo.h
new file mode 100644
index 0000000000..a712ce590c
--- /dev/null
+++ b/sapi/apache2handler/php_functions_arginfo.h
@@ -0,0 +1,64 @@
+/* This is a generated file, edit the .stub.php file instead.
+ * Stub hash: 2e2e63b5c845bb74309b2b3e52ca5a3d76f2c80b */
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_apache_lookup_uri, 0, 1, MAY_BE_OBJECT|MAY_BE_FALSE)
+ ZEND_ARG_TYPE_INFO(0, filename, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_virtual, 0, 1, _IS_BOOL, 0)
+ ZEND_ARG_TYPE_INFO(0, uri, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_apache_request_headers, 0, 0, IS_ARRAY, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_getallheaders arginfo_apache_request_headers
+
+#define arginfo_apache_response_headers arginfo_apache_request_headers
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_apache_note, 0, 1, MAY_BE_STRING|MAY_BE_FALSE)
+ ZEND_ARG_TYPE_INFO(0, note_name, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, note_value, IS_STRING, 1, "null")
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_apache_setenv, 0, 2, _IS_BOOL, 0)
+ ZEND_ARG_TYPE_INFO(0, variable, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, value, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, walk_to_top, _IS_BOOL, 0, "false")
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_apache_getenv, 0, 1, MAY_BE_STRING|MAY_BE_FALSE)
+ ZEND_ARG_TYPE_INFO(0, variable, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, walk_to_top, _IS_BOOL, 0, "false")
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_apache_get_version, 0, 0, MAY_BE_STRING|MAY_BE_FALSE)
+ZEND_END_ARG_INFO()
+
+#define arginfo_apache_get_modules arginfo_apache_request_headers
+
+
+ZEND_FUNCTION(apache_lookup_uri);
+ZEND_FUNCTION(virtual);
+ZEND_FUNCTION(apache_request_headers);
+ZEND_FUNCTION(apache_response_headers);
+ZEND_FUNCTION(apache_note);
+ZEND_FUNCTION(apache_setenv);
+ZEND_FUNCTION(apache_getenv);
+ZEND_FUNCTION(apache_get_version);
+ZEND_FUNCTION(apache_get_modules);
+
+
+static const zend_function_entry ext_functions[] = {
+ ZEND_FE(apache_lookup_uri, arginfo_apache_lookup_uri)
+ ZEND_FE(virtual, arginfo_virtual)
+ ZEND_FE(apache_request_headers, arginfo_apache_request_headers)
+ ZEND_FALIAS(getallheaders, apache_request_headers, arginfo_getallheaders)
+ ZEND_FE(apache_response_headers, arginfo_apache_response_headers)
+ ZEND_FE(apache_note, arginfo_apache_note)
+ ZEND_FE(apache_setenv, arginfo_apache_setenv)
+ ZEND_FE(apache_getenv, arginfo_apache_getenv)
+ ZEND_FE(apache_get_version, arginfo_apache_get_version)
+ ZEND_FE(apache_get_modules, arginfo_apache_get_modules)
+ ZEND_FE_END
+};
diff --git a/sapi/apache2handler/sapi_apache2.c b/sapi/apache2handler/sapi_apache2.c
index b0d80c9149..2266b46e58 100644
--- a/sapi/apache2handler/sapi_apache2.c
+++ b/sapi/apache2handler/sapi_apache2.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
@@ -21,6 +19,12 @@
#define ZEND_INCLUDE_FULL_WINDOWS_HEADERS
#include "php.h"
+#ifdef strcasecmp
+# undef strcasecmp
+#endif
+#ifdef strncasecmp
+# undef strncasecmp
+#endif
#include "php_main.h"
#include "php_ini.h"
#include "php_variables.h"
@@ -55,7 +59,7 @@
#define PHP_MAGIC_TYPE "application/x-httpd-php"
#define PHP_SOURCE_MAGIC_TYPE "application/x-httpd-php-source"
-#define PHP_SCRIPT "php7-script"
+#define PHP_SCRIPT "php-script"
/* A way to specify the location of the php.ini dir in an apache directive */
char *apache2_php_ini_path_override = NULL;
@@ -239,7 +243,7 @@ php_apache_sapi_read_cookies(void)
}
static char *
-php_apache_sapi_getenv(char *name, size_t name_len)
+php_apache_sapi_getenv(const char *name, size_t name_len)
{
php_struct *ctx = SG(server_context);
const char *env_var;
@@ -301,7 +305,7 @@ php_apache_sapi_flush(void *server_context)
}
}
-static void php_apache_sapi_log_message(char *msg, int syslog_type_int)
+static void php_apache_sapi_log_message(const char *msg, int syslog_type_int)
{
php_struct *ctx;
int aplog_type = APLOG_ERR;
@@ -350,7 +354,7 @@ static void php_apache_sapi_log_message(char *msg, int syslog_type_int)
}
}
-static void php_apache_sapi_log_message_ex(char *msg, request_rec *r)
+static void php_apache_sapi_log_message_ex(const char *msg, request_rec *r)
{
if (r) {
ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r, msg, r->filename);
@@ -551,7 +555,7 @@ typedef struct {
HashTable config;
} php_conf_rec;
zend_string *str;
- php_conf_rec *c = ap_get_module_config(r->per_dir_config, &php7_module);
+ php_conf_rec *c = ap_get_module_config(r->per_dir_config, &php_module);
ZEND_HASH_FOREACH_STR_KEY(&c->config, str) {
zend_restore_ini_entry(str, ZEND_INI_STAGE_SHUTDOWN);
@@ -582,7 +586,7 @@ static int php_handler(request_rec *r)
#define PHPAP_INI_OFF php_apache_ini_dtor(r, parent_req);
- conf = ap_get_module_config(r->per_dir_config, &php7_module);
+ conf = ap_get_module_config(r->per_dir_config, &php_module);
/* apply_config() needs r in some cases, so allocate server_context early */
ctx = SG(server_context);
diff --git a/sapi/cgi/cgi_main.c b/sapi/cgi/cgi_main.c
index cd79475fde..d1d538345f 100644
--- a/sapi/cgi/cgi_main.c
+++ b/sapi/cgi/cgi_main.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
@@ -65,6 +63,7 @@
#include "fopen_wrappers.h"
#include "http_status_codes.h"
#include "ext/standard/php_standard.h"
+#include "ext/standard/dl_arginfo.h"
#include "ext/standard/url.h"
#ifdef PHP_WIN32
@@ -85,6 +84,7 @@ int __riscosify_control = __RISCOSIFY_STRICT_UNIX_SPECS;
#include "php_getopt.h"
#include "fastcgi.h"
+#include "cgi_main_arginfo.h"
#if defined(PHP_WIN32) && defined(HAVE_OPENSSL)
# include "openssl/applink.c"
@@ -240,11 +240,8 @@ static void fcgi_log(int type, const char *format, ...) {
}
#endif
-static int module_name_cmp(const void *a, const void *b)
+static int module_name_cmp(Bucket *f, Bucket *s)
{
- Bucket *f = (Bucket *) a;
- Bucket *s = (Bucket *) b;
-
return strcasecmp( ((zend_module_entry *)Z_PTR(f->val))->name,
((zend_module_entry *)Z_PTR(s->val))->name);
}
@@ -263,10 +260,9 @@ static void print_modules(void)
zend_hash_destroy(&sorted_registry);
}
-static int print_extension_info(zend_extension *ext, void *arg)
+static void print_extension_info(zend_extension *ext)
{
php_printf("%s\n", ext->name);
- return 0;
}
static int extension_name_cmp(const zend_llist_element **f, const zend_llist_element **s)
@@ -283,7 +279,7 @@ static void print_extensions(void)
zend_llist_copy(&sorted_exts, &zend_extensions);
sorted_exts.dtor = NULL;
zend_llist_sort(&sorted_exts, extension_name_cmp);
- zend_llist_apply_with_argument(&sorted_exts, (llist_apply_with_arg_func_t) print_extension_info, NULL);
+ zend_llist_apply(&sorted_exts, (llist_apply_func_t) print_extension_info);
zend_llist_destroy(&sorted_exts);
}
@@ -559,7 +555,7 @@ static char *cgi_getenv_win32(const char *name, size_t name_len)
}
#endif
-static char *sapi_cgi_getenv(char *name, size_t name_len)
+static char *sapi_cgi_getenv(const char *name, size_t name_len)
{
#ifndef PHP_WIN32
return getenv(name);
@@ -568,7 +564,7 @@ static char *sapi_cgi_getenv(char *name, size_t name_len)
#endif
}
-static char *sapi_fcgi_getenv(char *name, size_t name_len)
+static char *sapi_fcgi_getenv(const char *name, size_t name_len)
{
/* when php is started by mod_fastcgi, no regular environment
* is provided to PHP. It is always sent to PHP at the start
@@ -652,10 +648,10 @@ static char *sapi_fcgi_read_cookies(void)
return FCGI_GETENV(request, "HTTP_COOKIE");
}
-static void cgi_php_load_env_var(char *var, unsigned int var_len, char *val, unsigned int val_len, void *arg)
+static void cgi_php_load_env_var(const char *var, unsigned int var_len, char *val, unsigned int val_len, void *arg)
{
- zval *array_ptr = (zval*)arg;
- int filter_arg = (Z_ARR_P(array_ptr) == Z_ARR(PG(http_globals)[TRACK_VARS_ENV]))?PARSE_ENV:PARSE_SERVER;
+ zval *array_ptr = (zval *) arg;
+ int filter_arg = (Z_ARR_P(array_ptr) == Z_ARR(PG(http_globals)[TRACK_VARS_ENV])) ? PARSE_ENV : PARSE_SERVER;
size_t new_val_len;
if (sapi_module.input_filter(filter_arg, var, &val, strlen(val), &new_val_len)) {
@@ -753,7 +749,7 @@ static void sapi_cgi_register_variables(zval *track_vars_array)
}
}
-static void sapi_cgi_log_message(char *message, int syslog_type_int)
+static void sapi_cgi_log_message(const char *message, int syslog_type_int)
{
if (fcgi_is_fastcgi() && CGIG(fcgi_logging)) {
fcgi_request *request;
@@ -779,8 +775,7 @@ static void sapi_cgi_log_message(char *message, int syslog_type_int)
}
}
-/* {{{ php_cgi_ini_activate_user_config
- */
+/* {{{ php_cgi_ini_activate_user_config */
static void php_cgi_ini_activate_user_config(char *path, size_t path_len, const char *doc_root, size_t doc_root_len)
{
user_config_cache_entry *new_entry, *entry;
@@ -976,8 +971,7 @@ static int php_cgi_startup(sapi_module_struct *sapi_module)
return SUCCESS;
}
-/* {{{ sapi_module_struct cgi_sapi_module
- */
+/* {{{ sapi_module_struct cgi_sapi_module */
static sapi_module_struct cgi_sapi_module = {
"cgi-fcgi", /* name */
"CGI/FastCGI", /* pretty name */
@@ -1011,19 +1005,12 @@ static sapi_module_struct cgi_sapi_module = {
};
/* }}} */
-/* {{{ arginfo ext/standard/dl.c */
-ZEND_BEGIN_ARG_INFO(arginfo_dl, 0)
- ZEND_ARG_INFO(0, extension_filename)
-ZEND_END_ARG_INFO()
-/* }}} */
-
static const zend_function_entry additional_functions[] = {
ZEND_FE(dl, arginfo_dl)
PHP_FE_END
};
-/* {{{ php_cgi_usage
- */
+/* {{{ php_cgi_usage */
static void php_cgi_usage(char *argv0)
{
char *prog;
@@ -1107,7 +1094,7 @@ static int is_valid_path(const char *path)
initializes request_info structure
- specificly in this section we handle proper translations
+ specifically in this section we handle proper translations
for:
PATH_INFO
@@ -1515,21 +1502,20 @@ BOOL WINAPI fastcgi_cleanup(DWORD sig)
#endif
PHP_INI_BEGIN()
- STD_PHP_INI_ENTRY("cgi.rfc2616_headers", "0", PHP_INI_ALL, OnUpdateBool, rfc2616_headers, php_cgi_globals_struct, php_cgi_globals)
- STD_PHP_INI_ENTRY("cgi.nph", "0", PHP_INI_ALL, OnUpdateBool, nph, php_cgi_globals_struct, php_cgi_globals)
- STD_PHP_INI_ENTRY("cgi.check_shebang_line", "1", PHP_INI_SYSTEM, OnUpdateBool, check_shebang_line, php_cgi_globals_struct, php_cgi_globals)
- STD_PHP_INI_ENTRY("cgi.force_redirect", "1", PHP_INI_SYSTEM, OnUpdateBool, force_redirect, php_cgi_globals_struct, php_cgi_globals)
+ STD_PHP_INI_BOOLEAN("cgi.rfc2616_headers", "0", PHP_INI_ALL, OnUpdateBool, rfc2616_headers, php_cgi_globals_struct, php_cgi_globals)
+ STD_PHP_INI_BOOLEAN("cgi.nph", "0", PHP_INI_ALL, OnUpdateBool, nph, php_cgi_globals_struct, php_cgi_globals)
+ STD_PHP_INI_BOOLEAN("cgi.check_shebang_line", "1", PHP_INI_SYSTEM, OnUpdateBool, check_shebang_line, php_cgi_globals_struct, php_cgi_globals)
+ STD_PHP_INI_BOOLEAN("cgi.force_redirect", "1", PHP_INI_SYSTEM, OnUpdateBool, force_redirect, php_cgi_globals_struct, php_cgi_globals)
STD_PHP_INI_ENTRY("cgi.redirect_status_env", NULL, PHP_INI_SYSTEM, OnUpdateString, redirect_status_env, php_cgi_globals_struct, php_cgi_globals)
- STD_PHP_INI_ENTRY("cgi.fix_pathinfo", "1", PHP_INI_SYSTEM, OnUpdateBool, fix_pathinfo, php_cgi_globals_struct, php_cgi_globals)
- STD_PHP_INI_ENTRY("cgi.discard_path", "0", PHP_INI_SYSTEM, OnUpdateBool, discard_path, php_cgi_globals_struct, php_cgi_globals)
- STD_PHP_INI_ENTRY("fastcgi.logging", "1", PHP_INI_SYSTEM, OnUpdateBool, fcgi_logging, php_cgi_globals_struct, php_cgi_globals)
+ STD_PHP_INI_BOOLEAN("cgi.fix_pathinfo", "1", PHP_INI_SYSTEM, OnUpdateBool, fix_pathinfo, php_cgi_globals_struct, php_cgi_globals)
+ STD_PHP_INI_BOOLEAN("cgi.discard_path", "0", PHP_INI_SYSTEM, OnUpdateBool, discard_path, php_cgi_globals_struct, php_cgi_globals)
+ STD_PHP_INI_BOOLEAN("fastcgi.logging", "1", PHP_INI_SYSTEM, OnUpdateBool, fcgi_logging, php_cgi_globals_struct, php_cgi_globals)
#ifdef PHP_WIN32
- STD_PHP_INI_ENTRY("fastcgi.impersonate", "0", PHP_INI_SYSTEM, OnUpdateBool, impersonate, php_cgi_globals_struct, php_cgi_globals)
+ STD_PHP_INI_BOOLEAN("fastcgi.impersonate", "0", PHP_INI_SYSTEM, OnUpdateBool, impersonate, php_cgi_globals_struct, php_cgi_globals)
#endif
PHP_INI_END()
-/* {{{ php_cgi_globals_ctor
- */
+/* {{{ php_cgi_globals_ctor */
static void php_cgi_globals_ctor(php_cgi_globals_struct *php_cgi_globals)
{
#if defined(ZTS) && defined(PHP_WIN32)
@@ -1550,8 +1536,7 @@ static void php_cgi_globals_ctor(php_cgi_globals_struct *php_cgi_globals)
}
/* }}} */
-/* {{{ PHP_MINIT_FUNCTION
- */
+/* {{{ PHP_MINIT_FUNCTION */
static PHP_MINIT_FUNCTION(cgi)
{
REGISTER_INI_ENTRIES();
@@ -1559,8 +1544,7 @@ static PHP_MINIT_FUNCTION(cgi)
}
/* }}} */
-/* {{{ PHP_MSHUTDOWN_FUNCTION
- */
+/* {{{ PHP_MSHUTDOWN_FUNCTION */
static PHP_MSHUTDOWN_FUNCTION(cgi)
{
zend_hash_destroy(&CGIG(user_config_cache));
@@ -1570,8 +1554,7 @@ static PHP_MSHUTDOWN_FUNCTION(cgi)
}
/* }}} */
-/* {{{ PHP_MINFO_FUNCTION
- */
+/* {{{ PHP_MINFO_FUNCTION */
static PHP_MINFO_FUNCTION(cgi)
{
DISPLAY_INI_ENTRIES();
@@ -1581,7 +1564,7 @@ static PHP_MINFO_FUNCTION(cgi)
PHP_FUNCTION(apache_child_terminate) /* {{{ */
{
if (zend_parse_parameters_none()) {
- return;
+ RETURN_THROWS();
}
if (fcgi_is_fastcgi()) {
fcgi_terminate();
@@ -1593,7 +1576,7 @@ PHP_FUNCTION(apache_child_terminate) /* {{{ */
PHP_FUNCTION(apache_request_headers) /* {{{ */
{
if (zend_parse_parameters_none()) {
- return;
+ RETURN_THROWS();
}
array_init(return_value);
if (fcgi_is_fastcgi()) {
@@ -1706,7 +1689,7 @@ static void add_response_header(sapi_header_struct *h, zval *return_value) /* {{
PHP_FUNCTION(apache_response_headers) /* {{{ */
{
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
array_init(return_value);
@@ -1714,21 +1697,10 @@ PHP_FUNCTION(apache_response_headers) /* {{{ */
}
/* }}} */
-ZEND_BEGIN_ARG_INFO(arginfo_no_args, 0)
-ZEND_END_ARG_INFO()
-
-static const zend_function_entry cgi_functions[] = {
- PHP_FE(apache_child_terminate, arginfo_no_args)
- PHP_FE(apache_request_headers, arginfo_no_args)
- PHP_FE(apache_response_headers, arginfo_no_args)
- PHP_FALIAS(getallheaders, apache_request_headers, arginfo_no_args)
- PHP_FE_END
-};
-
static zend_module_entry cgi_module_entry = {
STANDARD_MODULE_HEADER,
"cgi-fcgi",
- cgi_functions,
+ ext_functions,
PHP_MINIT(cgi),
PHP_MSHUTDOWN(cgi),
NULL,
@@ -1738,8 +1710,7 @@ static zend_module_entry cgi_module_entry = {
STANDARD_MODULE_PROPERTIES
};
-/* {{{ main
- */
+/* {{{ main */
int main(int argc, char *argv[])
{
int free_query_string = 0;
@@ -2571,10 +2542,7 @@ parent_loop_end:
case PHP_MODE_STRIP:
if (open_file_for_scanning(&file_handle) == SUCCESS) {
zend_strip();
- zend_file_handle_dtor(&file_handle);
- php_output_teardown();
}
- return SUCCESS;
break;
case PHP_MODE_HIGHLIGHT:
{
@@ -2583,13 +2551,7 @@ parent_loop_end:
if (open_file_for_scanning(&file_handle) == SUCCESS) {
php_get_highlight_struct(&syntax_highlighter_ini);
zend_highlight(&syntax_highlighter_ini);
- if (fastcgi) {
- goto fastcgi_request_done;
- }
- zend_file_handle_dtor(&file_handle);
- php_output_teardown();
}
- return SUCCESS;
}
break;
}
diff --git a/sapi/cgi/cgi_main.stub.php b/sapi/cgi/cgi_main.stub.php
new file mode 100644
index 0000000000..8273cffdc2
--- /dev/null
+++ b/sapi/cgi/cgi_main.stub.php
@@ -0,0 +1,12 @@
+<?php
+
+/** @generate-function-entries */
+
+function apache_child_terminate(): void {}
+
+function apache_request_headers(): array {}
+
+/** @alias apache_request_headers */
+function getallheaders(): array {}
+
+function apache_response_headers(): array {}
diff --git a/sapi/cgi/cgi_main_arginfo.h b/sapi/cgi/cgi_main_arginfo.h
new file mode 100644
index 0000000000..2eaab875c4
--- /dev/null
+++ b/sapi/cgi/cgi_main_arginfo.h
@@ -0,0 +1,26 @@
+/* This is a generated file, edit the .stub.php file instead.
+ * Stub hash: ccb32ad91944af15fe1fcb44b97c28a79c1aad86 */
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_apache_child_terminate, 0, 0, IS_VOID, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_apache_request_headers, 0, 0, IS_ARRAY, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_getallheaders arginfo_apache_request_headers
+
+#define arginfo_apache_response_headers arginfo_apache_request_headers
+
+
+ZEND_FUNCTION(apache_child_terminate);
+ZEND_FUNCTION(apache_request_headers);
+ZEND_FUNCTION(apache_response_headers);
+
+
+static const zend_function_entry ext_functions[] = {
+ ZEND_FE(apache_child_terminate, arginfo_apache_child_terminate)
+ ZEND_FE(apache_request_headers, arginfo_apache_request_headers)
+ ZEND_FALIAS(getallheaders, apache_request_headers, arginfo_getallheaders)
+ ZEND_FE(apache_response_headers, arginfo_apache_response_headers)
+ ZEND_FE_END
+};
diff --git a/sapi/cgi/config9.m4 b/sapi/cgi/config9.m4
index ae927cd5f8..04bd70b269 100644
--- a/sapi/cgi/config9.m4
+++ b/sapi/cgi/config9.m4
@@ -55,7 +55,7 @@ if test "$PHP_CGI" != "no"; then
BUILD_CGI="\$(CC) \$(CFLAGS_CLEAN) \$(EXTRA_CFLAGS) \$(EXTRA_LDFLAGS_PROGRAM) \$(LDFLAGS) \$(NATIVE_RPATHS) \$(PHP_GLOBAL_OBJS:.lo=.o) \$(PHP_BINARY_OBJS:.lo=.o) \$(PHP_FASTCGI_OBJS:.lo=.o) \$(PHP_CGI_OBJS:.lo=.o) \$(PHP_FRAMEWORKS) \$(EXTRA_LIBS) \$(ZEND_EXTRA_LIBS) -o \$(SAPI_CGI_PATH)"
;;
*)
- BUILD_CGI="\$(LIBTOOL) --mode=link \$(CC) -export-dynamic \$(CFLAGS_CLEAN) \$(EXTRA_CFLAGS) \$(EXTRA_LDFLAGS_PROGRAM) \$(LDFLAGS) \$(PHP_RPATHS) \$(PHP_GLOBAL_OBJS) \$(PHP_BINARY_OBJS) \$(PHP_FASTCGI_OBJS) \$(PHP_CGI_OBJS) \$(EXTRA_LIBS) \$(ZEND_EXTRA_LIBS) -o \$(SAPI_CGI_PATH)"
+ BUILD_CGI="\$(LIBTOOL) --mode=link \$(CC) -export-dynamic \$(CFLAGS_CLEAN) \$(EXTRA_CFLAGS) \$(EXTRA_LDFLAGS_PROGRAM) \$(LDFLAGS) \$(PHP_RPATHS) \$(PHP_GLOBAL_OBJS:.lo=.o) \$(PHP_BINARY_OBJS:.lo=.o) \$(PHP_FASTCGI_OBJS:.lo=.o) \$(PHP_CGI_OBJS:.lo=.o) \$(EXTRA_LIBS) \$(ZEND_EXTRA_LIBS) -o \$(SAPI_CGI_PATH)"
;;
esac
diff --git a/sapi/cgi/tests/003.phpt b/sapi/cgi/tests/003.phpt
index 4b4d29267d..ac3f6aa8e6 100644
--- a/sapi/cgi/tests/003.phpt
+++ b/sapi/cgi/tests/003.phpt
@@ -4,7 +4,7 @@ strip comments and whitespace with -w
<?php
if (substr(PHP_OS, 0, 3) == 'WIN') {
- die ("skip not for Windows");
+ die ("skip not for Windows");
}
include "skipif.inc";
@@ -23,12 +23,12 @@ $code ='
/* some test script */
class test { /* {{{ */
- public $var = "test"; //test var
-#perl style comment
- private $pri; /* private attr */
+ public $var = "test"; //test var
+#perl style comment
+ private $pri; /* private attr */
- function foo(/* void */) {
- }
+ function foo(/* void */) {
+ }
}
/* }}} */
diff --git a/sapi/cgi/tests/004.phpt b/sapi/cgi/tests/004.phpt
index b46dce7052..1de856e346 100644
--- a/sapi/cgi/tests/004.phpt
+++ b/sapi/cgi/tests/004.phpt
@@ -17,7 +17,7 @@ $code ='
<?php
class test {
- private $pri;
+ private $pri;
}
var_dump(test::$pri);
@@ -27,9 +27,9 @@ var_dump(test::$pri);
file_put_contents($filename, $code);
if (defined("PHP_WINDOWS_VERSION_MAJOR")) {
- var_dump(`$php -n -f "$filename"`);
+ var_dump(`$php -n -f "$filename"`);
} else {
- var_dump(`$php -n -f "$filename" 2>/dev/null`);
+ var_dump(`$php -n -f "$filename" 2>/dev/null`);
}
var_dump(`$php -n -f "wrong"`);
diff --git a/sapi/cgi/tests/005-win32.phpt b/sapi/cgi/tests/005-win32.phpt
index 1674f16fb9..cafec91d3d 100644
--- a/sapi/cgi/tests/005-win32.phpt
+++ b/sapi/cgi/tests/005-win32.phpt
@@ -4,7 +4,7 @@ using invalid combinations of cmdline options
<?php
if (substr(PHP_OS, 0, 3) != 'WIN') {
- die ("skip Windows only");
+ die ("skip Windows only");
}
include "skipif.inc";
diff --git a/sapi/cgi/tests/005.phpt b/sapi/cgi/tests/005.phpt
index 6b41f7a99f..a46ac912c7 100644
--- a/sapi/cgi/tests/005.phpt
+++ b/sapi/cgi/tests/005.phpt
@@ -4,7 +4,7 @@ using invalid combinations of cmdline options
<?php
if (substr(PHP_OS, 0, 3) == 'WIN') {
- die ("skip not for Windows");
+ die ("skip not for Windows");
}
include "skipif.inc";
diff --git a/sapi/cgi/tests/006.phpt b/sapi/cgi/tests/006.phpt
index c78229880c..479d4a9441 100644
--- a/sapi/cgi/tests/006.phpt
+++ b/sapi/cgi/tests/006.phpt
@@ -19,7 +19,7 @@ $code = '
$test = "var";
class test {
- private $var;
+ private $var;
}
echo test::$var;
@@ -35,8 +35,8 @@ var_dump(`"$php" -n -l some.unknown`);
$code = '
<?php
-class test
- private $var;
+class test
+ private $var;
}
?>
@@ -45,9 +45,9 @@ class test
file_put_contents($filename, $code);
if (defined("PHP_WINDOWS_VERSION_MAJOR")) {
- var_dump(`"$php" -n -l "$filename"`);
+ var_dump(`"$php" -n -l "$filename"`);
} else {
- var_dump(`"$php" -n -l "$filename" 2>/dev/null`);
+ var_dump(`"$php" -n -l "$filename" 2>/dev/null`);
}
@unlink($filename);
diff --git a/sapi/cgi/tests/007.phpt b/sapi/cgi/tests/007.phpt
index 950f451083..96062486e0 100644
--- a/sapi/cgi/tests/007.phpt
+++ b/sapi/cgi/tests/007.phpt
@@ -13,10 +13,8 @@ var_dump(`"$php" -n -f some.php -f some.php`);
var_dump(`"$php" -n -s -w -l`);
?>
-===DONE===
--EXPECT--
string(25) "No input file specified.
"
string(49) "No syntax errors detected in Standard input code
"
-===DONE===
diff --git a/sapi/cgi/tests/008.phpt b/sapi/cgi/tests/008.phpt
index be2fd578e7..05d9d8c190 100644
--- a/sapi/cgi/tests/008.phpt
+++ b/sapi/cgi/tests/008.phpt
@@ -16,12 +16,12 @@ $code = '
$test = "var"; //var
/* test class */
class test {
- private $var = array();
+ private $var = array();
- public static function foo(Test $arg) {
- echo "hello";
- var_dump($this);
- }
+ public static function foo(Test $arg) {
+ echo "hello";
+ var_dump($this);
+ }
}
$o = new test;
diff --git a/sapi/cgi/tests/011.phpt b/sapi/cgi/tests/011.phpt
index 6d4a6ed7f9..263c2e61ef 100644
--- a/sapi/cgi/tests/011.phpt
+++ b/sapi/cgi/tests/011.phpt
@@ -13,13 +13,13 @@ reset_env_vars();
$f = tempnam(sys_get_temp_dir(), 'cgitest');
function test($script) {
- file_put_contents($GLOBALS['f'], $script);
- $cmd = escapeshellcmd($GLOBALS['php']);
- $cmd .= ' -n -dreport_zend_debug=0 -dhtml_errors=0 ' . escapeshellarg($GLOBALS['f']);
- echo "----------\n";
- echo rtrim($script) . "\n";
- echo "----------\n";
- passthru($cmd);
+ file_put_contents($GLOBALS['f'], $script);
+ $cmd = escapeshellcmd($GLOBALS['php']);
+ $cmd .= ' -n -dreport_zend_debug=0 -dhtml_errors=0 ' . escapeshellarg($GLOBALS['f']);
+ echo "----------\n";
+ echo rtrim($script) . "\n";
+ echo "----------\n";
+ passthru($cmd);
}
test('<?php ?>');
diff --git a/sapi/cgi/tests/apache_request_headers.phpt b/sapi/cgi/tests/apache_request_headers.phpt
index bda9ef8b70..647508a64a 100644
--- a/sapi/cgi/tests/apache_request_headers.phpt
+++ b/sapi/cgi/tests/apache_request_headers.phpt
@@ -21,9 +21,9 @@ passthru("$php -n $file");
$names = array('HTTP_X_TEST', 'HTTP_X__TEST', 'HTTP_X_');
foreach ($names as $name) {
- putenv($name."=".str_repeat("A", 256));
- passthru("$php -n -q $file");
- putenv($name);
+ putenv($name."=".str_repeat("A", 256));
+ passthru("$php -n -q $file");
+ putenv($name);
}
unlink($file);
diff --git a/sapi/cgi/tests/apache_response_headers.phpt b/sapi/cgi/tests/apache_response_headers.phpt
index 99b1352680..bb8b3032ad 100644
--- a/sapi/cgi/tests/apache_response_headers.phpt
+++ b/sapi/cgi/tests/apache_response_headers.phpt
@@ -31,7 +31,6 @@ file_put_contents( $test_file, $code );
passthru( "$php -n -q " . escapeshellarg( $test_file ) );
?>
-===DONE===
--CLEAN--
<?php
@unlink( __DIR__ . DIRECTORY_SEPARATOR ."apache_response_headers.test.php" );
@@ -45,4 +44,3 @@ array(3) {
["Content-type"]=>
string(24) "text/html; charset=UTF-8"
}
-===DONE===
diff --git a/sapi/cgi/tests/bug61605.phpt b/sapi/cgi/tests/bug61605.phpt
index 9c29e6dda2..73b72e24a1 100644
--- a/sapi/cgi/tests/bug61605.phpt
+++ b/sapi/cgi/tests/bug61605.phpt
@@ -18,6 +18,7 @@ $headers3 = headers_list();
print_r($headers1);
print_r($headers2);
print_r($headers3);
+?>
--EXPECTF--
Array
(
diff --git a/sapi/cgi/tests/bug75574_utf8.phpt b/sapi/cgi/tests/bug75574_utf8.phpt
index d7f0e3e5ee..9cbd51abfb 100644
--- a/sapi/cgi/tests/bug75574_utf8.phpt
+++ b/sapi/cgi/tests/bug75574_utf8.phpt
@@ -24,8 +24,6 @@ echo shell_exec("$php -n -f $fn");
unlink($fn);
?>
-===DONE===
--EXPECT--
bool(true)
string(3) "å•Š"
-===DONE===
diff --git a/sapi/cgi/tests/include.inc b/sapi/cgi/tests/include.inc
index 61b339e49f..de526723df 100644
--- a/sapi/cgi/tests/include.inc
+++ b/sapi/cgi/tests/include.inc
@@ -2,64 +2,61 @@
function get_cgi_path() /* {{{ */
{
- $php = getenv("TEST_PHP_EXECUTABLE");
-
- $cli = false;
- $cgi = false;
-
- if (file_exists($php) && is_executable($php)) {
- $version = `$php -n -v`;
- if (strstr($version, "(cli)")) {
- /* that's cli */
- $cli = true;
- } else if (strpos($version, "(cgi")) {
- /* that's cgi */
- return $php;
- }
- }
-
- if ($cli) {
- /* trying to guess ... */
- $php_path = $php;
- if (defined("PHP_WINDOWS_VERSION_MAJOR")) {
- /* On Windows it should be in the same dir as php.exe in most of the cases. */
- $php_path = dirname($php);
-
- if (is_dir($php_path) && file_exists("$php_path/php-cgi.exe") && is_executable("$php_path/php-cgi.exe")) {
- return "$php_path/php-cgi.exe";
- }
- } else {
- for ($i = 0; $i < 2; $i++) {
- $slash_pos = strrpos($php_path, "/");
- if ($slash_pos) {
- $php_path = substr($php_path, 0, $slash_pos);
- } else {
- return FALSE;
- }
- }
-
- if ($php_path && is_dir($php_path) && file_exists($php_path."/cgi/php-cgi") && is_executable($php_path."/cgi/php-cgi")) {
- /* gotcha */
- return $php_path."/cgi/php-cgi";
- }
- }
- return false;
- }
- /* uhm? what's that then? */
- return false;
+ $php = getenv("TEST_PHP_EXECUTABLE");
+
+ $cli = false;
+ $cgi = false;
+
+ if (file_exists($php) && is_executable($php)) {
+ $version = `$php -n -v`;
+ if (strstr($version, "(cli)")) {
+ /* that's cli */
+ $cli = true;
+ } else if (strpos($version, "(cgi")) {
+ /* that's cgi */
+ return $php;
+ }
+ }
+
+ if ($cli) {
+ /* trying to guess ... */
+ $php_path = $php;
+ if (defined("PHP_WINDOWS_VERSION_MAJOR")) {
+ /* On Windows it should be in the same dir as php.exe in most of the cases. */
+ $cgi_path = dirname($php) . "/php-cgi.exe";
+ if (is_executable($cgi_path)) {
+ return $cgi_path;
+ }
+ } else {
+ /* Try in the same path as php, for the case where php is installed. */
+ $cgi_path = dirname($php) . "/php-cgi";
+ if (is_executable($cgi_path)) {
+ return $cgi_path;
+ }
+
+ /* Try sapi/cgi/php-cgi, for the case where php is not installed. */
+ $cgi_path = dirname($php, 3) . "/sapi/cgi/php-cgi";
+ if (is_executable($cgi_path)) {
+ return $cgi_path;
+ }
+ }
+ return false;
+ }
+ /* uhm? what's that then? */
+ return false;
}
/* }}} */
function reset_env_vars() /* {{{ */
{
- putenv("REDIRECT_STATUS");
- putenv("QUERY_STRING");
- putenv("PATH_TRANSLATED");
- putenv("SCRIPT_FILENAME");
- putenv("SERVER_SOFTWARE");
- putenv("SERVER_NAME");
- putenv("GATEWAY_INTERFACE");
- putenv("REQUEST_METHOD");
+ putenv("REDIRECT_STATUS");
+ putenv("QUERY_STRING");
+ putenv("PATH_TRANSLATED");
+ putenv("SCRIPT_FILENAME");
+ putenv("SERVER_SOFTWARE");
+ putenv("SERVER_NAME");
+ putenv("GATEWAY_INTERFACE");
+ putenv("REQUEST_METHOD");
}
/* }}} */
diff --git a/sapi/cgi/tests/skipif.inc b/sapi/cgi/tests/skipif.inc
index d2cef23589..2145a9e410 100644
--- a/sapi/cgi/tests/skipif.inc
+++ b/sapi/cgi/tests/skipif.inc
@@ -1,13 +1,13 @@
<?php
if (substr(php_sapi_name(), 0, 3) == "cgi") {
- exit;
+ exit;
}
include dirname(__FILE__)."/include.inc";
if (!get_cgi_path()) {
- die("skip CGI not found");
+ die("skip CGI not found");
}
?>
diff --git a/sapi/cli/cli.h b/sapi/cli/cli.h
index b4c2851791..a713b5eccf 100644
--- a/sapi/cli/cli.h
+++ b/sapi/cli/cli.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
@@ -36,6 +34,6 @@ typedef struct {
int (*cli_shell_run)(void);
} cli_shell_callbacks_t;
-extern PHP_CLI_API cli_shell_callbacks_t *php_cli_get_shell_callbacks();
+extern PHP_CLI_API cli_shell_callbacks_t *php_cli_get_shell_callbacks(void);
#endif /* CLI_H */
diff --git a/sapi/cli/config.m4 b/sapi/cli/config.m4
index 917d45fad1..d17d531683 100644
--- a/sapi/cli/config.m4
+++ b/sapi/cli/config.m4
@@ -42,7 +42,7 @@ if test "$PHP_CLI" != "no"; then
BUILD_CLI="\$(CC) \$(CFLAGS_CLEAN) \$(EXTRA_CFLAGS) \$(EXTRA_LDFLAGS_PROGRAM) \$(LDFLAGS) \$(NATIVE_RPATHS) \$(PHP_GLOBAL_OBJS:.lo=.o) \$(PHP_BINARY_OBJS:.lo=.o) \$(PHP_CLI_OBJS:.lo=.o) \$(PHP_FRAMEWORKS) \$(EXTRA_LIBS) \$(ZEND_EXTRA_LIBS) -o \$(SAPI_CLI_PATH)"
;;
*)
- BUILD_CLI="\$(LIBTOOL) --mode=link \$(CC) -export-dynamic \$(CFLAGS_CLEAN) \$(EXTRA_CFLAGS) \$(EXTRA_LDFLAGS_PROGRAM) \$(LDFLAGS) \$(PHP_RPATHS) \$(PHP_GLOBAL_OBJS) \$(PHP_BINARY_OBJS) \$(PHP_CLI_OBJS) \$(EXTRA_LIBS) \$(ZEND_EXTRA_LIBS) -o \$(SAPI_CLI_PATH)"
+ BUILD_CLI="\$(LIBTOOL) --mode=link \$(CC) -export-dynamic \$(CFLAGS_CLEAN) \$(EXTRA_CFLAGS) \$(EXTRA_LDFLAGS_PROGRAM) \$(LDFLAGS) \$(PHP_RPATHS) \$(PHP_GLOBAL_OBJS:.lo=.o) \$(PHP_BINARY_OBJS:.lo=.o) \$(PHP_CLI_OBJS:.lo=.o) \$(EXTRA_LIBS) \$(ZEND_EXTRA_LIBS) -o \$(SAPI_CLI_PATH)"
;;
esac
diff --git a/sapi/cli/config.w32 b/sapi/cli/config.w32
index 26c53f7808..28bb2fd4c6 100644
--- a/sapi/cli/config.w32
+++ b/sapi/cli/config.w32
@@ -1,16 +1,12 @@
// vim:ft=javascript
ARG_ENABLE('cli', 'Build CLI version of PHP', 'yes');
-ARG_ENABLE('crt-debug', 'Enable CRT memory dumps for debugging sent to STDERR', 'no');
ARG_ENABLE('cli-win32', 'Build console-less CLI version of PHP', 'no');
if (PHP_CLI == "yes") {
SAPI('cli', 'php_cli.c php_http_parser.c php_cli_server.c php_cli_process_title.c ps_title.c', 'php.exe', '/DZEND_ENABLE_STATIC_TSRMLS_CACHE=1');
ADD_FLAG("LIBS_CLI", "ws2_32.lib");
ADD_FLAG("LIBS_CLI", "shell32.lib");
- if (PHP_CRT_DEBUG == "yes") {
- ADD_FLAG("CFLAGS_CLI", "/D PHP_WIN32_DEBUG_HEAP");
- }
ADD_FLAG("LDFLAGS_CLI", "/stack:67108864");
if (CHECK_LIB("edit_a.lib;edit.lib", "cli", PHP_CLI) &&
diff --git a/sapi/cli/generate_mime_type_map.php b/sapi/cli/generate_mime_type_map.php
index 40f546ef83..04f741f6e1 100755
--- a/sapi/cli/generate_mime_type_map.php
+++ b/sapi/cli/generate_mime_type_map.php
@@ -3,32 +3,42 @@
// Check if we are being given a mime.types file or if we should use the
// default URL.
-$source = count($_SERVER['argv']) > 1 ? $_SERVER['argv'][1] : 'https://raw.githubusercontent.com/apache/httpd/trunk/docs/conf/mime.types';
+$source = count($argv) > 1 ? $argv[1] : 'https://cdn.jsdelivr.net/gh/jshttp/mime-db@v1.45.0/db.json';
// See if we can actually load it.
-$types = @file($source);
-if ($types === false) {
+$data = @file_get_contents($source);
+if ($data === false) {
fprintf(STDERR, "Error: unable to read $source\n");
exit(1);
}
-// Remove comments and flip into an extensions array.
+// Source preference from lowest to highest
+$prefs = ['nginx' => 1, 'apache' => 2, 'custom' => 3, 'iana' => 4];
+
$extensions = [];
-array_walk($types, function ($line) use (&$extensions) {
- $line = trim($line);
- if ($line && $line[0] != '#') {
- $fields = preg_split('/\s+/', $line);
- if (count($fields) > 1) {
- $mime = array_shift($fields);
- foreach ($fields as $extension) {
- $extensions[$extension] = $mime;
+$types = json_decode($data, true);
+foreach ($types as $mime => $info) {
+ $source = $info['source'] ?? 'custom';
+ $pref = $prefs[$source];
+ foreach ($info['extensions'] ?? [] as $extension) {
+ if (isset($extensions[$extension])) {
+ // Use same preference rules as jshttp/mime-types
+ [$oldMime, $oldPref] = $extensions[$extension];
+ if ($oldMime !== 'application/octet-stream'
+ && ($oldPref > $pref
+ || ($oldPref === $pref && substr($oldMime, 0, 12) === 'application/'))) {
+ continue;
}
}
+
+ $extensions[$extension] = [$mime, $pref];
}
-});
+}
+
+// Only keep the MIME type.
+$extensions = array_map(function($x) { return $x[0]; }, $extensions);
$additional_mime_maps = [
- "map" => "application/json", // from commit: a0d62f08ae8cbebc88e5c92e08fca8d0cdc7309d
"jsm" => "application/javascript",
];
@@ -36,15 +46,17 @@ foreach($additional_mime_maps as $ext => $mime) {
if (!isset($extensions[$ext])) {
$extensions[$ext] = $mime;
} else {
- printf(STDERR, "Ignored exist mime type: $ext => $mime\n");
+ fprintf(STDERR, "Ignored exist mime type: $ext => $mime\n");
}
}
-?>
+uksort($extensions, function($ext1, $ext2) {
+ return strcmp($ext1, $ext2);
+});
+
+echo <<<HEADER
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
@@ -66,15 +78,23 @@ foreach($additional_mime_maps as $ext => $mime) {
#define PHP_CLI_SERVER_MIME_TYPE_MAP_H
typedef struct php_cli_server_ext_mime_type_pair {
- const char *ext;
- const char *mime_type;
+\tconst char *ext;
+\tconst char *mime_type;
} php_cli_server_ext_mime_type_pair;
static const php_cli_server_ext_mime_type_pair mime_type_map[] = {
-<?php foreach ($extensions as $extension => $mime): ?>
- { "<?= addcslashes($extension, "\0..\37!@\@\177..\377") ?>", "<?= addcslashes($mime, "\0..\37!@\@\177..\377") ?>" },
-<?php endforeach ?>
- { NULL, NULL }
+
+HEADER;
+
+foreach ($extensions as $extension => $mime) {
+ echo "\t{ \"" .addcslashes($extension, "\0..\37!@\@\177..\377") . "\", \""
+ . addcslashes($mime, "\0..\37!@\@\177..\377") . "\" },\n";
+}
+
+echo <<<FOOTER
+\t{ NULL, NULL }
};
#endif /* PHP_CLI_SERVER_MIME_TYPE_MAP_H */
+
+FOOTER;
diff --git a/sapi/cli/mime_type_map.h b/sapi/cli/mime_type_map.h
index 0c559d635f..46921c4ec3 100644
--- a/sapi/cli/mime_type_map.h
+++ b/sapi/cli/mime_type_map.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
@@ -28,991 +26,1170 @@ typedef struct php_cli_server_ext_mime_type_pair {
} php_cli_server_ext_mime_type_pair;
static const php_cli_server_ext_mime_type_pair mime_type_map[] = {
- { "ez", "application/andrew-inset" },
- { "aw", "application/applixware" },
- { "atom", "application/atom+xml" },
- { "atomcat", "application/atomcat+xml" },
- { "atomsvc", "application/atomsvc+xml" },
- { "ccxml", "application/ccxml+xml" },
- { "cdmia", "application/cdmi-capability" },
- { "cdmic", "application/cdmi-container" },
- { "cdmid", "application/cdmi-domain" },
- { "cdmio", "application/cdmi-object" },
- { "cdmiq", "application/cdmi-queue" },
- { "cu", "application/cu-seeme" },
- { "davmount", "application/davmount+xml" },
- { "dbk", "application/docbook+xml" },
- { "dssc", "application/dssc+der" },
- { "xdssc", "application/dssc+xml" },
- { "ecma", "application/ecmascript" },
- { "emma", "application/emma+xml" },
- { "epub", "application/epub+zip" },
- { "exi", "application/exi" },
- { "pfr", "application/font-tdpfr" },
- { "gml", "application/gml+xml" },
- { "gpx", "application/gpx+xml" },
- { "gxf", "application/gxf" },
- { "stk", "application/hyperstudio" },
- { "ink", "application/inkml+xml" },
- { "inkml", "application/inkml+xml" },
- { "ipfix", "application/ipfix" },
- { "jar", "application/java-archive" },
- { "ser", "application/java-serialized-object" },
- { "class", "application/java-vm" },
- { "js", "application/javascript" },
- { "json", "application/json" },
- { "jsonml", "application/jsonml+json" },
- { "lostxml", "application/lost+xml" },
- { "hqx", "application/mac-binhex40" },
- { "cpt", "application/mac-compactpro" },
- { "mads", "application/mads+xml" },
- { "mrc", "application/marc" },
- { "mrcx", "application/marcxml+xml" },
- { "ma", "application/mathematica" },
- { "nb", "application/mathematica" },
- { "mb", "application/mathematica" },
- { "mathml", "application/mathml+xml" },
- { "mbox", "application/mbox" },
- { "mscml", "application/mediaservercontrol+xml" },
- { "metalink", "application/metalink+xml" },
- { "meta4", "application/metalink4+xml" },
- { "mets", "application/mets+xml" },
- { "mods", "application/mods+xml" },
- { "m21", "application/mp21" },
- { "mp21", "application/mp21" },
- { "mp4s", "application/mp4" },
- { "doc", "application/msword" },
- { "dot", "application/msword" },
- { "mxf", "application/mxf" },
- { "bin", "application/octet-stream" },
- { "dms", "application/octet-stream" },
- { "lrf", "application/octet-stream" },
- { "mar", "application/octet-stream" },
- { "so", "application/octet-stream" },
- { "dist", "application/octet-stream" },
- { "distz", "application/octet-stream" },
- { "pkg", "application/octet-stream" },
- { "bpk", "application/octet-stream" },
- { "dump", "application/octet-stream" },
- { "elc", "application/octet-stream" },
- { "deploy", "application/octet-stream" },
- { "oda", "application/oda" },
- { "opf", "application/oebps-package+xml" },
- { "ogx", "application/ogg" },
- { "omdoc", "application/omdoc+xml" },
- { "onetoc", "application/onenote" },
- { "onetoc2", "application/onenote" },
- { "onetmp", "application/onenote" },
- { "onepkg", "application/onenote" },
- { "oxps", "application/oxps" },
- { "xer", "application/patch-ops-error+xml" },
- { "pdf", "application/pdf" },
- { "pgp", "application/pgp-encrypted" },
- { "asc", "application/pgp-signature" },
- { "sig", "application/pgp-signature" },
- { "prf", "application/pics-rules" },
- { "p10", "application/pkcs10" },
- { "p7m", "application/pkcs7-mime" },
- { "p7c", "application/pkcs7-mime" },
- { "p7s", "application/pkcs7-signature" },
- { "p8", "application/pkcs8" },
+ { "123", "application/vnd.lotus-1-2-3" },
+ { "1km", "application/vnd.1000minds.decision-model+xml" },
+ { "3dml", "text/vnd.in3d.3dml" },
+ { "3ds", "image/x-3ds" },
+ { "3g2", "video/3gpp2" },
+ { "3gp", "video/3gpp" },
+ { "3gpp", "video/3gpp" },
+ { "3mf", "model/3mf" },
+ { "7z", "application/x-7z-compressed" },
+ { "aab", "application/x-authorware-bin" },
+ { "aac", "audio/x-aac" },
+ { "aam", "application/x-authorware-map" },
+ { "aas", "application/x-authorware-seg" },
+ { "abw", "application/x-abiword" },
{ "ac", "application/pkix-attr-cert" },
- { "cer", "application/pkix-cert" },
- { "crl", "application/pkix-crl" },
- { "pkipath", "application/pkix-pkipath" },
- { "pki", "application/pkixcmp" },
- { "pls", "application/pls+xml" },
- { "ai", "application/postscript" },
- { "eps", "application/postscript" },
- { "ps", "application/postscript" },
- { "cww", "application/prs.cww" },
- { "pskcxml", "application/pskc+xml" },
- { "rdf", "application/rdf+xml" },
- { "rif", "application/reginfo+xml" },
- { "rnc", "application/relax-ng-compact-syntax" },
- { "rl", "application/resource-lists+xml" },
- { "rld", "application/resource-lists-diff+xml" },
- { "rs", "application/rls-services+xml" },
- { "gbr", "application/rpki-ghostbusters" },
- { "mft", "application/rpki-manifest" },
- { "roa", "application/rpki-roa" },
- { "rsd", "application/rsd+xml" },
- { "rss", "application/rss+xml" },
- { "rtf", "application/rtf" },
- { "sbml", "application/sbml+xml" },
- { "scq", "application/scvp-cv-request" },
- { "scs", "application/scvp-cv-response" },
- { "spq", "application/scvp-vp-request" },
- { "spp", "application/scvp-vp-response" },
- { "sdp", "application/sdp" },
- { "setpay", "application/set-payment-initiation" },
- { "setreg", "application/set-registration-initiation" },
- { "shf", "application/shf+xml" },
- { "smi", "application/smil+xml" },
- { "smil", "application/smil+xml" },
- { "rq", "application/sparql-query" },
- { "srx", "application/sparql-results+xml" },
- { "gram", "application/srgs" },
- { "grxml", "application/srgs+xml" },
- { "sru", "application/sru+xml" },
- { "ssdl", "application/ssdl+xml" },
- { "ssml", "application/ssml+xml" },
- { "tei", "application/tei+xml" },
- { "teicorpus", "application/tei+xml" },
- { "tfi", "application/thraud+xml" },
- { "tsd", "application/timestamped-data" },
- { "plb", "application/vnd.3gpp.pic-bw-large" },
- { "psb", "application/vnd.3gpp.pic-bw-small" },
- { "pvb", "application/vnd.3gpp.pic-bw-var" },
- { "tcap", "application/vnd.3gpp2.tcap" },
- { "pwn", "application/vnd.3m.post-it-notes" },
- { "aso", "application/vnd.accpac.simply.aso" },
- { "imp", "application/vnd.accpac.simply.imp" },
+ { "acc", "application/vnd.americandynamics.acc" },
+ { "ace", "application/x-ace-compressed" },
{ "acu", "application/vnd.acucobol" },
- { "atc", "application/vnd.acucorp" },
{ "acutc", "application/vnd.acucorp" },
- { "air", "application/vnd.adobe.air-application-installer-package+zip" },
- { "fcdt", "application/vnd.adobe.formscentral.fcdt" },
- { "fxp", "application/vnd.adobe.fxp" },
- { "fxpl", "application/vnd.adobe.fxp" },
- { "xdp", "application/vnd.adobe.xdp+xml" },
- { "xfdf", "application/vnd.adobe.xfdf" },
+ { "adp", "audio/adpcm" },
+ { "aep", "application/vnd.audiograph" },
+ { "afm", "application/x-font-type1" },
+ { "afp", "application/vnd.ibm.modcap" },
{ "ahead", "application/vnd.ahead.space" },
- { "azf", "application/vnd.airzip.filesecure.azf" },
- { "azs", "application/vnd.airzip.filesecure.azs" },
- { "azw", "application/vnd.amazon.ebook" },
- { "acc", "application/vnd.americandynamics.acc" },
+ { "ai", "application/postscript" },
+ { "aif", "audio/x-aiff" },
+ { "aifc", "audio/x-aiff" },
+ { "aiff", "audio/x-aiff" },
+ { "air", "application/vnd.adobe.air-application-installer-package+zip" },
+ { "ait", "application/vnd.dvb.ait" },
{ "ami", "application/vnd.amiga.ami" },
{ "apk", "application/vnd.android.package-archive" },
- { "cii", "application/vnd.anser-web-certificate-issue-initiation" },
- { "fti", "application/vnd.anser-web-funds-transfer-initiation" },
+ { "apng", "image/apng" },
+ { "appcache", "text/cache-manifest" },
+ { "application", "application/x-ms-application" },
+ { "apr", "application/vnd.lotus-approach" },
+ { "arc", "application/x-freearc" },
+ { "arj", "application/x-arj" },
+ { "asc", "application/pgp-signature" },
+ { "asf", "video/x-ms-asf" },
+ { "asm", "text/x-asm" },
+ { "aso", "application/vnd.accpac.simply.aso" },
+ { "asx", "video/x-ms-asf" },
+ { "atc", "application/vnd.acucorp" },
+ { "atom", "application/atom+xml" },
+ { "atomcat", "application/atomcat+xml" },
+ { "atomdeleted", "application/atomdeleted+xml" },
+ { "atomsvc", "application/atomsvc+xml" },
{ "atx", "application/vnd.antix.game-component" },
- { "mpkg", "application/vnd.apple.installer+xml" },
- { "m3u8", "application/vnd.apple.mpegurl" },
- { "swi", "application/vnd.aristanetworks.swi" },
- { "iota", "application/vnd.astraea-software.iota" },
- { "aep", "application/vnd.audiograph" },
- { "mpm", "application/vnd.blueice.multipass" },
+ { "au", "audio/basic" },
+ { "avi", "video/x-msvideo" },
+ { "avif", "image/avif" },
+ { "aw", "application/applixware" },
+ { "azf", "application/vnd.airzip.filesecure.azf" },
+ { "azs", "application/vnd.airzip.filesecure.azs" },
+ { "azv", "image/vnd.airzip.accelerator.azv" },
+ { "azw", "application/vnd.amazon.ebook" },
+ { "b16", "image/vnd.pco.b16" },
+ { "bat", "application/x-msdownload" },
+ { "bcpio", "application/x-bcpio" },
+ { "bdf", "application/x-font-bdf" },
+ { "bdm", "application/vnd.syncml.dm+wbxml" },
+ { "bdoc", "application/bdoc" },
+ { "bed", "application/vnd.realvnc.bed" },
+ { "bh2", "application/vnd.fujitsu.oasysprs" },
+ { "bin", "application/octet-stream" },
+ { "blb", "application/x-blorb" },
+ { "blorb", "application/x-blorb" },
{ "bmi", "application/vnd.bmi" },
- { "rep", "application/vnd.businessobjects" },
- { "cdxml", "application/vnd.chemdraw+xml" },
- { "mmd", "application/vnd.chipnuts.karaoke-mmd" },
- { "cdy", "application/vnd.cinderella" },
- { "cla", "application/vnd.claymore" },
- { "rp9", "application/vnd.cloanto.rp9" },
- { "c4g", "application/vnd.clonk.c4group" },
+ { "bmml", "application/vnd.balsamiq.bmml+xml" },
+ { "bmp", "image/bmp" },
+ { "book", "application/vnd.framemaker" },
+ { "box", "application/vnd.previewsystems.box" },
+ { "boz", "application/x-bzip2" },
+ { "bpk", "application/octet-stream" },
+ { "bsp", "model/vnd.valve.source.compiled-map" },
+ { "btif", "image/prs.btif" },
+ { "buffer", "application/octet-stream" },
+ { "bz", "application/x-bzip" },
+ { "bz2", "application/x-bzip2" },
+ { "c", "text/x-c" },
+ { "c11amc", "application/vnd.cluetrust.cartomobile-config" },
+ { "c11amz", "application/vnd.cluetrust.cartomobile-config-pkg" },
{ "c4d", "application/vnd.clonk.c4group" },
{ "c4f", "application/vnd.clonk.c4group" },
+ { "c4g", "application/vnd.clonk.c4group" },
{ "c4p", "application/vnd.clonk.c4group" },
{ "c4u", "application/vnd.clonk.c4group" },
- { "c11amc", "application/vnd.cluetrust.cartomobile-config" },
- { "c11amz", "application/vnd.cluetrust.cartomobile-config-pkg" },
- { "csp", "application/vnd.commonspace" },
+ { "cab", "application/vnd.ms-cab-compressed" },
+ { "caf", "audio/x-caf" },
+ { "cap", "application/vnd.tcpdump.pcap" },
+ { "car", "application/vnd.curl.car" },
+ { "cat", "application/vnd.ms-pki.seccat" },
+ { "cb7", "application/x-cbr" },
+ { "cba", "application/x-cbr" },
+ { "cbr", "application/x-cbr" },
+ { "cbt", "application/x-cbr" },
+ { "cbz", "application/x-cbr" },
+ { "cc", "text/x-c" },
+ { "cco", "application/x-cocoa" },
+ { "cct", "application/x-director" },
+ { "ccxml", "application/ccxml+xml" },
{ "cdbcmsg", "application/vnd.contact.cmsg" },
- { "cmc", "application/vnd.cosmocaller" },
- { "clkx", "application/vnd.crick.clicker" },
+ { "cdf", "application/x-netcdf" },
+ { "cdfx", "application/cdfx+xml" },
+ { "cdkey", "application/vnd.mediastation.cdkey" },
+ { "cdmia", "application/cdmi-capability" },
+ { "cdmic", "application/cdmi-container" },
+ { "cdmid", "application/cdmi-domain" },
+ { "cdmio", "application/cdmi-object" },
+ { "cdmiq", "application/cdmi-queue" },
+ { "cdx", "chemical/x-cdx" },
+ { "cdxml", "application/vnd.chemdraw+xml" },
+ { "cdy", "application/vnd.cinderella" },
+ { "cer", "application/pkix-cert" },
+ { "cfs", "application/x-cfs-compressed" },
+ { "cgm", "image/cgm" },
+ { "chat", "application/x-chat" },
+ { "chm", "application/vnd.ms-htmlhelp" },
+ { "chrt", "application/vnd.kde.kchart" },
+ { "cif", "chemical/x-cif" },
+ { "cii", "application/vnd.anser-web-certificate-issue-initiation" },
+ { "cil", "application/vnd.ms-artgalry" },
+ { "cjs", "application/node" },
+ { "cla", "application/vnd.claymore" },
+ { "class", "application/java-vm" },
{ "clkk", "application/vnd.crick.clicker.keyboard" },
{ "clkp", "application/vnd.crick.clicker.palette" },
{ "clkt", "application/vnd.crick.clicker.template" },
{ "clkw", "application/vnd.crick.clicker.wordbank" },
- { "wbs", "application/vnd.criticaltools.wbs+xml" },
- { "pml", "application/vnd.ctc-posml" },
- { "ppd", "application/vnd.cups-ppd" },
- { "car", "application/vnd.curl.car" },
- { "pcurl", "application/vnd.curl.pcurl" },
+ { "clkx", "application/vnd.crick.clicker" },
+ { "clp", "application/x-msclip" },
+ { "cmc", "application/vnd.cosmocaller" },
+ { "cmdf", "chemical/x-cmdf" },
+ { "cml", "chemical/x-cml" },
+ { "cmp", "application/vnd.yellowriver-custom-menu" },
+ { "cmx", "image/x-cmx" },
+ { "cod", "application/vnd.rim.cod" },
+ { "coffee", "text/coffeescript" },
+ { "com", "application/x-msdownload" },
+ { "conf", "text/plain" },
+ { "cpio", "application/x-cpio" },
+ { "cpp", "text/x-c" },
+ { "cpt", "application/mac-compactpro" },
+ { "crd", "application/x-mscardfile" },
+ { "crl", "application/pkix-crl" },
+ { "crt", "application/x-x509-ca-cert" },
+ { "crx", "application/x-chrome-extension" },
+ { "cryptonote", "application/vnd.rig.cryptonote" },
+ { "csh", "application/x-csh" },
+ { "csl", "application/vnd.citationstyles.style+xml" },
+ { "csml", "chemical/x-csml" },
+ { "csp", "application/vnd.commonspace" },
+ { "css", "text/css" },
+ { "cst", "application/x-director" },
+ { "csv", "text/csv" },
+ { "cu", "application/cu-seeme" },
+ { "curl", "text/vnd.curl" },
+ { "cww", "application/prs.cww" },
+ { "cxt", "application/x-director" },
+ { "cxx", "text/x-c" },
+ { "dae", "model/vnd.collada+xml" },
+ { "daf", "application/vnd.mobius.daf" },
{ "dart", "application/vnd.dart" },
- { "rdz", "application/vnd.data-vision.rdz" },
- { "uvf", "application/vnd.dece.data" },
- { "uvvf", "application/vnd.dece.data" },
- { "uvd", "application/vnd.dece.data" },
- { "uvvd", "application/vnd.dece.data" },
- { "uvt", "application/vnd.dece.ttml+xml" },
- { "uvvt", "application/vnd.dece.ttml+xml" },
- { "uvx", "application/vnd.dece.unspecified" },
- { "uvvx", "application/vnd.dece.unspecified" },
- { "uvz", "application/vnd.dece.zip" },
- { "uvvz", "application/vnd.dece.zip" },
- { "fe_launch", "application/vnd.denovo.fcselayout-link" },
+ { "dataless", "application/vnd.fdsn.seed" },
+ { "davmount", "application/davmount+xml" },
+ { "dbf", "application/vnd.dbf" },
+ { "dbk", "application/docbook+xml" },
+ { "dcr", "application/x-director" },
+ { "dcurl", "text/vnd.curl.dcurl" },
+ { "dd2", "application/vnd.oma.dd2+xml" },
+ { "ddd", "application/vnd.fujixerox.ddd" },
+ { "ddf", "application/vnd.syncml.dmddf+xml" },
+ { "dds", "image/vnd.ms-dds" },
+ { "deb", "application/x-debian-package" },
+ { "def", "text/plain" },
+ { "deploy", "application/octet-stream" },
+ { "der", "application/x-x509-ca-cert" },
+ { "dfac", "application/vnd.dreamfactory" },
+ { "dgc", "application/x-dgc-compressed" },
+ { "dic", "text/x-c" },
+ { "dir", "application/x-director" },
+ { "dis", "application/vnd.mobius.dis" },
+ { "disposition-notification", "message/disposition-notification" },
+ { "dist", "application/octet-stream" },
+ { "distz", "application/octet-stream" },
+ { "djv", "image/vnd.djvu" },
+ { "djvu", "image/vnd.djvu" },
+ { "dll", "application/x-msdownload" },
+ { "dmg", "application/x-apple-diskimage" },
+ { "dmp", "application/vnd.tcpdump.pcap" },
+ { "dms", "application/octet-stream" },
{ "dna", "application/vnd.dna" },
- { "mlp", "application/vnd.dolby.mlp" },
+ { "doc", "application/msword" },
+ { "docm", "application/vnd.ms-word.document.macroenabled.12" },
+ { "docx", "application/vnd.openxmlformats-officedocument.wordprocessingml.document" },
+ { "dot", "application/msword" },
+ { "dotm", "application/vnd.ms-word.template.macroenabled.12" },
+ { "dotx", "application/vnd.openxmlformats-officedocument.wordprocessingml.template" },
+ { "dp", "application/vnd.osgi.dp" },
{ "dpg", "application/vnd.dpgraph" },
- { "dfac", "application/vnd.dreamfactory" },
- { "kpxx", "application/vnd.ds-keypoint" },
- { "ait", "application/vnd.dvb.ait" },
- { "svc", "application/vnd.dvb.service" },
- { "geo", "application/vnd.dynageo" },
- { "mag", "application/vnd.ecowin.chart" },
- { "nml", "application/vnd.enliven" },
- { "esf", "application/vnd.epson.esf" },
- { "msf", "application/vnd.epson.msf" },
- { "qam", "application/vnd.epson.quickanime" },
- { "slt", "application/vnd.epson.salt" },
- { "ssf", "application/vnd.epson.ssf" },
+ { "dra", "audio/vnd.dra" },
+ { "drle", "image/dicom-rle" },
+ { "dsc", "text/prs.lines.tag" },
+ { "dssc", "application/dssc+der" },
+ { "dtb", "application/x-dtbook+xml" },
+ { "dtd", "application/xml-dtd" },
+ { "dts", "audio/vnd.dts" },
+ { "dtshd", "audio/vnd.dts.hd" },
+ { "dump", "application/octet-stream" },
+ { "dvb", "video/vnd.dvb.file" },
+ { "dvi", "application/x-dvi" },
+ { "dwd", "application/atsc-dwd+xml" },
+ { "dwf", "model/vnd.dwf" },
+ { "dwg", "image/vnd.dwg" },
+ { "dxf", "image/vnd.dxf" },
+ { "dxp", "application/vnd.spotfire.dxp" },
+ { "dxr", "application/x-director" },
+ { "ear", "application/java-archive" },
+ { "ecelp4800", "audio/vnd.nuera.ecelp4800" },
+ { "ecelp7470", "audio/vnd.nuera.ecelp7470" },
+ { "ecelp9600", "audio/vnd.nuera.ecelp9600" },
+ { "ecma", "application/ecmascript" },
+ { "edm", "application/vnd.novadigm.edm" },
+ { "edx", "application/vnd.novadigm.edx" },
+ { "efif", "application/vnd.picsel" },
+ { "ei6", "application/vnd.pg.osasli" },
+ { "elc", "application/octet-stream" },
+ { "emf", "image/emf" },
+ { "eml", "message/rfc822" },
+ { "emma", "application/emma+xml" },
+ { "emotionml", "application/emotionml+xml" },
+ { "emz", "application/x-msmetafile" },
+ { "eol", "audio/vnd.digital-winds" },
+ { "eot", "application/vnd.ms-fontobject" },
+ { "eps", "application/postscript" },
+ { "epub", "application/epub+zip" },
+ { "es", "application/ecmascript" },
{ "es3", "application/vnd.eszigno3+xml" },
+ { "esa", "application/vnd.osgi.subsystem" },
+ { "esf", "application/vnd.epson.esf" },
{ "et3", "application/vnd.eszigno3+xml" },
+ { "etx", "text/x-setext" },
+ { "eva", "application/x-eva" },
+ { "evy", "application/x-envoy" },
+ { "exe", "application/x-msdos-program" },
+ { "exi", "application/exi" },
+ { "exr", "image/aces" },
+ { "ext", "application/vnd.novadigm.ext" },
+ { "ez", "application/andrew-inset" },
{ "ez2", "application/vnd.ezpix-album" },
{ "ez3", "application/vnd.ezpix-package" },
+ { "f", "text/x-fortran" },
+ { "f4v", "video/x-f4v" },
+ { "f77", "text/x-fortran" },
+ { "f90", "text/x-fortran" },
+ { "fbs", "image/vnd.fastbidsheet" },
+ { "fcdt", "application/vnd.adobe.formscentral.fcdt" },
+ { "fcs", "application/vnd.isac.fcs" },
{ "fdf", "application/vnd.fdf" },
- { "mseed", "application/vnd.fdsn.mseed" },
- { "seed", "application/vnd.fdsn.seed" },
- { "dataless", "application/vnd.fdsn.seed" },
- { "gph", "application/vnd.flographit" },
- { "ftc", "application/vnd.fluxtime.clip" },
+ { "fdt", "application/fdt+xml" },
+ { "fe_launch", "application/vnd.denovo.fcselayout-link" },
+ { "fg5", "application/vnd.fujitsu.oasysgp" },
+ { "fgd", "application/x-director" },
+ { "fh", "image/x-freehand" },
+ { "fh4", "image/x-freehand" },
+ { "fh5", "image/x-freehand" },
+ { "fh7", "image/x-freehand" },
+ { "fhc", "image/x-freehand" },
+ { "fig", "application/x-xfig" },
+ { "fits", "image/fits" },
+ { "flac", "audio/x-flac" },
+ { "fli", "video/x-fli" },
+ { "flo", "application/vnd.micrografx.flo" },
+ { "flv", "video/x-flv" },
+ { "flw", "application/vnd.kde.kivio" },
+ { "flx", "text/vnd.fmi.flexstor" },
+ { "fly", "text/vnd.fly" },
{ "fm", "application/vnd.framemaker" },
- { "frame", "application/vnd.framemaker" },
- { "maker", "application/vnd.framemaker" },
- { "book", "application/vnd.framemaker" },
{ "fnc", "application/vnd.frogans.fnc" },
- { "ltf", "application/vnd.frogans.ltf" },
+ { "fo", "application/vnd.software602.filler.form+xml" },
+ { "for", "text/x-fortran" },
+ { "fpx", "image/vnd.fpx" },
+ { "frame", "application/vnd.framemaker" },
{ "fsc", "application/vnd.fsc.weblaunch" },
- { "oas", "application/vnd.fujitsu.oasys" },
- { "oa2", "application/vnd.fujitsu.oasys2" },
- { "oa3", "application/vnd.fujitsu.oasys3" },
- { "fg5", "application/vnd.fujitsu.oasysgp" },
- { "bh2", "application/vnd.fujitsu.oasysprs" },
- { "ddd", "application/vnd.fujixerox.ddd" },
- { "xdw", "application/vnd.fujixerox.docuworks" },
- { "xbd", "application/vnd.fujixerox.docuworks.binder" },
+ { "fst", "image/vnd.fst" },
+ { "ftc", "application/vnd.fluxtime.clip" },
+ { "fti", "application/vnd.anser-web-funds-transfer-initiation" },
+ { "fvt", "video/vnd.fvt" },
+ { "fxp", "application/vnd.adobe.fxp" },
+ { "fxpl", "application/vnd.adobe.fxp" },
{ "fzs", "application/vnd.fuzzysheet" },
- { "txd", "application/vnd.genomatix.tuxedo" },
- { "ggb", "application/vnd.geogebra.file" },
- { "ggt", "application/vnd.geogebra.tool" },
- { "gex", "application/vnd.geometry-explorer" },
- { "gre", "application/vnd.geometry-explorer" },
- { "gxt", "application/vnd.geonext" },
{ "g2w", "application/vnd.geoplan" },
+ { "g3", "image/g3fax" },
{ "g3w", "application/vnd.geospace" },
- { "gmx", "application/vnd.gmx" },
- { "kml", "application/vnd.google-earth.kml+xml" },
- { "kmz", "application/vnd.google-earth.kmz" },
- { "gqf", "application/vnd.grafeq" },
- { "gqs", "application/vnd.grafeq" },
{ "gac", "application/vnd.groove-account" },
+ { "gam", "application/x-tads" },
+ { "gbr", "application/rpki-ghostbusters" },
+ { "gca", "application/x-gca-compressed" },
+ { "gdl", "model/vnd.gdl" },
+ { "gdoc", "application/vnd.google-apps.document" },
+ { "geo", "application/vnd.dynageo" },
+ { "geojson", "application/geo+json" },
+ { "gex", "application/vnd.geometry-explorer" },
+ { "ggb", "application/vnd.geogebra.file" },
+ { "ggt", "application/vnd.geogebra.tool" },
{ "ghf", "application/vnd.groove-help" },
+ { "gif", "image/gif" },
{ "gim", "application/vnd.groove-identity-message" },
+ { "glb", "model/gltf-binary" },
+ { "gltf", "model/gltf+json" },
+ { "gml", "application/gml+xml" },
+ { "gmx", "application/vnd.gmx" },
+ { "gnumeric", "application/x-gnumeric" },
+ { "gph", "application/vnd.flographit" },
+ { "gpx", "application/gpx+xml" },
+ { "gqf", "application/vnd.grafeq" },
+ { "gqs", "application/vnd.grafeq" },
+ { "gram", "application/srgs" },
+ { "gramps", "application/x-gramps-xml" },
+ { "gre", "application/vnd.geometry-explorer" },
{ "grv", "application/vnd.groove-injector" },
+ { "grxml", "application/srgs+xml" },
+ { "gsf", "application/x-font-ghostscript" },
+ { "gsheet", "application/vnd.google-apps.spreadsheet" },
+ { "gslides", "application/vnd.google-apps.presentation" },
+ { "gtar", "application/x-gtar" },
{ "gtm", "application/vnd.groove-tool-message" },
- { "tpl", "application/vnd.groove-tool-template" },
- { "vcg", "application/vnd.groove-vcard" },
+ { "gtw", "model/vnd.gtw" },
+ { "gv", "text/vnd.graphviz" },
+ { "gxf", "application/gxf" },
+ { "gxt", "application/vnd.geonext" },
+ { "gz", "application/gzip" },
+ { "h", "text/x-c" },
+ { "h261", "video/h261" },
+ { "h263", "video/h263" },
+ { "h264", "video/h264" },
{ "hal", "application/vnd.hal+xml" },
- { "zmm", "application/vnd.handheld-entertainment+xml" },
{ "hbci", "application/vnd.hbci" },
- { "les", "application/vnd.hhe.lesson-player" },
+ { "hbs", "text/x-handlebars-template" },
+ { "hdd", "application/x-virtualbox-hdd" },
+ { "hdf", "application/x-hdf" },
+ { "heic", "image/heic" },
+ { "heics", "image/heic-sequence" },
+ { "heif", "image/heif" },
+ { "heifs", "image/heif-sequence" },
+ { "hej2", "image/hej2k" },
+ { "held", "application/atsc-held+xml" },
+ { "hh", "text/x-c" },
+ { "hjson", "application/hjson" },
+ { "hlp", "application/winhlp" },
{ "hpgl", "application/vnd.hp-hpgl" },
{ "hpid", "application/vnd.hp-hpid" },
{ "hps", "application/vnd.hp-hps" },
- { "jlt", "application/vnd.hp-jlyt" },
- { "pcl", "application/vnd.hp-pcl" },
- { "pclxl", "application/vnd.hp-pclxl" },
- { "sfd-hdstx", "application/vnd.hydrostatix.sof-data" },
- { "mpy", "application/vnd.ibm.minipay" },
- { "afp", "application/vnd.ibm.modcap" },
- { "listafp", "application/vnd.ibm.modcap" },
- { "list3820", "application/vnd.ibm.modcap" },
- { "irm", "application/vnd.ibm.rights-management" },
- { "sc", "application/vnd.ibm.secure-container" },
+ { "hqx", "application/mac-binhex40" },
+ { "hsj2", "image/hsj2" },
+ { "htc", "text/x-component" },
+ { "htke", "application/vnd.kenameaapp" },
+ { "htm", "text/html" },
+ { "html", "text/html" },
+ { "hvd", "application/vnd.yamaha.hv-dic" },
+ { "hvp", "application/vnd.yamaha.hv-voice" },
+ { "hvs", "application/vnd.yamaha.hv-script" },
+ { "i2g", "application/vnd.intergeo" },
{ "icc", "application/vnd.iccprofile" },
+ { "ice", "x-conference/x-cooltalk" },
{ "icm", "application/vnd.iccprofile" },
+ { "ico", "image/vnd.microsoft.icon" },
+ { "ics", "text/calendar" },
+ { "ief", "image/ief" },
+ { "ifb", "text/calendar" },
+ { "ifm", "application/vnd.shana.informed.formdata" },
+ { "iges", "model/iges" },
{ "igl", "application/vnd.igloader" },
- { "ivp", "application/vnd.immervision-ivp" },
- { "ivu", "application/vnd.immervision-ivu" },
{ "igm", "application/vnd.insors.igm" },
- { "xpw", "application/vnd.intercon.formnet" },
- { "xpx", "application/vnd.intercon.formnet" },
- { "i2g", "application/vnd.intergeo" },
- { "qbo", "application/vnd.intu.qbo" },
- { "qfx", "application/vnd.intu.qfx" },
- { "rcprofile", "application/vnd.ipunplugged.rcprofile" },
+ { "igs", "model/iges" },
+ { "igx", "application/vnd.micrografx.igx" },
+ { "iif", "application/vnd.shana.informed.interchange" },
+ { "img", "application/octet-stream" },
+ { "imp", "application/vnd.accpac.simply.imp" },
+ { "ims", "application/vnd.ms-ims" },
+ { "in", "text/plain" },
+ { "ini", "text/plain" },
+ { "ink", "application/inkml+xml" },
+ { "inkml", "application/inkml+xml" },
+ { "install", "application/x-install-instructions" },
+ { "iota", "application/vnd.astraea-software.iota" },
+ { "ipfix", "application/ipfix" },
+ { "ipk", "application/vnd.shana.informed.package" },
+ { "irm", "application/vnd.ibm.rights-management" },
{ "irp", "application/vnd.irepository.package+xml" },
- { "xpr", "application/vnd.is-xpr" },
- { "fcs", "application/vnd.isac.fcs" },
+ { "iso", "application/x-iso9660-image" },
+ { "itp", "application/vnd.shana.informed.formtemplate" },
+ { "its", "application/its+xml" },
+ { "ivp", "application/vnd.immervision-ivp" },
+ { "ivu", "application/vnd.immervision-ivu" },
+ { "jad", "text/vnd.sun.j2me.app-descriptor" },
+ { "jade", "text/jade" },
{ "jam", "application/vnd.jam" },
- { "rms", "application/vnd.jcp.javame.midlet-rms" },
+ { "jar", "application/java-archive" },
+ { "jardiff", "application/x-java-archive-diff" },
+ { "java", "text/x-java-source" },
+ { "jhc", "image/jphc" },
{ "jisp", "application/vnd.jisp" },
+ { "jls", "image/jls" },
+ { "jlt", "application/vnd.hp-jlyt" },
+ { "jng", "image/x-jng" },
+ { "jnlp", "application/x-java-jnlp-file" },
{ "joda", "application/vnd.joost.joda-archive" },
- { "ktz", "application/vnd.kahootz" },
- { "ktr", "application/vnd.kahootz" },
+ { "jp2", "image/jp2" },
+ { "jpe", "image/jpeg" },
+ { "jpeg", "image/jpeg" },
+ { "jpf", "image/jpx" },
+ { "jpg", "image/jpeg" },
+ { "jpg2", "image/jp2" },
+ { "jpgm", "video/jpm" },
+ { "jpgv", "video/jpeg" },
+ { "jph", "image/jph" },
+ { "jpm", "image/jpm" },
+ { "jpx", "image/jpx" },
+ { "js", "application/javascript" },
+ { "jsm", "application/javascript" },
+ { "json", "application/json" },
+ { "json5", "application/json5" },
+ { "jsonld", "application/ld+json" },
+ { "jsonml", "application/jsonml+json" },
+ { "jsx", "text/jsx" },
+ { "jxr", "image/jxr" },
+ { "jxra", "image/jxra" },
+ { "jxrs", "image/jxrs" },
+ { "jxs", "image/jxs" },
+ { "jxsc", "image/jxsc" },
+ { "jxsi", "image/jxsi" },
+ { "jxss", "image/jxss" },
+ { "kar", "audio/midi" },
{ "karbon", "application/vnd.kde.karbon" },
- { "chrt", "application/vnd.kde.kchart" },
+ { "kdbx", "application/x-keepass2" },
+ { "key", "application/vnd.apple.keynote" },
{ "kfo", "application/vnd.kde.kformula" },
- { "flw", "application/vnd.kde.kivio" },
+ { "kia", "application/vnd.kidspiration" },
+ { "kml", "application/vnd.google-earth.kml+xml" },
+ { "kmz", "application/vnd.google-earth.kmz" },
+ { "kne", "application/vnd.kinar" },
+ { "knp", "application/vnd.kinar" },
{ "kon", "application/vnd.kde.kontour" },
{ "kpr", "application/vnd.kde.kpresenter" },
{ "kpt", "application/vnd.kde.kpresenter" },
+ { "kpxx", "application/vnd.ds-keypoint" },
{ "ksp", "application/vnd.kde.kspread" },
+ { "ktr", "application/vnd.kahootz" },
+ { "ktx", "image/ktx" },
+ { "ktx2", "image/ktx2" },
+ { "ktz", "application/vnd.kahootz" },
{ "kwd", "application/vnd.kde.kword" },
{ "kwt", "application/vnd.kde.kword" },
- { "htke", "application/vnd.kenameaapp" },
- { "kia", "application/vnd.kidspiration" },
- { "kne", "application/vnd.kinar" },
- { "knp", "application/vnd.kinar" },
- { "skp", "application/vnd.koan" },
- { "skd", "application/vnd.koan" },
- { "skt", "application/vnd.koan" },
- { "skm", "application/vnd.koan" },
- { "sse", "application/vnd.kodak-descriptor" },
{ "lasxml", "application/vnd.las.las+xml" },
+ { "latex", "application/x-latex" },
{ "lbd", "application/vnd.llamagraphics.life-balance.desktop" },
{ "lbe", "application/vnd.llamagraphics.life-balance.exchange+xml" },
- { "123", "application/vnd.lotus-1-2-3" },
- { "apr", "application/vnd.lotus-approach" },
- { "pre", "application/vnd.lotus-freelance" },
- { "nsf", "application/vnd.lotus-notes" },
- { "org", "application/vnd.lotus-organizer" },
- { "scm", "application/vnd.lotus-screencam" },
+ { "les", "application/vnd.hhe.lesson-player" },
+ { "less", "text/less" },
+ { "lgr", "application/lgr+xml" },
+ { "lha", "application/x-lzh-compressed" },
+ { "link66", "application/vnd.route66.link66+xml" },
+ { "list", "text/plain" },
+ { "list3820", "application/vnd.ibm.modcap" },
+ { "listafp", "application/vnd.ibm.modcap" },
+ { "litcoffee", "text/coffeescript" },
+ { "lnk", "application/x-ms-shortcut" },
+ { "log", "text/plain" },
+ { "lostxml", "application/lost+xml" },
+ { "lrf", "application/octet-stream" },
+ { "lrm", "application/vnd.ms-lrm" },
+ { "ltf", "application/vnd.frogans.ltf" },
+ { "lua", "text/x-lua" },
+ { "luac", "application/x-lua-bytecode" },
+ { "lvp", "audio/vnd.lucent.voice" },
{ "lwp", "application/vnd.lotus-wordpro" },
- { "portpkg", "application/vnd.macports.portpkg" },
- { "mcd", "application/vnd.mcd" },
+ { "lzh", "application/x-lzh-compressed" },
+ { "m13", "application/x-msmediaview" },
+ { "m14", "application/x-msmediaview" },
+ { "m1v", "video/mpeg" },
+ { "m21", "application/mp21" },
+ { "m2a", "audio/mpeg" },
+ { "m2v", "video/mpeg" },
+ { "m3a", "audio/mpeg" },
+ { "m3u", "audio/x-mpegurl" },
+ { "m3u8", "application/vnd.apple.mpegurl" },
+ { "m4a", "audio/mp4" },
+ { "m4p", "application/mp4" },
+ { "m4u", "video/vnd.mpegurl" },
+ { "m4v", "video/x-m4v" },
+ { "ma", "application/mathematica" },
+ { "mads", "application/mads+xml" },
+ { "maei", "application/mmt-aei+xml" },
+ { "mag", "application/vnd.ecowin.chart" },
+ { "maker", "application/vnd.framemaker" },
+ { "man", "text/troff" },
+ { "manifest", "text/cache-manifest" },
+ { "map", "application/json" },
+ { "mar", "application/octet-stream" },
+ { "markdown", "text/markdown" },
+ { "mathml", "application/mathml+xml" },
+ { "mb", "application/mathematica" },
+ { "mbk", "application/vnd.mobius.mbk" },
+ { "mbox", "application/mbox" },
{ "mc1", "application/vnd.medcalcdata" },
- { "cdkey", "application/vnd.mediastation.cdkey" },
- { "mwf", "application/vnd.mfer" },
+ { "mcd", "application/vnd.mcd" },
+ { "mcurl", "text/vnd.curl.mcurl" },
+ { "md", "text/markdown" },
+ { "mdb", "application/x-msaccess" },
+ { "mdi", "image/vnd.ms-modi" },
+ { "mdx", "text/mdx" },
+ { "me", "text/troff" },
+ { "mesh", "model/mesh" },
+ { "meta4", "application/metalink4+xml" },
+ { "metalink", "application/metalink+xml" },
+ { "mets", "application/mets+xml" },
{ "mfm", "application/vnd.mfmp" },
- { "flo", "application/vnd.micrografx.flo" },
- { "igx", "application/vnd.micrografx.igx" },
+ { "mft", "application/rpki-manifest" },
+ { "mgp", "application/vnd.osgeo.mapguide.package" },
+ { "mgz", "application/vnd.proteus.magazine" },
+ { "mid", "audio/midi" },
+ { "midi", "audio/midi" },
+ { "mie", "application/x-mie" },
{ "mif", "application/vnd.mif" },
- { "daf", "application/vnd.mobius.daf" },
- { "dis", "application/vnd.mobius.dis" },
- { "mbk", "application/vnd.mobius.mbk" },
- { "mqy", "application/vnd.mobius.mqy" },
- { "msl", "application/vnd.mobius.msl" },
- { "plc", "application/vnd.mobius.plc" },
- { "txf", "application/vnd.mobius.txf" },
- { "mpn", "application/vnd.mophun.application" },
+ { "mime", "message/rfc822" },
+ { "mj2", "video/mj2" },
+ { "mjp2", "video/mj2" },
+ { "mjs", "application/javascript" },
+ { "mk3d", "video/x-matroska" },
+ { "mka", "audio/x-matroska" },
+ { "mkd", "text/x-markdown" },
+ { "mks", "video/x-matroska" },
+ { "mkv", "video/x-matroska" },
+ { "mlp", "application/vnd.dolby.mlp" },
+ { "mmd", "application/vnd.chipnuts.karaoke-mmd" },
+ { "mmf", "application/vnd.smaf" },
+ { "mml", "text/mathml" },
+ { "mmr", "image/vnd.fujixerox.edmics-mmr" },
+ { "mng", "video/x-mng" },
+ { "mny", "application/x-msmoney" },
+ { "mobi", "application/x-mobipocket-ebook" },
+ { "mods", "application/mods+xml" },
+ { "mov", "video/quicktime" },
+ { "movie", "video/x-sgi-movie" },
+ { "mp2", "audio/mpeg" },
+ { "mp21", "application/mp21" },
+ { "mp2a", "audio/mpeg" },
+ { "mp3", "audio/mpeg" },
+ { "mp4", "video/mp4" },
+ { "mp4a", "audio/mp4" },
+ { "mp4s", "application/mp4" },
+ { "mp4v", "video/mp4" },
{ "mpc", "application/vnd.mophun.certificate" },
- { "xul", "application/vnd.mozilla.xul+xml" },
- { "cil", "application/vnd.ms-artgalry" },
- { "cab", "application/vnd.ms-cab-compressed" },
- { "xls", "application/vnd.ms-excel" },
- { "xlm", "application/vnd.ms-excel" },
- { "xla", "application/vnd.ms-excel" },
- { "xlc", "application/vnd.ms-excel" },
- { "xlt", "application/vnd.ms-excel" },
- { "xlw", "application/vnd.ms-excel" },
- { "xlam", "application/vnd.ms-excel.addin.macroenabled.12" },
- { "xlsb", "application/vnd.ms-excel.sheet.binary.macroenabled.12" },
- { "xlsm", "application/vnd.ms-excel.sheet.macroenabled.12" },
- { "xltm", "application/vnd.ms-excel.template.macroenabled.12" },
- { "eot", "application/vnd.ms-fontobject" },
- { "chm", "application/vnd.ms-htmlhelp" },
- { "ims", "application/vnd.ms-ims" },
- { "lrm", "application/vnd.ms-lrm" },
- { "thmx", "application/vnd.ms-officetheme" },
- { "cat", "application/vnd.ms-pki.seccat" },
- { "stl", "application/vnd.ms-pki.stl" },
- { "ppt", "application/vnd.ms-powerpoint" },
- { "pps", "application/vnd.ms-powerpoint" },
- { "pot", "application/vnd.ms-powerpoint" },
- { "ppam", "application/vnd.ms-powerpoint.addin.macroenabled.12" },
- { "pptm", "application/vnd.ms-powerpoint.presentation.macroenabled.12" },
- { "sldm", "application/vnd.ms-powerpoint.slide.macroenabled.12" },
- { "ppsm", "application/vnd.ms-powerpoint.slideshow.macroenabled.12" },
- { "potm", "application/vnd.ms-powerpoint.template.macroenabled.12" },
+ { "mpd", "application/dash+xml" },
+ { "mpe", "video/mpeg" },
+ { "mpeg", "video/mpeg" },
+ { "mpg", "video/mpeg" },
+ { "mpg4", "video/mp4" },
+ { "mpga", "audio/mpeg" },
+ { "mpkg", "application/vnd.apple.installer+xml" },
+ { "mpm", "application/vnd.blueice.multipass" },
+ { "mpn", "application/vnd.mophun.application" },
{ "mpp", "application/vnd.ms-project" },
{ "mpt", "application/vnd.ms-project" },
- { "docm", "application/vnd.ms-word.document.macroenabled.12" },
- { "dotm", "application/vnd.ms-word.template.macroenabled.12" },
- { "wps", "application/vnd.ms-works" },
- { "wks", "application/vnd.ms-works" },
- { "wcm", "application/vnd.ms-works" },
- { "wdb", "application/vnd.ms-works" },
- { "wpl", "application/vnd.ms-wpl" },
- { "xps", "application/vnd.ms-xpsdocument" },
+ { "mpy", "application/vnd.ibm.minipay" },
+ { "mqy", "application/vnd.mobius.mqy" },
+ { "mrc", "application/marc" },
+ { "mrcx", "application/marcxml+xml" },
+ { "ms", "text/troff" },
+ { "mscml", "application/mediaservercontrol+xml" },
+ { "mseed", "application/vnd.fdsn.mseed" },
{ "mseq", "application/vnd.mseq" },
- { "mus", "application/vnd.musician" },
+ { "msf", "application/vnd.epson.msf" },
+ { "msg", "application/vnd.ms-outlook" },
+ { "msh", "model/mesh" },
+ { "msi", "application/x-msdownload" },
+ { "msl", "application/vnd.mobius.msl" },
+ { "msm", "application/octet-stream" },
+ { "msp", "application/octet-stream" },
{ "msty", "application/vnd.muvee.style" },
- { "taglet", "application/vnd.mynfc" },
- { "nlu", "application/vnd.neurolanguage.nlu" },
- { "ntf", "application/vnd.nitf" },
+ { "mtl", "model/mtl" },
+ { "mts", "model/vnd.mts" },
+ { "mus", "application/vnd.musician" },
+ { "musd", "application/mmt-usd+xml" },
+ { "musicxml", "application/vnd.recordare.musicxml+xml" },
+ { "mvb", "application/x-msmediaview" },
+ { "mwf", "application/vnd.mfer" },
+ { "mxf", "application/mxf" },
+ { "mxl", "application/vnd.recordare.musicxml" },
+ { "mxmf", "audio/mobile-xmf" },
+ { "mxml", "application/xv+xml" },
+ { "mxs", "application/vnd.triscape.mxs" },
+ { "mxu", "video/vnd.mpegurl" },
+ { "n-gage", "application/vnd.nokia.n-gage.symbian.install" },
+ { "n3", "text/n3" },
+ { "nb", "application/mathematica" },
+ { "nbp", "application/vnd.wolfram.player" },
+ { "nc", "application/x-netcdf" },
+ { "ncx", "application/x-dtbncx+xml" },
+ { "nfo", "text/x-nfo" },
+ { "ngdat", "application/vnd.nokia.n-gage.data" },
{ "nitf", "application/vnd.nitf" },
+ { "nlu", "application/vnd.neurolanguage.nlu" },
+ { "nml", "application/vnd.enliven" },
{ "nnd", "application/vnd.noblenet-directory" },
{ "nns", "application/vnd.noblenet-sealer" },
{ "nnw", "application/vnd.noblenet-web" },
- { "ngdat", "application/vnd.nokia.n-gage.data" },
- { "n-gage", "application/vnd.nokia.n-gage.symbian.install" },
- { "rpst", "application/vnd.nokia.radio-preset" },
- { "rpss", "application/vnd.nokia.radio-presets" },
- { "edm", "application/vnd.novadigm.edm" },
- { "edx", "application/vnd.novadigm.edx" },
- { "ext", "application/vnd.novadigm.ext" },
- { "odc", "application/vnd.oasis.opendocument.chart" },
- { "otc", "application/vnd.oasis.opendocument.chart-template" },
+ { "npx", "image/vnd.net-fpx" },
+ { "nq", "application/n-quads" },
+ { "nsc", "application/x-conference" },
+ { "nsf", "application/vnd.lotus-notes" },
+ { "nt", "application/n-triples" },
+ { "ntf", "application/vnd.nitf" },
+ { "numbers", "application/vnd.apple.numbers" },
+ { "nzb", "application/x-nzb" },
+ { "oa2", "application/vnd.fujitsu.oasys2" },
+ { "oa3", "application/vnd.fujitsu.oasys3" },
+ { "oas", "application/vnd.fujitsu.oasys" },
+ { "obd", "application/x-msbinder" },
+ { "obgx", "application/vnd.openblox.game+xml" },
+ { "obj", "model/obj" },
+ { "oda", "application/oda" },
{ "odb", "application/vnd.oasis.opendocument.database" },
+ { "odc", "application/vnd.oasis.opendocument.chart" },
{ "odf", "application/vnd.oasis.opendocument.formula" },
{ "odft", "application/vnd.oasis.opendocument.formula-template" },
{ "odg", "application/vnd.oasis.opendocument.graphics" },
- { "otg", "application/vnd.oasis.opendocument.graphics-template" },
{ "odi", "application/vnd.oasis.opendocument.image" },
- { "oti", "application/vnd.oasis.opendocument.image-template" },
+ { "odm", "application/vnd.oasis.opendocument.text-master" },
{ "odp", "application/vnd.oasis.opendocument.presentation" },
- { "otp", "application/vnd.oasis.opendocument.presentation-template" },
{ "ods", "application/vnd.oasis.opendocument.spreadsheet" },
- { "ots", "application/vnd.oasis.opendocument.spreadsheet-template" },
{ "odt", "application/vnd.oasis.opendocument.text" },
- { "odm", "application/vnd.oasis.opendocument.text-master" },
- { "ott", "application/vnd.oasis.opendocument.text-template" },
+ { "oga", "audio/ogg" },
+ { "ogex", "model/vnd.opengex" },
+ { "ogg", "audio/ogg" },
+ { "ogv", "video/ogg" },
+ { "ogx", "application/ogg" },
+ { "omdoc", "application/omdoc+xml" },
+ { "onepkg", "application/onenote" },
+ { "onetmp", "application/onenote" },
+ { "onetoc", "application/onenote" },
+ { "onetoc2", "application/onenote" },
+ { "opf", "application/oebps-package+xml" },
+ { "opml", "text/x-opml" },
+ { "oprc", "application/vnd.palm" },
+ { "org", "application/vnd.lotus-organizer" },
+ { "osf", "application/vnd.yamaha.openscoreformat" },
+ { "osfpvg", "application/vnd.yamaha.openscoreformat.osfpvg+xml" },
+ { "osm", "application/vnd.openstreetmap.data+xml" },
+ { "otc", "application/vnd.oasis.opendocument.chart-template" },
+ { "otf", "font/otf" },
+ { "otg", "application/vnd.oasis.opendocument.graphics-template" },
{ "oth", "application/vnd.oasis.opendocument.text-web" },
- { "xo", "application/vnd.olpc-sugar" },
- { "dd2", "application/vnd.oma.dd2+xml" },
+ { "oti", "application/vnd.oasis.opendocument.image-template" },
+ { "otp", "application/vnd.oasis.opendocument.presentation-template" },
+ { "ots", "application/vnd.oasis.opendocument.spreadsheet-template" },
+ { "ott", "application/vnd.oasis.opendocument.text-template" },
+ { "ova", "application/x-virtualbox-ova" },
+ { "ovf", "application/x-virtualbox-ovf" },
+ { "owl", "application/rdf+xml" },
+ { "oxps", "application/oxps" },
{ "oxt", "application/vnd.openofficeorg.extension" },
- { "pptx", "application/vnd.openxmlformats-officedocument.presentationml.presentation" },
- { "sldx", "application/vnd.openxmlformats-officedocument.presentationml.slide" },
- { "ppsx", "application/vnd.openxmlformats-officedocument.presentationml.slideshow" },
- { "potx", "application/vnd.openxmlformats-officedocument.presentationml.template" },
- { "xlsx", "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet" },
- { "xltx", "application/vnd.openxmlformats-officedocument.spreadsheetml.template" },
- { "docx", "application/vnd.openxmlformats-officedocument.wordprocessingml.document" },
- { "dotx", "application/vnd.openxmlformats-officedocument.wordprocessingml.template" },
- { "mgp", "application/vnd.osgeo.mapguide.package" },
- { "dp", "application/vnd.osgi.dp" },
- { "esa", "application/vnd.osgi.subsystem" },
- { "pdb", "application/vnd.palm" },
- { "pqa", "application/vnd.palm" },
- { "oprc", "application/vnd.palm" },
+ { "p", "text/x-pascal" },
+ { "p10", "application/pkcs10" },
+ { "p12", "application/x-pkcs12" },
+ { "p7b", "application/x-pkcs7-certificates" },
+ { "p7c", "application/pkcs7-mime" },
+ { "p7m", "application/pkcs7-mime" },
+ { "p7r", "application/x-pkcs7-certreqresp" },
+ { "p7s", "application/pkcs7-signature" },
+ { "p8", "application/pkcs8" },
+ { "pac", "application/x-ns-proxy-autoconfig" },
+ { "pages", "application/vnd.apple.pages" },
+ { "pas", "text/x-pascal" },
{ "paw", "application/vnd.pawaafile" },
- { "str", "application/vnd.pg.format" },
- { "ei6", "application/vnd.pg.osasli" },
- { "efif", "application/vnd.picsel" },
- { "wg", "application/vnd.pmi.widget" },
- { "plf", "application/vnd.pocketlearn" },
{ "pbd", "application/vnd.powerbuilder6" },
- { "box", "application/vnd.previewsystems.box" },
- { "mgz", "application/vnd.proteus.magazine" },
- { "qps", "application/vnd.publishare-delta-tree" },
+ { "pbm", "image/x-portable-bitmap" },
+ { "pcap", "application/vnd.tcpdump.pcap" },
+ { "pcf", "application/x-font-pcf" },
+ { "pcl", "application/vnd.hp-pcl" },
+ { "pclxl", "application/vnd.hp-pclxl" },
+ { "pct", "image/x-pict" },
+ { "pcurl", "application/vnd.curl.pcurl" },
+ { "pcx", "image/vnd.zbrush.pcx" },
+ { "pdb", "application/vnd.palm" },
+ { "pde", "text/x-processing" },
+ { "pdf", "application/pdf" },
+ { "pem", "application/x-x509-ca-cert" },
+ { "pfa", "application/x-font-type1" },
+ { "pfb", "application/x-font-type1" },
+ { "pfm", "application/x-font-type1" },
+ { "pfr", "application/font-tdpfr" },
+ { "pfx", "application/x-pkcs12" },
+ { "pgm", "image/x-portable-graymap" },
+ { "pgn", "application/x-chess-pgn" },
+ { "pgp", "application/pgp-encrypted" },
+ { "php", "application/x-httpd-php" },
+ { "pic", "image/x-pict" },
+ { "pkg", "application/octet-stream" },
+ { "pki", "application/pkixcmp" },
+ { "pkipath", "application/pkix-pkipath" },
+ { "pkpass", "application/vnd.apple.pkpass" },
+ { "pl", "application/x-perl" },
+ { "plb", "application/vnd.3gpp.pic-bw-large" },
+ { "plc", "application/vnd.mobius.plc" },
+ { "plf", "application/vnd.pocketlearn" },
+ { "pls", "application/pls+xml" },
+ { "pm", "application/x-perl" },
+ { "pml", "application/vnd.ctc-posml" },
+ { "png", "image/png" },
+ { "pnm", "image/x-portable-anymap" },
+ { "portpkg", "application/vnd.macports.portpkg" },
+ { "pot", "application/vnd.ms-powerpoint" },
+ { "potm", "application/vnd.ms-powerpoint.template.macroenabled.12" },
+ { "potx", "application/vnd.openxmlformats-officedocument.presentationml.template" },
+ { "ppam", "application/vnd.ms-powerpoint.addin.macroenabled.12" },
+ { "ppd", "application/vnd.cups-ppd" },
+ { "ppm", "image/x-portable-pixmap" },
+ { "pps", "application/vnd.ms-powerpoint" },
+ { "ppsm", "application/vnd.ms-powerpoint.slideshow.macroenabled.12" },
+ { "ppsx", "application/vnd.openxmlformats-officedocument.presentationml.slideshow" },
+ { "ppt", "application/vnd.ms-powerpoint" },
+ { "pptm", "application/vnd.ms-powerpoint.presentation.macroenabled.12" },
+ { "pptx", "application/vnd.openxmlformats-officedocument.presentationml.presentation" },
+ { "pqa", "application/vnd.palm" },
+ { "prc", "application/x-mobipocket-ebook" },
+ { "pre", "application/vnd.lotus-freelance" },
+ { "prf", "application/pics-rules" },
+ { "provx", "application/provenance+xml" },
+ { "ps", "application/postscript" },
+ { "psb", "application/vnd.3gpp.pic-bw-small" },
+ { "psd", "image/vnd.adobe.photoshop" },
+ { "psf", "application/x-font-linux-psf" },
+ { "pskcxml", "application/pskc+xml" },
+ { "pti", "image/prs.pti" },
{ "ptid", "application/vnd.pvi.ptid1" },
- { "qxd", "application/vnd.quark.quarkxpress" },
- { "qxt", "application/vnd.quark.quarkxpress" },
+ { "pub", "application/x-mspublisher" },
+ { "pvb", "application/vnd.3gpp.pic-bw-var" },
+ { "pwn", "application/vnd.3m.post-it-notes" },
+ { "pya", "audio/vnd.ms-playready.media.pya" },
+ { "pyv", "video/vnd.ms-playready.media.pyv" },
+ { "qam", "application/vnd.epson.quickanime" },
+ { "qbo", "application/vnd.intu.qbo" },
+ { "qfx", "application/vnd.intu.qfx" },
+ { "qps", "application/vnd.publishare-delta-tree" },
+ { "qt", "video/quicktime" },
{ "qwd", "application/vnd.quark.quarkxpress" },
{ "qwt", "application/vnd.quark.quarkxpress" },
- { "qxl", "application/vnd.quark.quarkxpress" },
{ "qxb", "application/vnd.quark.quarkxpress" },
- { "bed", "application/vnd.realvnc.bed" },
- { "mxl", "application/vnd.recordare.musicxml" },
- { "musicxml", "application/vnd.recordare.musicxml+xml" },
- { "cryptonote", "application/vnd.rig.cryptonote" },
- { "cod", "application/vnd.rim.cod" },
+ { "qxd", "application/vnd.quark.quarkxpress" },
+ { "qxl", "application/vnd.quark.quarkxpress" },
+ { "qxt", "application/vnd.quark.quarkxpress" },
+ { "ra", "audio/x-pn-realaudio" },
+ { "ram", "audio/x-pn-realaudio" },
+ { "raml", "application/raml+yaml" },
+ { "rapd", "application/route-apd+xml" },
+ { "rar", "application/vnd.rar" },
+ { "ras", "image/x-cmu-raster" },
+ { "rcprofile", "application/vnd.ipunplugged.rcprofile" },
+ { "rdf", "application/rdf+xml" },
+ { "rdz", "application/vnd.data-vision.rdz" },
+ { "relo", "application/p2p-overlay+xml" },
+ { "rep", "application/vnd.businessobjects" },
+ { "res", "application/x-dtbresource+xml" },
+ { "rgb", "image/x-rgb" },
+ { "rif", "application/reginfo+xml" },
+ { "rip", "audio/vnd.rip" },
+ { "ris", "application/x-research-info-systems" },
+ { "rl", "application/resource-lists+xml" },
+ { "rlc", "image/vnd.fujixerox.edmics-rlc" },
+ { "rld", "application/resource-lists-diff+xml" },
{ "rm", "application/vnd.rn-realmedia" },
+ { "rmi", "audio/midi" },
+ { "rmp", "audio/x-pn-realaudio-plugin" },
+ { "rms", "application/vnd.jcp.javame.midlet-rms" },
{ "rmvb", "application/vnd.rn-realmedia-vbr" },
- { "link66", "application/vnd.route66.link66+xml" },
- { "st", "application/vnd.sailingtracker.track" },
+ { "rnc", "application/relax-ng-compact-syntax" },
+ { "rng", "application/xml" },
+ { "roa", "application/rpki-roa" },
+ { "roff", "text/troff" },
+ { "rp9", "application/vnd.cloanto.rp9" },
+ { "rpm", "application/x-redhat-package-manager" },
+ { "rpss", "application/vnd.nokia.radio-presets" },
+ { "rpst", "application/vnd.nokia.radio-preset" },
+ { "rq", "application/sparql-query" },
+ { "rs", "application/rls-services+xml" },
+ { "rsat", "application/atsc-rsat+xml" },
+ { "rsd", "application/rsd+xml" },
+ { "rsheet", "application/urc-ressheet+xml" },
+ { "rss", "application/rss+xml" },
+ { "rtf", "application/rtf" },
+ { "rtx", "text/richtext" },
+ { "run", "application/x-makeself" },
+ { "rusd", "application/route-usd+xml" },
+ { "s", "text/x-asm" },
+ { "s3m", "audio/s3m" },
+ { "saf", "application/vnd.yamaha.smaf-audio" },
+ { "sass", "text/x-sass" },
+ { "sbml", "application/sbml+xml" },
+ { "sc", "application/vnd.ibm.secure-container" },
+ { "scd", "application/x-msschedule" },
+ { "scm", "application/vnd.lotus-screencam" },
+ { "scq", "application/scvp-cv-request" },
+ { "scs", "application/scvp-cv-response" },
+ { "scss", "text/x-scss" },
+ { "scurl", "text/vnd.curl.scurl" },
+ { "sda", "application/vnd.stardivision.draw" },
+ { "sdc", "application/vnd.stardivision.calc" },
+ { "sdd", "application/vnd.stardivision.impress" },
+ { "sdkd", "application/vnd.solent.sdkm+xml" },
+ { "sdkm", "application/vnd.solent.sdkm+xml" },
+ { "sdp", "application/sdp" },
+ { "sdw", "application/vnd.stardivision.writer" },
+ { "sea", "application/x-sea" },
{ "see", "application/vnd.seemail" },
+ { "seed", "application/vnd.fdsn.seed" },
{ "sema", "application/vnd.sema" },
{ "semd", "application/vnd.semd" },
{ "semf", "application/vnd.semf" },
- { "ifm", "application/vnd.shana.informed.formdata" },
- { "itp", "application/vnd.shana.informed.formtemplate" },
- { "iif", "application/vnd.shana.informed.interchange" },
- { "ipk", "application/vnd.shana.informed.package" },
- { "twd", "application/vnd.simtech-mindmapper" },
- { "twds", "application/vnd.simtech-mindmapper" },
- { "mmf", "application/vnd.smaf" },
- { "teacher", "application/vnd.smart.teacher" },
- { "sdkm", "application/vnd.solent.sdkm+xml" },
- { "sdkd", "application/vnd.solent.sdkm+xml" },
- { "dxp", "application/vnd.spotfire.dxp" },
+ { "senmlx", "application/senml+xml" },
+ { "sensmlx", "application/sensml+xml" },
+ { "ser", "application/java-serialized-object" },
+ { "setpay", "application/set-payment-initiation" },
+ { "setreg", "application/set-registration-initiation" },
+ { "sfd-hdstx", "application/vnd.hydrostatix.sof-data" },
{ "sfs", "application/vnd.spotfire.sfs" },
- { "sdc", "application/vnd.stardivision.calc" },
- { "sda", "application/vnd.stardivision.draw" },
- { "sdd", "application/vnd.stardivision.impress" },
- { "smf", "application/vnd.stardivision.math" },
- { "sdw", "application/vnd.stardivision.writer" },
- { "vor", "application/vnd.stardivision.writer" },
+ { "sfv", "text/x-sfv" },
+ { "sgi", "image/sgi" },
{ "sgl", "application/vnd.stardivision.writer-global" },
- { "smzip", "application/vnd.stepmania.package" },
+ { "sgm", "text/sgml" },
+ { "sgml", "text/sgml" },
+ { "sh", "application/x-sh" },
+ { "shar", "application/x-shar" },
+ { "shex", "text/shex" },
+ { "shf", "application/shf+xml" },
+ { "shtml", "text/html" },
+ { "sid", "image/x-mrsid-image" },
+ { "sieve", "application/sieve" },
+ { "sig", "application/pgp-signature" },
+ { "sil", "audio/silk" },
+ { "silo", "model/mesh" },
+ { "sis", "application/vnd.symbian.install" },
+ { "sisx", "application/vnd.symbian.install" },
+ { "sit", "application/x-stuffit" },
+ { "sitx", "application/x-stuffitx" },
+ { "siv", "application/sieve" },
+ { "skd", "application/vnd.koan" },
+ { "skm", "application/vnd.koan" },
+ { "skp", "application/vnd.koan" },
+ { "skt", "application/vnd.koan" },
+ { "sldm", "application/vnd.ms-powerpoint.slide.macroenabled.12" },
+ { "sldx", "application/vnd.openxmlformats-officedocument.presentationml.slide" },
+ { "slim", "text/slim" },
+ { "slm", "text/slim" },
+ { "sls", "application/route-s-tsid+xml" },
+ { "slt", "application/vnd.epson.salt" },
{ "sm", "application/vnd.stepmania.stepchart" },
- { "sxc", "application/vnd.sun.xml.calc" },
+ { "smf", "application/vnd.stardivision.math" },
+ { "smi", "application/smil+xml" },
+ { "smil", "application/smil+xml" },
+ { "smv", "video/x-smv" },
+ { "smzip", "application/vnd.stepmania.package" },
+ { "snd", "audio/basic" },
+ { "snf", "application/x-font-snf" },
+ { "so", "application/octet-stream" },
+ { "spc", "application/x-pkcs7-certificates" },
+ { "spdx", "text/spdx" },
+ { "spf", "application/vnd.yamaha.smaf-phrase" },
+ { "spl", "application/x-futuresplash" },
+ { "spot", "text/vnd.in3d.spot" },
+ { "spp", "application/scvp-vp-response" },
+ { "spq", "application/scvp-vp-request" },
+ { "spx", "audio/ogg" },
+ { "sql", "application/x-sql" },
+ { "src", "application/x-wais-source" },
+ { "srt", "application/x-subrip" },
+ { "sru", "application/sru+xml" },
+ { "srx", "application/sparql-results+xml" },
+ { "ssdl", "application/ssdl+xml" },
+ { "sse", "application/vnd.kodak-descriptor" },
+ { "ssf", "application/vnd.epson.ssf" },
+ { "ssml", "application/ssml+xml" },
+ { "st", "application/vnd.sailingtracker.track" },
{ "stc", "application/vnd.sun.xml.calc.template" },
- { "sxd", "application/vnd.sun.xml.draw" },
{ "std", "application/vnd.sun.xml.draw.template" },
- { "sxi", "application/vnd.sun.xml.impress" },
+ { "stf", "application/vnd.wt.stf" },
{ "sti", "application/vnd.sun.xml.impress.template" },
- { "sxm", "application/vnd.sun.xml.math" },
- { "sxw", "application/vnd.sun.xml.writer" },
- { "sxg", "application/vnd.sun.xml.writer.global" },
+ { "stk", "application/hyperstudio" },
+ { "stl", "model/stl" },
+ { "str", "application/vnd.pg.format" },
{ "stw", "application/vnd.sun.xml.writer.template" },
+ { "styl", "text/stylus" },
+ { "stylus", "text/stylus" },
+ { "sub", "text/vnd.dvb.subtitle" },
{ "sus", "application/vnd.sus-calendar" },
{ "susp", "application/vnd.sus-calendar" },
+ { "sv4cpio", "application/x-sv4cpio" },
+ { "sv4crc", "application/x-sv4crc" },
+ { "svc", "application/vnd.dvb.service" },
{ "svd", "application/vnd.svd" },
- { "sis", "application/vnd.symbian.install" },
- { "sisx", "application/vnd.symbian.install" },
- { "xsm", "application/vnd.syncml+xml" },
- { "bdm", "application/vnd.syncml.dm+wbxml" },
- { "xdm", "application/vnd.syncml.dm+xml" },
+ { "svg", "image/svg+xml" },
+ { "svgz", "image/svg+xml" },
+ { "swa", "application/x-director" },
+ { "swf", "application/x-shockwave-flash" },
+ { "swi", "application/vnd.aristanetworks.swi" },
+ { "swidtag", "application/swid+xml" },
+ { "sxc", "application/vnd.sun.xml.calc" },
+ { "sxd", "application/vnd.sun.xml.draw" },
+ { "sxg", "application/vnd.sun.xml.writer.global" },
+ { "sxi", "application/vnd.sun.xml.impress" },
+ { "sxm", "application/vnd.sun.xml.math" },
+ { "sxw", "application/vnd.sun.xml.writer" },
+ { "t", "text/troff" },
+ { "t3", "application/x-t3vm-image" },
+ { "t38", "image/t38" },
+ { "taglet", "application/vnd.mynfc" },
{ "tao", "application/vnd.tao.intent-module-archive" },
- { "pcap", "application/vnd.tcpdump.pcap" },
- { "cap", "application/vnd.tcpdump.pcap" },
- { "dmp", "application/vnd.tcpdump.pcap" },
+ { "tap", "image/vnd.tencent.tap" },
+ { "tar", "application/x-tar" },
+ { "tcap", "application/vnd.3gpp2.tcap" },
+ { "tcl", "application/x-tcl" },
+ { "td", "application/urc-targetdesc+xml" },
+ { "teacher", "application/vnd.smart.teacher" },
+ { "tei", "application/tei+xml" },
+ { "teicorpus", "application/tei+xml" },
+ { "tex", "application/x-tex" },
+ { "texi", "application/x-texinfo" },
+ { "texinfo", "application/x-texinfo" },
+ { "text", "text/plain" },
+ { "tfi", "application/thraud+xml" },
+ { "tfm", "application/x-tex-tfm" },
+ { "tfx", "image/tiff-fx" },
+ { "tga", "image/x-tga" },
+ { "thmx", "application/vnd.ms-officetheme" },
+ { "tif", "image/tiff" },
+ { "tiff", "image/tiff" },
+ { "tk", "application/x-tcl" },
{ "tmo", "application/vnd.tmobile-livetv" },
+ { "toml", "application/toml" },
+ { "torrent", "application/x-bittorrent" },
+ { "tpl", "application/vnd.groove-tool-template" },
{ "tpt", "application/vnd.trid.tpt" },
- { "mxs", "application/vnd.triscape.mxs" },
+ { "tr", "text/troff" },
{ "tra", "application/vnd.trueapp" },
+ { "trm", "application/x-msterminal" },
+ { "ts", "video/mp2t" },
+ { "tsd", "application/timestamped-data" },
+ { "tsv", "text/tab-separated-values" },
+ { "ttc", "font/collection" },
+ { "ttf", "font/ttf" },
+ { "ttl", "text/turtle" },
+ { "ttml", "application/ttml+xml" },
+ { "twd", "application/vnd.simtech-mindmapper" },
+ { "twds", "application/vnd.simtech-mindmapper" },
+ { "txd", "application/vnd.genomatix.tuxedo" },
+ { "txf", "application/vnd.mobius.txf" },
+ { "txt", "text/plain" },
+ { "u32", "application/x-authorware-bin" },
+ { "u8dsn", "message/global-delivery-status" },
+ { "u8hdr", "message/global-headers" },
+ { "u8mdn", "message/global-disposition-notification" },
+ { "u8msg", "message/global" },
+ { "ubj", "application/ubjson" },
+ { "udeb", "application/x-debian-package" },
{ "ufd", "application/vnd.ufdl" },
{ "ufdl", "application/vnd.ufdl" },
- { "utz", "application/vnd.uiq.theme" },
+ { "ulx", "application/x-glulx" },
{ "umj", "application/vnd.umajin" },
{ "unityweb", "application/vnd.unity" },
{ "uoml", "application/vnd.uoml+xml" },
+ { "uri", "text/uri-list" },
+ { "uris", "text/uri-list" },
+ { "urls", "text/uri-list" },
+ { "usdz", "model/vnd.usdz+zip" },
+ { "ustar", "application/x-ustar" },
+ { "utz", "application/vnd.uiq.theme" },
+ { "uu", "text/x-uuencode" },
+ { "uva", "audio/vnd.dece.audio" },
+ { "uvd", "application/vnd.dece.data" },
+ { "uvf", "application/vnd.dece.data" },
+ { "uvg", "image/vnd.dece.graphic" },
+ { "uvh", "video/vnd.dece.hd" },
+ { "uvi", "image/vnd.dece.graphic" },
+ { "uvm", "video/vnd.dece.mobile" },
+ { "uvp", "video/vnd.dece.pd" },
+ { "uvs", "video/vnd.dece.sd" },
+ { "uvt", "application/vnd.dece.ttml+xml" },
+ { "uvu", "video/vnd.uvvu.mp4" },
+ { "uvv", "video/vnd.dece.video" },
+ { "uvva", "audio/vnd.dece.audio" },
+ { "uvvd", "application/vnd.dece.data" },
+ { "uvvf", "application/vnd.dece.data" },
+ { "uvvg", "image/vnd.dece.graphic" },
+ { "uvvh", "video/vnd.dece.hd" },
+ { "uvvi", "image/vnd.dece.graphic" },
+ { "uvvm", "video/vnd.dece.mobile" },
+ { "uvvp", "video/vnd.dece.pd" },
+ { "uvvs", "video/vnd.dece.sd" },
+ { "uvvt", "application/vnd.dece.ttml+xml" },
+ { "uvvu", "video/vnd.uvvu.mp4" },
+ { "uvvv", "video/vnd.dece.video" },
+ { "uvvx", "application/vnd.dece.unspecified" },
+ { "uvvz", "application/vnd.dece.zip" },
+ { "uvx", "application/vnd.dece.unspecified" },
+ { "uvz", "application/vnd.dece.zip" },
+ { "vbox", "application/x-virtualbox-vbox" },
+ { "vbox-extpack", "application/x-virtualbox-vbox-extpack" },
+ { "vcard", "text/vcard" },
+ { "vcd", "application/x-cdlink" },
+ { "vcf", "text/x-vcard" },
+ { "vcg", "application/vnd.groove-vcard" },
+ { "vcs", "text/x-vcalendar" },
{ "vcx", "application/vnd.vcx" },
+ { "vdi", "application/x-virtualbox-vdi" },
+ { "vhd", "application/x-virtualbox-vhd" },
+ { "vis", "application/vnd.visionary" },
+ { "viv", "video/vnd.vivo" },
+ { "vmdk", "application/x-virtualbox-vmdk" },
+ { "vob", "video/x-ms-vob" },
+ { "vor", "application/vnd.stardivision.writer" },
+ { "vox", "application/x-authorware-bin" },
+ { "vrml", "model/vrml" },
{ "vsd", "application/vnd.visio" },
- { "vst", "application/vnd.visio" },
+ { "vsf", "application/vnd.vsf" },
{ "vss", "application/vnd.visio" },
+ { "vst", "application/vnd.visio" },
{ "vsw", "application/vnd.visio" },
- { "vis", "application/vnd.visionary" },
- { "vsf", "application/vnd.vsf" },
+ { "vtf", "image/vnd.valve.source.texture" },
+ { "vtt", "text/vtt" },
+ { "vtu", "model/vnd.vtu" },
+ { "vxml", "application/voicexml+xml" },
+ { "w3d", "application/x-director" },
+ { "wad", "application/x-doom" },
+ { "wadl", "application/vnd.sun.wadl+xml" },
+ { "war", "application/java-archive" },
+ { "wasm", "application/wasm" },
+ { "wav", "audio/wave" },
+ { "wax", "audio/x-ms-wax" },
+ { "wbmp", "image/vnd.wap.wbmp" },
+ { "wbs", "application/vnd.criticaltools.wbs+xml" },
{ "wbxml", "application/vnd.wap.wbxml" },
+ { "wcm", "application/vnd.ms-works" },
+ { "wdb", "application/vnd.ms-works" },
+ { "wdp", "image/vnd.ms-photo" },
+ { "weba", "audio/webm" },
+ { "webapp", "application/x-web-app-manifest+json" },
+ { "webm", "video/webm" },
+ { "webmanifest", "application/manifest+json" },
+ { "webp", "image/webp" },
+ { "wg", "application/vnd.pmi.widget" },
+ { "wgt", "application/widget" },
+ { "wks", "application/vnd.ms-works" },
+ { "wm", "video/x-ms-wm" },
+ { "wma", "audio/x-ms-wma" },
+ { "wmd", "application/x-ms-wmd" },
+ { "wmf", "image/wmf" },
+ { "wml", "text/vnd.wap.wml" },
{ "wmlc", "application/vnd.wap.wmlc" },
+ { "wmls", "text/vnd.wap.wmlscript" },
{ "wmlsc", "application/vnd.wap.wmlscriptc" },
- { "wtb", "application/vnd.webturbo" },
- { "nbp", "application/vnd.wolfram.player" },
+ { "wmv", "video/x-ms-wmv" },
+ { "wmx", "video/x-ms-wmx" },
+ { "wmz", "application/x-ms-wmz" },
+ { "woff", "font/woff" },
+ { "woff2", "font/woff2" },
{ "wpd", "application/vnd.wordperfect" },
+ { "wpl", "application/vnd.ms-wpl" },
+ { "wps", "application/vnd.ms-works" },
{ "wqd", "application/vnd.wqd" },
- { "stf", "application/vnd.wt.stf" },
- { "xar", "application/vnd.xara" },
- { "xfdl", "application/vnd.xfdl" },
- { "hvd", "application/vnd.yamaha.hv-dic" },
- { "hvs", "application/vnd.yamaha.hv-script" },
- { "hvp", "application/vnd.yamaha.hv-voice" },
- { "osf", "application/vnd.yamaha.openscoreformat" },
- { "osfpvg", "application/vnd.yamaha.openscoreformat.osfpvg+xml" },
- { "saf", "application/vnd.yamaha.smaf-audio" },
- { "spf", "application/vnd.yamaha.smaf-phrase" },
- { "cmp", "application/vnd.yellowriver-custom-menu" },
- { "zir", "application/vnd.zul" },
- { "zirz", "application/vnd.zul" },
- { "zaz", "application/vnd.zzazz.deck+xml" },
- { "vxml", "application/voicexml+xml" },
- { "wgt", "application/widget" },
- { "hlp", "application/winhlp" },
+ { "wri", "application/x-mswrite" },
+ { "wrl", "model/vrml" },
+ { "wsc", "message/vnd.wfa.wsc" },
{ "wsdl", "application/wsdl+xml" },
{ "wspolicy", "application/wspolicy+xml" },
- { "7z", "application/x-7z-compressed" },
- { "abw", "application/x-abiword" },
- { "ace", "application/x-ace-compressed" },
- { "dmg", "application/x-apple-diskimage" },
- { "aab", "application/x-authorware-bin" },
+ { "wtb", "application/vnd.webturbo" },
+ { "wvx", "video/x-ms-wvx" },
{ "x32", "application/x-authorware-bin" },
- { "u32", "application/x-authorware-bin" },
- { "vox", "application/x-authorware-bin" },
- { "aam", "application/x-authorware-map" },
- { "aas", "application/x-authorware-seg" },
- { "bcpio", "application/x-bcpio" },
- { "torrent", "application/x-bittorrent" },
- { "blb", "application/x-blorb" },
- { "blorb", "application/x-blorb" },
- { "bz", "application/x-bzip" },
- { "bz2", "application/x-bzip2" },
- { "boz", "application/x-bzip2" },
- { "cbr", "application/x-cbr" },
- { "cba", "application/x-cbr" },
- { "cbt", "application/x-cbr" },
- { "cbz", "application/x-cbr" },
- { "cb7", "application/x-cbr" },
- { "vcd", "application/x-cdlink" },
- { "cfs", "application/x-cfs-compressed" },
- { "chat", "application/x-chat" },
- { "pgn", "application/x-chess-pgn" },
- { "nsc", "application/x-conference" },
- { "cpio", "application/x-cpio" },
- { "csh", "application/x-csh" },
- { "deb", "application/x-debian-package" },
- { "udeb", "application/x-debian-package" },
- { "dgc", "application/x-dgc-compressed" },
- { "dir", "application/x-director" },
- { "dcr", "application/x-director" },
- { "dxr", "application/x-director" },
- { "cst", "application/x-director" },
- { "cct", "application/x-director" },
- { "cxt", "application/x-director" },
- { "w3d", "application/x-director" },
- { "fgd", "application/x-director" },
- { "swa", "application/x-director" },
- { "wad", "application/x-doom" },
- { "ncx", "application/x-dtbncx+xml" },
- { "dtb", "application/x-dtbook+xml" },
- { "res", "application/x-dtbresource+xml" },
- { "dvi", "application/x-dvi" },
- { "evy", "application/x-envoy" },
- { "eva", "application/x-eva" },
- { "bdf", "application/x-font-bdf" },
- { "gsf", "application/x-font-ghostscript" },
- { "psf", "application/x-font-linux-psf" },
- { "pcf", "application/x-font-pcf" },
- { "snf", "application/x-font-snf" },
- { "pfa", "application/x-font-type1" },
- { "pfb", "application/x-font-type1" },
- { "pfm", "application/x-font-type1" },
- { "afm", "application/x-font-type1" },
- { "arc", "application/x-freearc" },
- { "spl", "application/x-futuresplash" },
- { "gca", "application/x-gca-compressed" },
- { "ulx", "application/x-glulx" },
- { "gnumeric", "application/x-gnumeric" },
- { "gramps", "application/x-gramps-xml" },
- { "gtar", "application/x-gtar" },
- { "hdf", "application/x-hdf" },
- { "install", "application/x-install-instructions" },
- { "iso", "application/x-iso9660-image" },
- { "jnlp", "application/x-java-jnlp-file" },
- { "latex", "application/x-latex" },
- { "lzh", "application/x-lzh-compressed" },
- { "lha", "application/x-lzh-compressed" },
- { "mie", "application/x-mie" },
- { "prc", "application/x-mobipocket-ebook" },
- { "mobi", "application/x-mobipocket-ebook" },
- { "application", "application/x-ms-application" },
- { "lnk", "application/x-ms-shortcut" },
- { "wmd", "application/x-ms-wmd" },
- { "wmz", "application/x-msmetafile" },
- { "xbap", "application/x-ms-xbap" },
- { "mdb", "application/x-msaccess" },
- { "obd", "application/x-msbinder" },
- { "crd", "application/x-mscardfile" },
- { "clp", "application/x-msclip" },
- { "exe", "application/x-msdownload" },
- { "dll", "application/x-msdownload" },
- { "com", "application/x-msdownload" },
- { "bat", "application/x-msdownload" },
- { "msi", "application/x-msdownload" },
- { "mvb", "application/x-msmediaview" },
- { "m13", "application/x-msmediaview" },
- { "m14", "application/x-msmediaview" },
- { "wmf", "application/x-msmetafile" },
- { "emf", "application/x-msmetafile" },
- { "emz", "application/x-msmetafile" },
- { "mny", "application/x-msmoney" },
- { "pub", "application/x-mspublisher" },
- { "scd", "application/x-msschedule" },
- { "trm", "application/x-msterminal" },
- { "wri", "application/x-mswrite" },
- { "nc", "application/x-netcdf" },
- { "cdf", "application/x-netcdf" },
- { "nzb", "application/x-nzb" },
- { "p12", "application/x-pkcs12" },
- { "pfx", "application/x-pkcs12" },
- { "p7b", "application/x-pkcs7-certificates" },
- { "spc", "application/x-pkcs7-certificates" },
- { "p7r", "application/x-pkcs7-certreqresp" },
- { "rar", "application/x-rar-compressed" },
- { "ris", "application/x-research-info-systems" },
- { "sh", "application/x-sh" },
- { "shar", "application/x-shar" },
- { "swf", "application/x-shockwave-flash" },
- { "xap", "application/x-silverlight-app" },
- { "sql", "application/x-sql" },
- { "sit", "application/x-stuffit" },
- { "sitx", "application/x-stuffitx" },
- { "srt", "application/x-subrip" },
- { "sv4cpio", "application/x-sv4cpio" },
- { "sv4crc", "application/x-sv4crc" },
- { "t3", "application/x-t3vm-image" },
- { "gam", "application/x-tads" },
- { "tar", "application/x-tar" },
- { "tcl", "application/x-tcl" },
- { "tex", "application/x-tex" },
- { "tfm", "application/x-tex-tfm" },
- { "texinfo", "application/x-texinfo" },
- { "texi", "application/x-texinfo" },
- { "obj", "application/x-tgif" },
- { "ustar", "application/x-ustar" },
- { "src", "application/x-wais-source" },
- { "der", "application/x-x509-ca-cert" },
- { "crt", "application/x-x509-ca-cert" },
- { "fig", "application/x-xfig" },
- { "xlf", "application/x-xliff+xml" },
- { "xpi", "application/x-xpinstall" },
- { "xz", "application/x-xz" },
- { "z1", "application/x-zmachine" },
- { "z2", "application/x-zmachine" },
- { "z3", "application/x-zmachine" },
- { "z4", "application/x-zmachine" },
- { "z5", "application/x-zmachine" },
- { "z6", "application/x-zmachine" },
- { "z7", "application/x-zmachine" },
- { "z8", "application/x-zmachine" },
+ { "x3d", "model/x3d+xml" },
+ { "x3db", "model/x3d+fastinfoset" },
+ { "x3dbz", "model/x3d+binary" },
+ { "x3dv", "model/x3d-vrml" },
+ { "x3dvz", "model/x3d+vrml" },
+ { "x3dz", "model/x3d+xml" },
+ { "x_b", "model/vnd.parasolid.transmit.binary" },
+ { "x_t", "model/vnd.parasolid.transmit.text" },
{ "xaml", "application/xaml+xml" },
- { "xdf", "application/xcap-diff+xml" },
+ { "xap", "application/x-silverlight-app" },
+ { "xar", "application/vnd.xara" },
+ { "xav", "application/xcap-att+xml" },
+ { "xbap", "application/x-ms-xbap" },
+ { "xbd", "application/vnd.fujixerox.docuworks.binder" },
+ { "xbm", "image/x-xbitmap" },
+ { "xca", "application/xcap-caps+xml" },
+ { "xcs", "application/calendar+xml" },
+ { "xdf", "application/mrb-consumer+xml" },
+ { "xdm", "application/vnd.syncml.dm+xml" },
+ { "xdp", "application/vnd.adobe.xdp+xml" },
+ { "xdssc", "application/dssc+xml" },
+ { "xdw", "application/vnd.fujixerox.docuworks" },
+ { "xel", "application/xcap-el+xml" },
{ "xenc", "application/xenc+xml" },
- { "xhtml", "application/xhtml+xml" },
+ { "xer", "application/patch-ops-error+xml" },
+ { "xfdf", "application/vnd.adobe.xfdf" },
+ { "xfdl", "application/vnd.xfdl" },
{ "xht", "application/xhtml+xml" },
+ { "xhtml", "application/xhtml+xml" },
+ { "xhvml", "application/xv+xml" },
+ { "xif", "image/vnd.xiff" },
+ { "xla", "application/vnd.ms-excel" },
+ { "xlam", "application/vnd.ms-excel.addin.macroenabled.12" },
+ { "xlc", "application/vnd.ms-excel" },
+ { "xlf", "application/xliff+xml" },
+ { "xlm", "application/vnd.ms-excel" },
+ { "xls", "application/vnd.ms-excel" },
+ { "xlsb", "application/vnd.ms-excel.sheet.binary.macroenabled.12" },
+ { "xlsm", "application/vnd.ms-excel.sheet.macroenabled.12" },
+ { "xlsx", "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet" },
+ { "xlt", "application/vnd.ms-excel" },
+ { "xltm", "application/vnd.ms-excel.template.macroenabled.12" },
+ { "xltx", "application/vnd.openxmlformats-officedocument.spreadsheetml.template" },
+ { "xlw", "application/vnd.ms-excel" },
+ { "xm", "audio/xm" },
{ "xml", "application/xml" },
- { "xsl", "application/xml" },
- { "dtd", "application/xml-dtd" },
+ { "xns", "application/xcap-ns+xml" },
+ { "xo", "application/vnd.olpc-sugar" },
{ "xop", "application/xop+xml" },
+ { "xpi", "application/x-xpinstall" },
{ "xpl", "application/xproc+xml" },
+ { "xpm", "image/x-xpixmap" },
+ { "xpr", "application/vnd.is-xpr" },
+ { "xps", "application/vnd.ms-xpsdocument" },
+ { "xpw", "application/vnd.intercon.formnet" },
+ { "xpx", "application/vnd.intercon.formnet" },
+ { "xsd", "application/xml" },
+ { "xsl", "application/xml" },
{ "xslt", "application/xslt+xml" },
+ { "xsm", "application/vnd.syncml+xml" },
{ "xspf", "application/xspf+xml" },
- { "mxml", "application/xv+xml" },
- { "xhvml", "application/xv+xml" },
- { "xvml", "application/xv+xml" },
+ { "xul", "application/vnd.mozilla.xul+xml" },
{ "xvm", "application/xv+xml" },
+ { "xvml", "application/xv+xml" },
+ { "xwd", "image/x-xwindowdump" },
+ { "xyz", "chemical/x-xyz" },
+ { "xz", "application/x-xz" },
+ { "yaml", "text/yaml" },
{ "yang", "application/yang" },
{ "yin", "application/yin+xml" },
+ { "yml", "text/yaml" },
+ { "ymp", "text/x-suse-ymp" },
+ { "z1", "application/x-zmachine" },
+ { "z2", "application/x-zmachine" },
+ { "z3", "application/x-zmachine" },
+ { "z4", "application/x-zmachine" },
+ { "z5", "application/x-zmachine" },
+ { "z6", "application/x-zmachine" },
+ { "z7", "application/x-zmachine" },
+ { "z8", "application/x-zmachine" },
+ { "zaz", "application/vnd.zzazz.deck+xml" },
{ "zip", "application/zip" },
- { "adp", "audio/adpcm" },
- { "au", "audio/basic" },
- { "snd", "audio/basic" },
- { "mid", "audio/midi" },
- { "midi", "audio/midi" },
- { "kar", "audio/midi" },
- { "rmi", "audio/midi" },
- { "m4a", "audio/mp4" },
- { "mp4a", "audio/mp4" },
- { "mpga", "audio/mpeg" },
- { "mp2", "audio/mpeg" },
- { "mp2a", "audio/mpeg" },
- { "mp3", "audio/mpeg" },
- { "m2a", "audio/mpeg" },
- { "m3a", "audio/mpeg" },
- { "oga", "audio/ogg" },
- { "ogg", "audio/ogg" },
- { "spx", "audio/ogg" },
- { "s3m", "audio/s3m" },
- { "sil", "audio/silk" },
- { "uva", "audio/vnd.dece.audio" },
- { "uvva", "audio/vnd.dece.audio" },
- { "eol", "audio/vnd.digital-winds" },
- { "dra", "audio/vnd.dra" },
- { "dts", "audio/vnd.dts" },
- { "dtshd", "audio/vnd.dts.hd" },
- { "lvp", "audio/vnd.lucent.voice" },
- { "pya", "audio/vnd.ms-playready.media.pya" },
- { "ecelp4800", "audio/vnd.nuera.ecelp4800" },
- { "ecelp7470", "audio/vnd.nuera.ecelp7470" },
- { "ecelp9600", "audio/vnd.nuera.ecelp9600" },
- { "rip", "audio/vnd.rip" },
- { "weba", "audio/webm" },
- { "aac", "audio/x-aac" },
- { "aif", "audio/x-aiff" },
- { "aiff", "audio/x-aiff" },
- { "aifc", "audio/x-aiff" },
- { "caf", "audio/x-caf" },
- { "flac", "audio/x-flac" },
- { "mka", "audio/x-matroska" },
- { "m3u", "audio/x-mpegurl" },
- { "wax", "audio/x-ms-wax" },
- { "wma", "audio/x-ms-wma" },
- { "ram", "audio/x-pn-realaudio" },
- { "ra", "audio/x-pn-realaudio" },
- { "rmp", "audio/x-pn-realaudio-plugin" },
- { "wav", "audio/x-wav" },
- { "xm", "audio/xm" },
- { "cdx", "chemical/x-cdx" },
- { "cif", "chemical/x-cif" },
- { "cmdf", "chemical/x-cmdf" },
- { "cml", "chemical/x-cml" },
- { "csml", "chemical/x-csml" },
- { "xyz", "chemical/x-xyz" },
- { "ttc", "font/collection" },
- { "otf", "font/otf" },
- { "ttf", "font/ttf" },
- { "woff", "font/woff" },
- { "woff2", "font/woff2" },
- { "bmp", "image/bmp" },
- { "cgm", "image/cgm" },
- { "g3", "image/g3fax" },
- { "gif", "image/gif" },
- { "ief", "image/ief" },
- { "jpeg", "image/jpeg" },
- { "jpg", "image/jpeg" },
- { "jpe", "image/jpeg" },
- { "ktx", "image/ktx" },
- { "png", "image/png" },
- { "btif", "image/prs.btif" },
- { "sgi", "image/sgi" },
- { "svg", "image/svg+xml" },
- { "svgz", "image/svg+xml" },
- { "tiff", "image/tiff" },
- { "tif", "image/tiff" },
- { "psd", "image/vnd.adobe.photoshop" },
- { "uvi", "image/vnd.dece.graphic" },
- { "uvvi", "image/vnd.dece.graphic" },
- { "uvg", "image/vnd.dece.graphic" },
- { "uvvg", "image/vnd.dece.graphic" },
- { "djvu", "image/vnd.djvu" },
- { "djv", "image/vnd.djvu" },
- { "sub", "text/vnd.dvb.subtitle" },
- { "dwg", "image/vnd.dwg" },
- { "dxf", "image/vnd.dxf" },
- { "fbs", "image/vnd.fastbidsheet" },
- { "fpx", "image/vnd.fpx" },
- { "fst", "image/vnd.fst" },
- { "mmr", "image/vnd.fujixerox.edmics-mmr" },
- { "rlc", "image/vnd.fujixerox.edmics-rlc" },
- { "mdi", "image/vnd.ms-modi" },
- { "wdp", "image/vnd.ms-photo" },
- { "npx", "image/vnd.net-fpx" },
- { "wbmp", "image/vnd.wap.wbmp" },
- { "xif", "image/vnd.xiff" },
- { "webp", "image/webp" },
- { "3ds", "image/x-3ds" },
- { "ras", "image/x-cmu-raster" },
- { "cmx", "image/x-cmx" },
- { "fh", "image/x-freehand" },
- { "fhc", "image/x-freehand" },
- { "fh4", "image/x-freehand" },
- { "fh5", "image/x-freehand" },
- { "fh7", "image/x-freehand" },
- { "ico", "image/x-icon" },
- { "sid", "image/x-mrsid-image" },
- { "pcx", "image/x-pcx" },
- { "pic", "image/x-pict" },
- { "pct", "image/x-pict" },
- { "pnm", "image/x-portable-anymap" },
- { "pbm", "image/x-portable-bitmap" },
- { "pgm", "image/x-portable-graymap" },
- { "ppm", "image/x-portable-pixmap" },
- { "rgb", "image/x-rgb" },
- { "tga", "image/x-tga" },
- { "xbm", "image/x-xbitmap" },
- { "xpm", "image/x-xpixmap" },
- { "xwd", "image/x-xwindowdump" },
- { "eml", "message/rfc822" },
- { "mime", "message/rfc822" },
- { "igs", "model/iges" },
- { "iges", "model/iges" },
- { "msh", "model/mesh" },
- { "mesh", "model/mesh" },
- { "silo", "model/mesh" },
- { "dae", "model/vnd.collada+xml" },
- { "dwf", "model/vnd.dwf" },
- { "gdl", "model/vnd.gdl" },
- { "gtw", "model/vnd.gtw" },
- { "mts", "model/vnd.mts" },
- { "vtu", "model/vnd.vtu" },
- { "wrl", "model/vrml" },
- { "vrml", "model/vrml" },
- { "x3db", "model/x3d+binary" },
- { "x3dbz", "model/x3d+binary" },
- { "x3dv", "model/x3d+vrml" },
- { "x3dvz", "model/x3d+vrml" },
- { "x3d", "model/x3d+xml" },
- { "x3dz", "model/x3d+xml" },
- { "appcache", "text/cache-manifest" },
- { "ics", "text/calendar" },
- { "ifb", "text/calendar" },
- { "css", "text/css" },
- { "csv", "text/csv" },
- { "html", "text/html" },
- { "htm", "text/html" },
- { "n3", "text/n3" },
- { "txt", "text/plain" },
- { "text", "text/plain" },
- { "conf", "text/plain" },
- { "def", "text/plain" },
- { "list", "text/plain" },
- { "log", "text/plain" },
- { "in", "text/plain" },
- { "dsc", "text/prs.lines.tag" },
- { "rtx", "text/richtext" },
- { "sgml", "text/sgml" },
- { "sgm", "text/sgml" },
- { "tsv", "text/tab-separated-values" },
- { "t", "text/troff" },
- { "tr", "text/troff" },
- { "roff", "text/troff" },
- { "man", "text/troff" },
- { "me", "text/troff" },
- { "ms", "text/troff" },
- { "ttl", "text/turtle" },
- { "uri", "text/uri-list" },
- { "uris", "text/uri-list" },
- { "urls", "text/uri-list" },
- { "vcard", "text/vcard" },
- { "curl", "text/vnd.curl" },
- { "dcurl", "text/vnd.curl.dcurl" },
- { "mcurl", "text/vnd.curl.mcurl" },
- { "scurl", "text/vnd.curl.scurl" },
- { "fly", "text/vnd.fly" },
- { "flx", "text/vnd.fmi.flexstor" },
- { "gv", "text/vnd.graphviz" },
- { "3dml", "text/vnd.in3d.3dml" },
- { "spot", "text/vnd.in3d.spot" },
- { "jad", "text/vnd.sun.j2me.app-descriptor" },
- { "wml", "text/vnd.wap.wml" },
- { "wmls", "text/vnd.wap.wmlscript" },
- { "s", "text/x-asm" },
- { "asm", "text/x-asm" },
- { "c", "text/x-c" },
- { "cc", "text/x-c" },
- { "cxx", "text/x-c" },
- { "cpp", "text/x-c" },
- { "h", "text/x-c" },
- { "hh", "text/x-c" },
- { "dic", "text/x-c" },
- { "f", "text/x-fortran" },
- { "for", "text/x-fortran" },
- { "f77", "text/x-fortran" },
- { "f90", "text/x-fortran" },
- { "java", "text/x-java-source" },
- { "nfo", "text/x-nfo" },
- { "opml", "text/x-opml" },
- { "p", "text/x-pascal" },
- { "pas", "text/x-pascal" },
- { "etx", "text/x-setext" },
- { "sfv", "text/x-sfv" },
- { "uu", "text/x-uuencode" },
- { "vcs", "text/x-vcalendar" },
- { "vcf", "text/x-vcard" },
- { "3gp", "video/3gpp" },
- { "3g2", "video/3gpp2" },
- { "h261", "video/h261" },
- { "h263", "video/h263" },
- { "h264", "video/h264" },
- { "jpgv", "video/jpeg" },
- { "jpm", "video/jpm" },
- { "jpgm", "video/jpm" },
- { "mj2", "video/mj2" },
- { "mjp2", "video/mj2" },
- { "mp4", "video/mp4" },
- { "mp4v", "video/mp4" },
- { "mpg4", "video/mp4" },
- { "mpeg", "video/mpeg" },
- { "mpg", "video/mpeg" },
- { "mpe", "video/mpeg" },
- { "m1v", "video/mpeg" },
- { "m2v", "video/mpeg" },
- { "ogv", "video/ogg" },
- { "qt", "video/quicktime" },
- { "mov", "video/quicktime" },
- { "uvh", "video/vnd.dece.hd" },
- { "uvvh", "video/vnd.dece.hd" },
- { "uvm", "video/vnd.dece.mobile" },
- { "uvvm", "video/vnd.dece.mobile" },
- { "uvp", "video/vnd.dece.pd" },
- { "uvvp", "video/vnd.dece.pd" },
- { "uvs", "video/vnd.dece.sd" },
- { "uvvs", "video/vnd.dece.sd" },
- { "uvv", "video/vnd.dece.video" },
- { "uvvv", "video/vnd.dece.video" },
- { "dvb", "video/vnd.dvb.file" },
- { "fvt", "video/vnd.fvt" },
- { "mxu", "video/vnd.mpegurl" },
- { "m4u", "video/vnd.mpegurl" },
- { "pyv", "video/vnd.ms-playready.media.pyv" },
- { "uvu", "video/vnd.uvvu.mp4" },
- { "uvvu", "video/vnd.uvvu.mp4" },
- { "viv", "video/vnd.vivo" },
- { "webm", "video/webm" },
- { "f4v", "video/x-f4v" },
- { "fli", "video/x-fli" },
- { "flv", "video/x-flv" },
- { "m4v", "video/x-m4v" },
- { "mkv", "video/x-matroska" },
- { "mk3d", "video/x-matroska" },
- { "mks", "video/x-matroska" },
- { "mng", "video/x-mng" },
- { "asf", "video/x-ms-asf" },
- { "asx", "video/x-ms-asf" },
- { "vob", "video/x-ms-vob" },
- { "wm", "video/x-ms-wm" },
- { "wmv", "video/x-ms-wmv" },
- { "wmx", "video/x-ms-wmx" },
- { "wvx", "video/x-ms-wvx" },
- { "avi", "video/x-msvideo" },
- { "movie", "video/x-sgi-movie" },
- { "smv", "video/x-smv" },
- { "ice", "x-conference/x-cooltalk" },
- { "map", "application/json" },
- { "jsm", "application/javascript" },
+ { "zir", "application/vnd.zul" },
+ { "zirz", "application/vnd.zul" },
+ { "zmm", "application/vnd.handheld-entertainment+xml" },
{ NULL, NULL }
};
diff --git a/sapi/cli/php_cli.c b/sapi/cli/php_cli.c
index 91f400aca4..d28f5a5378 100644
--- a/sapi/cli/php_cli.c
+++ b/sapi/cli/php_cli.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
@@ -56,6 +54,7 @@
#include "php_main.h"
#include "fopen_wrappers.h"
#include "ext/standard/php_standard.h"
+#include "ext/standard/dl_arginfo.h"
#include "cli.h"
#ifdef PHP_WIN32
#include <io.h>
@@ -80,6 +79,7 @@
#include "ps_title.h"
#include "php_cli_process_title.h"
+#include "php_cli_process_title_arginfo.h"
#ifndef PHP_WIN32
# define php_select(m, r, w, e, t) select(m, r, w, e, t)
@@ -120,7 +120,7 @@ static DWORD orig_cp = 0;
#define PHP_MODE_SHOW_INI_CONFIG 13
cli_shell_callbacks_t cli_shell_callbacks = { NULL, NULL, NULL };
-PHP_CLI_API cli_shell_callbacks_t *php_cli_get_shell_callbacks()
+PHP_CLI_API cli_shell_callbacks_t *php_cli_get_shell_callbacks(void)
{
return &cli_shell_callbacks;
}
@@ -175,11 +175,8 @@ const opt_struct OPTIONS[] = {
{'-', 0, NULL} /* end of args */
};
-static int module_name_cmp(const void *a, const void *b) /* {{{ */
+static int module_name_cmp(Bucket *f, Bucket *s) /* {{{ */
{
- Bucket *f = (Bucket *) a;
- Bucket *s = (Bucket *) b;
-
return strcasecmp(((zend_module_entry *)Z_PTR(f->val))->name,
((zend_module_entry *)Z_PTR(s->val))->name);
}
@@ -200,10 +197,9 @@ static void print_modules(void) /* {{{ */
}
/* }}} */
-static int print_extension_info(zend_extension *ext, void *arg) /* {{{ */
+static void print_extension_info(zend_extension *ext) /* {{{ */
{
php_printf("%s\n", ext->name);
- return ZEND_HASH_APPLY_KEEP;
}
/* }}} */
@@ -360,7 +356,7 @@ static void sapi_cli_register_variables(zval *track_vars_array) /* {{{ */
}
/* }}} */
-static void sapi_cli_log_message(char *message, int syslog_type_int) /* {{{ */
+static void sapi_cli_log_message(const char *message, int syslog_type_int) /* {{{ */
{
fprintf(stderr, "%s\n", message);
#ifdef PHP_WIN32
@@ -416,7 +412,7 @@ static int php_cli_startup(sapi_module_struct *sapi_module) /* {{{ */
/* {{{ sapi_cli_ini_defaults */
-/* overwriteable ini defaults must be set in sapi_cli_ini_defaults() */
+/* overwritable ini defaults must be set in sapi_cli_ini_defaults() */
#define INI_DEFAULT(name,value)\
ZVAL_NEW_STR(&tmp, zend_string_init(value, sizeof(value)-1, 1));\
zend_hash_str_update(configuration_hash, name, sizeof(name)-1, &tmp);\
@@ -424,13 +420,11 @@ static int php_cli_startup(sapi_module_struct *sapi_module) /* {{{ */
static void sapi_cli_ini_defaults(HashTable *configuration_hash)
{
zval tmp;
- INI_DEFAULT("report_zend_debug", "0");
INI_DEFAULT("display_errors", "1");
}
/* }}} */
-/* {{{ sapi_module_struct cli_sapi_module
- */
+/* {{{ sapi_module_struct cli_sapi_module */
static sapi_module_struct cli_sapi_module = {
"cli", /* name */
"Command Line Interface", /* pretty name */
@@ -464,12 +458,6 @@ static sapi_module_struct cli_sapi_module = {
};
/* }}} */
-/* {{{ arginfo ext/standard/dl.c */
-ZEND_BEGIN_ARG_INFO(arginfo_dl, 0)
- ZEND_ARG_INFO(0, extension_filename)
-ZEND_END_ARG_INFO()
-/* }}} */
-
static const zend_function_entry additional_functions[] = {
ZEND_FE(dl, arginfo_dl)
PHP_FE(cli_set_process_title, arginfo_cli_set_process_title)
@@ -477,8 +465,7 @@ static const zend_function_entry additional_functions[] = {
PHP_FE_END
};
-/* {{{ php_cli_usage
- */
+/* {{{ php_cli_usage */
static void php_cli_usage(char *argv0)
{
char *prog;
@@ -498,7 +485,7 @@ static void php_cli_usage(char *argv0)
" %s [options] -- [args...]\n"
" %s [options] -a\n"
"\n"
-#if (HAVE_LIBREADLINE || HAVE_LIBEDIT) && !defined(COMPILE_DL_READLINE)
+#if (defined(HAVE_LIBREADLINE) || defined(HAVE_LIBEDIT)) && !defined(COMPILE_DL_READLINE)
" -a Run as interactive shell\n"
#else
" -a Run interactively\n"
@@ -587,8 +574,7 @@ static void cli_register_file_handles(void) /* {{{ */
static const char *param_mode_conflict = "Either execute direct code, process stdin or use a file.\n";
-/* {{{ cli_seek_file_begin
- */
+/* {{{ cli_seek_file_begin */
static int cli_seek_file_begin(zend_file_handle *file_handle, char *script_file)
{
FILE *fp = VCWD_FOPEN(script_file, "rb");
@@ -620,7 +606,6 @@ static int do_cli(int argc, char **argv) /* {{{ */
int behavior = PHP_MODE_STANDARD;
char *reflection_what = NULL;
volatile int request_started = 0;
- volatile int exit_status = 0;
char *php_optarg = NULL, *orig_optarg = NULL;
int php_optind = 1, orig_optind = 1;
char *exec_direct=NULL, *exec_run=NULL, *exec_begin=NULL, *exec_end=NULL;
@@ -644,13 +629,13 @@ static int do_cli(int argc, char **argv) /* {{{ */
request_started = 1;
php_print_info(0xFFFFFFFF);
php_output_end_all();
- exit_status = (c == '?' && argc > 1 && !strchr(argv[1], c));
+ EG(exit_status) = (c == '?' && argc > 1 && !strchr(argv[1], c));
goto out;
case 'v': /* show php version & quit */
php_printf("PHP %s (%s) (built: %s %s) ( %s)\nCopyright (c) The PHP Group\n%s",
PHP_VERSION, cli_sapi_module.name, __DATE__, __TIME__,
-#if ZTS
+#ifdef ZTS
"ZTS "
#else
"NTS "
@@ -686,7 +671,7 @@ static int do_cli(int argc, char **argv) /* {{{ */
print_extensions();
php_printf("\n");
php_output_end_all();
- exit_status=0;
+ EG(exit_status) = 0;
goto out;
default:
@@ -861,7 +846,7 @@ static int do_cli(int argc, char **argv) /* {{{ */
if (param_error) {
PUTS(param_error);
- exit_status=1;
+ EG(exit_status) = 1;
goto err;
}
@@ -880,7 +865,7 @@ static int do_cli(int argc, char **argv) /* {{{ */
#endif
if (interactive) {
-#if (HAVE_LIBREADLINE || HAVE_LIBEDIT) && !defined(COMPILE_DL_READLINE)
+#if (defined(HAVE_LIBREADLINE) || defined(HAVE_LIBEDIT)) && !defined(COMPILE_DL_READLINE)
printf("Interactive shell\n\n");
#else
printf("Interactive mode enabled\n\n");
@@ -911,7 +896,7 @@ static int do_cli(int argc, char **argv) /* {{{ */
} else {
/* We could handle PHP_MODE_PROCESS_STDIN in a different manner */
/* here but this would make things only more complicated. And it */
- /* is consitent with the way -R works where the stdin file handle*/
+ /* is consistent with the way -R works where the stdin file handle*/
/* is also accessible. */
zend_stream_init_fp(&file_handle, stdin, "Standard input code");
}
@@ -959,15 +944,14 @@ static int do_cli(int argc, char **argv) /* {{{ */
}
if (interactive && cli_shell_callbacks.cli_shell_run) {
- exit_status = cli_shell_callbacks.cli_shell_run();
+ EG(exit_status) = cli_shell_callbacks.cli_shell_run();
} else {
php_execute_script(&file_handle);
- exit_status = EG(exit_status);
}
break;
case PHP_MODE_LINT:
- exit_status = php_lint_script(&file_handle);
- if (exit_status==SUCCESS) {
+ EG(exit_status) = php_lint_script(&file_handle);
+ if (EG(exit_status) == SUCCESS) {
zend_printf("No syntax errors detected in %s\n", file_handle.filename);
} else {
zend_printf("Errors parsing %s\n", file_handle.filename);
@@ -992,9 +976,7 @@ static int do_cli(int argc, char **argv) /* {{{ */
break;
case PHP_MODE_CLI_DIRECT:
cli_register_file_handles();
- if (zend_eval_string_ex(exec_direct, NULL, "Command line code", 1) == FAILURE) {
- exit_status=254;
- }
+ zend_eval_string_ex(exec_direct, NULL, "Command line code", 1);
break;
case PHP_MODE_PROCESS_STDIN:
@@ -1005,10 +987,10 @@ static int do_cli(int argc, char **argv) /* {{{ */
cli_register_file_handles();
- if (exec_begin && zend_eval_string_ex(exec_begin, NULL, "Command line begin code", 1) == FAILURE) {
- exit_status=254;
+ if (exec_begin) {
+ zend_eval_string_ex(exec_begin, NULL, "Command line begin code", 1);
}
- while (exit_status == SUCCESS && (input=php_stream_gets(s_in_process, NULL, 0)) != NULL) {
+ while (EG(exit_status) == SUCCESS && (input=php_stream_gets(s_in_process, NULL, 0)) != NULL) {
len = strlen(input);
while (len > 0 && len-- && (input[len]=='\n' || input[len]=='\r')) {
input[len] = '\0';
@@ -1018,24 +1000,21 @@ static int do_cli(int argc, char **argv) /* {{{ */
ZVAL_LONG(&argi, ++index);
zend_hash_str_update(&EG(symbol_table), "argi", sizeof("argi")-1, &argi);
if (exec_run) {
- if (zend_eval_string_ex(exec_run, NULL, "Command line run code", 1) == FAILURE) {
- exit_status=254;
- }
+ zend_eval_string_ex(exec_run, NULL, "Command line run code", 1);
} else {
if (script_file) {
if (cli_seek_file_begin(&file_handle, script_file) != SUCCESS) {
- exit_status = 1;
+ EG(exit_status) = 1;
} else {
CG(skip_shebang) = 1;
php_execute_script(&file_handle);
- exit_status = EG(exit_status);
}
}
}
efree(input);
}
- if (exec_end && zend_eval_string_ex(exec_end, NULL, "Command line end code", 1) == FAILURE) {
- exit_status=254;
+ if (exec_end) {
+ zend_eval_string_ex(exec_end, NULL, "Command line end code", 1);
}
break;
@@ -1076,15 +1055,14 @@ static int do_cli(int argc, char **argv) /* {{{ */
memset(&execute_data, 0, sizeof(zend_execute_data));
EG(current_execute_data) = &execute_data;
- zend_call_method_with_1_params(&ref, pce, &pce->constructor, "__construct", NULL, &arg);
+ zend_call_known_instance_method_with_1_params(
+ pce->constructor, Z_OBJ(ref), NULL, &arg);
if (EG(exception)) {
- zval tmp, *msg, rv;
-
- ZVAL_OBJ(&tmp, EG(exception));
- msg = zend_read_property(zend_ce_exception, &tmp, "message", sizeof("message")-1, 0, &rv);
+ zval rv;
+ zval *msg = zend_read_property(zend_ce_exception, EG(exception), "message", sizeof("message")-1, 0, &rv);
zend_printf("Exception: %s\n", Z_STRVAL_P(msg));
- zval_ptr_dtor(&tmp);
+ zend_object_release(EG(exception));
EG(exception) = NULL;
} else {
zend_print_zval(&ref, 0);
@@ -1106,7 +1084,7 @@ static int do_cli(int argc, char **argv) /* {{{ */
display_ini_entries(NULL);
} else {
zend_printf("Extension '%s' not present.\n", reflection_what);
- exit_status = 1;
+ EG(exit_status) = 1;
}
} else {
php_info_print_module(module);
@@ -1134,20 +1112,16 @@ out:
if (translated_path) {
free(translated_path);
}
- if (exit_status == 0) {
- exit_status = EG(exit_status);
- }
- return exit_status;
+ return EG(exit_status);
err:
sapi_deactivate();
zend_ini_deactivate();
- exit_status = 1;
+ EG(exit_status) = 1;
goto out;
}
/* }}} */
-/* {{{ main
- */
+/* {{{ main */
#ifdef PHP_CLI_WIN32_NO_CONSOLE
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nShowCmd)
#else
@@ -1189,20 +1163,23 @@ int main(int argc, char *argv[])
cli_sapi_module.additional_functions = additional_functions;
-#if defined(PHP_WIN32) && defined(_DEBUG) && defined(PHP_WIN32_DEBUG_HEAP)
+#if defined(PHP_WIN32) && defined(_DEBUG)
{
- int tmp_flag;
- _CrtSetReportMode(_CRT_WARN, _CRTDBG_MODE_FILE);
- _CrtSetReportFile(_CRT_WARN, _CRTDBG_FILE_STDERR);
- _CrtSetReportMode(_CRT_ERROR, _CRTDBG_MODE_FILE);
- _CrtSetReportFile(_CRT_ERROR, _CRTDBG_FILE_STDERR);
- _CrtSetReportMode(_CRT_ASSERT, _CRTDBG_MODE_FILE);
- _CrtSetReportFile(_CRT_ASSERT, _CRTDBG_FILE_STDERR);
- tmp_flag = _CrtSetDbgFlag(_CRTDBG_REPORT_FLAG);
- tmp_flag |= _CRTDBG_DELAY_FREE_MEM_DF;
- tmp_flag |= _CRTDBG_LEAK_CHECK_DF;
-
- _CrtSetDbgFlag(tmp_flag);
+ char *tmp = getenv("PHP_WIN32_DEBUG_HEAP");
+ if (tmp && zend_atoi(tmp, 0)) {
+ int tmp_flag;
+ _CrtSetReportMode(_CRT_WARN, _CRTDBG_MODE_FILE);
+ _CrtSetReportFile(_CRT_WARN, _CRTDBG_FILE_STDERR);
+ _CrtSetReportMode(_CRT_ERROR, _CRTDBG_MODE_FILE);
+ _CrtSetReportFile(_CRT_ERROR, _CRTDBG_FILE_STDERR);
+ _CrtSetReportMode(_CRT_ASSERT, _CRTDBG_MODE_FILE);
+ _CrtSetReportFile(_CRT_ASSERT, _CRTDBG_FILE_STDERR);
+ tmp_flag = _CrtSetDbgFlag(_CRTDBG_REPORT_FLAG);
+ tmp_flag |= _CRTDBG_DELAY_FREE_MEM_DF;
+ tmp_flag |= _CRTDBG_LEAK_CHECK_DF;
+
+ _CrtSetDbgFlag(tmp_flag);
+ }
}
#endif
diff --git a/sapi/cli/php_cli_process_title.c b/sapi/cli/php_cli_process_title.c
index 1b82104ca6..bd4eea59cd 100644
--- a/sapi/cli/php_cli_process_title.c
+++ b/sapi/cli/php_cli_process_title.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
@@ -24,8 +22,7 @@
#include "php_cli_process_title.h"
#include "ps_title.h"
-/* {{{ proto bool cli_set_process_title(string arg)
- Return a boolean to confirm if the process title was successfully changed or not */
+/* {{{ Return a boolean to confirm if the process title was successfully changed or not */
PHP_FUNCTION(cli_set_process_title)
{
char *title = NULL;
@@ -33,7 +30,7 @@ PHP_FUNCTION(cli_set_process_title)
int rc;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "s", &title, &title_len) == FAILURE) {
- return;
+ RETURN_THROWS();
}
rc = set_ps_title(title);
@@ -46,8 +43,7 @@ PHP_FUNCTION(cli_set_process_title)
}
/* }}} */
-/* {{{ proto string cli_get_process_title()
- Return a string with the current process title. NULL if error. */
+/* {{{ Return a string with the current process title. NULL if error. */
PHP_FUNCTION(cli_get_process_title)
{
int length = 0;
@@ -55,7 +51,7 @@ PHP_FUNCTION(cli_get_process_title)
int rc;
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
rc = get_ps_title(&length, &title);
diff --git a/sapi/cli/php_cli_process_title.h b/sapi/cli/php_cli_process_title.h
index c2fed7b817..c286f401c7 100644
--- a/sapi/cli/php_cli_process_title.h
+++ b/sapi/cli/php_cli_process_title.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
@@ -19,13 +17,6 @@
#ifndef PHP_PS_TITLE_HEADER
#define PHP_PS_TITLE_HEADER
-ZEND_BEGIN_ARG_INFO(arginfo_cli_set_process_title, 0)
- ZEND_ARG_INFO(0, title)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_cli_get_process_title, 0)
-ZEND_END_ARG_INFO()
-
PHP_FUNCTION(cli_set_process_title);
PHP_FUNCTION(cli_get_process_title);
diff --git a/sapi/cli/php_cli_process_title.stub.php b/sapi/cli/php_cli_process_title.stub.php
new file mode 100644
index 0000000000..97dc8b2770
--- /dev/null
+++ b/sapi/cli/php_cli_process_title.stub.php
@@ -0,0 +1,5 @@
+<?php
+
+function cli_set_process_title(string $title): bool {}
+
+function cli_get_process_title(): ?string {}
diff --git a/sapi/cli/php_cli_process_title_arginfo.h b/sapi/cli/php_cli_process_title_arginfo.h
new file mode 100644
index 0000000000..9318640135
--- /dev/null
+++ b/sapi/cli/php_cli_process_title_arginfo.h
@@ -0,0 +1,9 @@
+/* This is a generated file, edit the .stub.php file instead.
+ * Stub hash: ee776e0c54fe4b66a98b3a0203af11c5f3082e38 */
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_cli_set_process_title, 0, 1, _IS_BOOL, 0)
+ ZEND_ARG_TYPE_INFO(0, title, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_cli_get_process_title, 0, 0, IS_STRING, 1)
+ZEND_END_ARG_INFO()
diff --git a/sapi/cli/php_cli_server.c b/sapi/cli/php_cli_server.c
index befa4c65f5..a32b51e3d3 100644
--- a/sapi/cli/php_cli_server.c
+++ b/sapi/cli/php_cli_server.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
@@ -93,9 +91,11 @@
#include "php_http_parser.h"
#include "php_cli_server.h"
+#include "php_cli_server_arginfo.h"
#include "mime_type_map.h"
#include "php_cli_process_title.h"
+#include "php_cli_process_title_arginfo.h"
#define OUTPUT_NOT_CHECKED -1
#define OUTPUT_IS_TTY 1
@@ -215,7 +215,7 @@ static php_cli_server_http_response_status_code_pair template_map[] = {
static int php_cli_server_log_level = 3;
-#if HAVE_UNISTD_H
+#if HAVE_UNISTD_H || defined(PHP_WIN32)
static int php_cli_output_is_tty = OUTPUT_NOT_CHECKED;
#endif
@@ -227,7 +227,7 @@ static void php_cli_server_buffer_append(php_cli_server_buffer *buffer, php_cli_
static void php_cli_server_logf(int type, const char *format, ...);
static void php_cli_server_log_response(php_cli_server_client *client, int status, const char *message);
-ZEND_DECLARE_MODULE_GLOBALS(cli_server);
+ZEND_DECLARE_MODULE_GLOBALS(cli_server)
/* {{{ static char php_cli_server_css[]
* copied from ext/standard/info.c
@@ -263,7 +263,7 @@ int php_cli_server_get_system_time(char *buf) {
gettimeofday(&tv, NULL);
- /* TODO: should be checked for NULL tm/return vaue */
+ /* TODO: should be checked for NULL tm/return value */
php_localtime_r(&tv.tv_sec, &tm);
php_asctime_r(&tm, buf);
return 0;
@@ -390,7 +390,7 @@ PHP_FUNCTION(apache_request_headers) /* {{{ */
zval tmp;
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
client = SG(server_context);
@@ -436,7 +436,7 @@ static void add_response_header(sapi_header_struct *h, zval *return_value) /* {{
PHP_FUNCTION(apache_response_headers) /* {{{ */
{
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
array_init(return_value);
@@ -444,8 +444,7 @@ PHP_FUNCTION(apache_response_headers) /* {{{ */
}
/* }}} */
-/* {{{ cli_server module
- */
+/* {{{ cli_server module */
static void cli_server_init_globals(zend_cli_server_globals *cg)
{
@@ -488,15 +487,12 @@ zend_module_entry cli_server_module_entry = {
};
/* }}} */
-ZEND_BEGIN_ARG_INFO(arginfo_no_args, 0)
-ZEND_END_ARG_INFO()
-
const zend_function_entry server_additional_functions[] = {
- PHP_FE(cli_set_process_title, arginfo_cli_set_process_title)
- PHP_FE(cli_get_process_title, arginfo_cli_get_process_title)
- PHP_FE(apache_request_headers, arginfo_no_args)
- PHP_FE(apache_response_headers, arginfo_no_args)
- PHP_FALIAS(getallheaders, apache_request_headers, arginfo_no_args)
+ PHP_FE(cli_set_process_title, arginfo_cli_set_process_title)
+ PHP_FE(cli_get_process_title, arginfo_cli_get_process_title)
+ PHP_FE(apache_request_headers, arginfo_apache_request_headers)
+ PHP_FE(apache_response_headers, arginfo_apache_response_headers)
+ PHP_FALIAS(getallheaders, apache_request_headers, arginfo_getallheaders)
PHP_FE_END
};
@@ -756,7 +752,7 @@ static void sapi_cli_server_register_variables(zval *track_vars_array) /* {{{ */
zend_hash_apply_with_arguments(&client->request.headers, (apply_func_args_t)sapi_cli_server_register_entry_cb, 1, track_vars_array);
} /* }}} */
-static void sapi_cli_server_log_write(int type, char *msg) /* {{{ */
+static void sapi_cli_server_log_write(int type, const char *msg) /* {{{ */
{
char buf[52];
@@ -785,13 +781,12 @@ static void sapi_cli_server_log_write(int type, char *msg) /* {{{ */
#endif
} /* }}} */
-static void sapi_cli_server_log_message(char *msg, int syslog_type_int) /* {{{ */
+static void sapi_cli_server_log_message(const char *msg, int syslog_type_int) /* {{{ */
{
sapi_cli_server_log_write(PHP_CLI_SERVER_LOG_MESSAGE, msg);
} /* }}} */
-/* {{{ sapi_module_struct cli_server_sapi_module
- */
+/* {{{ sapi_module_struct cli_server_sapi_module */
sapi_module_struct cli_server_sapi_module = {
"cli-server", /* name */
"Built-in HTTP server", /* pretty name */
@@ -1165,6 +1160,14 @@ static int php_cli_is_output_tty() /* {{{ */
}
return php_cli_output_is_tty;
} /* }}} */
+#elif defined(PHP_WIN32)
+static int php_cli_is_output_tty() /* {{{ */
+{
+ if (php_cli_output_is_tty == OUTPUT_NOT_CHECKED) {
+ php_cli_output_is_tty = php_win32_console_fileno_is_console(STDOUT_FILENO) && php_win32_console_fileno_has_vt100(STDOUT_FILENO);
+ }
+ return php_cli_output_is_tty;
+} /* }}} */
#endif
static void php_cli_server_log_response(php_cli_server_client *client, int status, const char *message) /* {{{ */
@@ -1174,23 +1177,17 @@ static void php_cli_server_log_response(php_cli_server_client *client, int statu
zend_bool append_error_message = 0;
if (PG(last_error_message)) {
- switch (PG(last_error_type)) {
- case E_ERROR:
- case E_CORE_ERROR:
- case E_COMPILE_ERROR:
- case E_USER_ERROR:
- case E_PARSE:
- if (status == 200) {
- /* the status code isn't changed by a fatal error, so fake it */
- effective_status = 500;
- }
+ if (PG(last_error_type) & E_FATAL_ERRORS) {
+ if (status == 200) {
+ /* the status code isn't changed by a fatal error, so fake it */
+ effective_status = 500;
+ }
- append_error_message = 1;
- break;
+ append_error_message = 1;
}
}
-#if HAVE_UNISTD_H
+#if HAVE_UNISTD_H || defined(PHP_WIN32)
if (CLI_SERVER_G(color) && php_cli_is_output_tty() == OUTPUT_IS_TTY) {
if (effective_status >= 500) {
/* server error: red */
@@ -1222,7 +1219,8 @@ static void php_cli_server_log_response(php_cli_server_client *client, int statu
/* error */
if (append_error_message) {
- spprintf(&error_buf, 0, " - %s in %s on line %d", PG(last_error_message), PG(last_error_file), PG(last_error_lineno));
+ spprintf(&error_buf, 0, " - %s in %s on line %d",
+ ZSTR_VAL(PG(last_error_message)), PG(last_error_file), PG(last_error_lineno));
if (!error_buf) {
efree(basic_buf);
if (message) {
@@ -1840,7 +1838,7 @@ static int php_cli_server_client_read_request(php_cli_server_client *client, cha
nbytes_consumed = php_http_parser_execute(&client->parser, &settings, buf, nbytes_read);
if (nbytes_consumed != (size_t)nbytes_read) {
if (php_cli_server_log_level >= PHP_CLI_SERVER_LOG_ERROR) {
- if (buf[0] & 0x80 /* SSLv2 */ || buf[0] == 0x16 /* SSLv3/TLSv1 */) {
+ if ((buf[0] & 0x80) /* SSLv2 */ || buf[0] == 0x16 /* SSLv3/TLSv1 */) {
*errstr = estrdup("Unsupported SSL request");
} else {
*errstr = estrdup("Malformed HTTP request");
@@ -1986,7 +1984,7 @@ static int php_cli_server_send_error_page(php_cli_server *server, php_cli_server
php_cli_server_content_sender_ctor(&client->content_sender);
client->content_sender_initialized = 1;
- escaped_request_uri = php_escape_html_entities_ex((unsigned char *)client->request.request_uri, client->request.request_uri_len, 0, ENT_QUOTES, NULL, 0);
+ escaped_request_uri = php_escape_html_entities_ex((const unsigned char *) client->request.request_uri, client->request.request_uri_len, 0, ENT_QUOTES, NULL, /* double_encode */ 0, /* quiet */ 0);
{
static const char prologue_template[] = "<!doctype html><html><head><title>%d %s</title>";
@@ -2210,8 +2208,6 @@ static int php_cli_server_dispatch_router(php_cli_server *server, php_cli_server
decline = Z_TYPE(retval) == IS_FALSE;
zval_ptr_dtor(&retval);
}
- } else {
- decline = 1;
}
} zend_end_try();
@@ -2357,6 +2353,65 @@ static void php_cli_server_client_dtor_wrapper(zval *zv) /* {{{ */
pefree(p, 1);
} /* }}} */
+/**
+ * Parse the host and port portions of an address specifier in
+ * one of the following forms:
+ * - hostOrIP:port
+ * - [hostOrIP]:port
+ */
+static char *php_cli_server_parse_addr(const char *addr, int *pport) {
+ const char *p, *end;
+ long port;
+
+ if (addr[0] == '[') {
+ /* Encapsulated [hostOrIP]:port */
+ const char *start = addr + 1;
+ end = strchr(start, ']');
+ if (!end) {
+ /* No ending ] delimiter to match [ */
+ return NULL;
+ }
+
+ p = end + 1;
+ if (*p != ':') {
+ /* Invalid char following address/missing port */
+ return NULL;
+ }
+
+ port = strtol(p + 1, (char**)&p, 10);
+ if (p && *p) {
+ /* Non-numeric in port */
+ return NULL;
+ }
+ if (port < 0 || port > 65535) {
+ /* Invalid port */
+ return NULL;
+ }
+
+ /* Full [hostOrIP]:port provided */
+ *pport = (int)port;
+ return pestrndup(start, end - start, 1);
+ }
+
+ end = strchr(addr, ':');
+ if (!end) {
+ /* Missing port */
+ return NULL;
+ }
+
+ port = strtol(end + 1, (char**)&p, 10);
+ if (p && *p) {
+ /* Non-numeric port */
+ return NULL;
+ }
+ if (port < 0 || port > 65535) {
+ /* Invalid port */
+ return NULL;
+ }
+ *pport = (int)port;
+ return pestrndup(addr, end - addr, 1);
+}
+
static int php_cli_server_ctor(php_cli_server *server, const char *addr, const char *document_root, const char *router) /* {{{ */
{
int retval = SUCCESS;
@@ -2367,40 +2422,9 @@ static int php_cli_server_ctor(php_cli_server *server, const char *addr, const c
int err = 0;
int port = 3000;
php_socket_t server_sock = SOCK_ERR;
- char *p = NULL;
- if (addr[0] == '[') {
- host = pestrdup(addr + 1, 1);
- if (!host) {
- return FAILURE;
- }
- p = strchr(host, ']');
- if (p) {
- *p++ = '\0';
- if (*p == ':') {
- port = strtol(p + 1, &p, 10);
- if (port <= 0 || port > 65535) {
- p = NULL;
- }
- } else if (*p != '\0') {
- p = NULL;
- }
- }
- } else {
- host = pestrdup(addr, 1);
- if (!host) {
- return FAILURE;
- }
- p = strchr(host, ':');
- if (p) {
- *p++ = '\0';
- port = strtol(p, &p, 10);
- if (port <= 0 || port > 65535) {
- p = NULL;
- }
- }
- }
- if (!p) {
+ host = php_cli_server_parse_addr(addr, &port);
+ if (!host) {
fprintf(stderr, "Invalid address: %s\n", addr);
retval = FAILURE;
goto out;
@@ -2724,10 +2748,12 @@ int do_cli_server(int argc, char **argv) /* {{{ */
sapi_module.phpinfo_as_text = 0;
{
+ zend_bool ipv6 = strchr(server.host, ':');
php_cli_server_logf(
PHP_CLI_SERVER_LOG_PROCESS,
- "PHP %s Development Server (http://%s) started",
- PHP_VERSION, server_bind_address);
+ "PHP %s Development Server (http://%s%s%s:%d) started",
+ PHP_VERSION, ipv6 ? "[" : "", server.host,
+ ipv6 ? "]" : "", server.port);
}
#if defined(SIGINT)
diff --git a/sapi/cli/php_cli_server.h b/sapi/cli/php_cli_server.h
index 4d57f1b922..d78211a8fd 100644
--- a/sapi/cli/php_cli_server.h
+++ b/sapi/cli/php_cli_server.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/sapi/cli/php_cli_server.stub.php b/sapi/cli/php_cli_server.stub.php
new file mode 100644
index 0000000000..59706ba91f
--- /dev/null
+++ b/sapi/cli/php_cli_server.stub.php
@@ -0,0 +1,7 @@
+<?php
+
+function apache_request_headers(): array {}
+
+function apache_response_headers(): array {}
+
+function getallheaders(): array {}
diff --git a/sapi/cli/php_cli_server_arginfo.h b/sapi/cli/php_cli_server_arginfo.h
new file mode 100644
index 0000000000..eb113aeaa0
--- /dev/null
+++ b/sapi/cli/php_cli_server_arginfo.h
@@ -0,0 +1,9 @@
+/* This is a generated file, edit the .stub.php file instead.
+ * Stub hash: 60cd531d36a34fe7c51982e9ec40b45d2a2a4ce7 */
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_apache_request_headers, 0, 0, IS_ARRAY, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_apache_response_headers arginfo_apache_request_headers
+
+#define arginfo_getallheaders arginfo_apache_request_headers
diff --git a/sapi/cli/php_http_parser.c b/sapi/cli/php_http_parser.c
index 63769c15ac..bb1c4924a0 100644
--- a/sapi/cli/php_http_parser.c
+++ b/sapi/cli/php_http_parser.c
@@ -244,7 +244,7 @@ enum flags
#define start_state (parser->type == PHP_HTTP_REQUEST ? s_start_req : s_start_res)
-#if HTTP_PARSER_STRICT
+#ifdef HTTP_PARSER_STRICT
# define STRICT_CHECK(cond) if (cond) goto error
# define NEW_MESSAGE() (http_should_keep_alive(parser) ? start_state : s_dead)
#else
@@ -1315,7 +1315,7 @@ size_t php_http_parser_execute (php_http_parser *parser,
nread = 0;
- if (parser->flags & F_UPGRADE || parser->method == PHP_HTTP_CONNECT) {
+ if ((parser->flags & F_UPGRADE) || parser->method == PHP_HTTP_CONNECT) {
parser->upgrade = 1;
}
diff --git a/sapi/cli/php_http_parser.h b/sapi/cli/php_http_parser.h
index d2fa69b757..8e97013d07 100644
--- a/sapi/cli/php_http_parser.h
+++ b/sapi/cli/php_http_parser.h
@@ -46,7 +46,7 @@ extern "C" {
#endif
-/* Maximium header size allowed */
+/* Maximum header size allowed */
#define PHP_HTTP_MAX_HEADER_SIZE (80*1024)
diff --git a/sapi/cli/ps_title.h b/sapi/cli/ps_title.h
index 540609c85d..e8da2a936b 100644
--- a/sapi/cli/ps_title.h
+++ b/sapi/cli/ps_title.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/sapi/cli/tests/002-unix.phpt b/sapi/cli/tests/002-unix.phpt
index 2be668f188..8eb4e47b6e 100644
--- a/sapi/cli/tests/002-unix.phpt
+++ b/sapi/cli/tests/002-unix.phpt
@@ -4,7 +4,7 @@ running code with -r
<?php
include "skipif.inc";
if (substr(PHP_OS, 0, 3) == 'WIN') {
- die ("skip not for Windows");
+ die ("skip not for Windows");
}
?>
--FILE--
diff --git a/sapi/cli/tests/003-2.phpt b/sapi/cli/tests/003-2.phpt
index 6b8957e644..3a88b2a9a3 100644
--- a/sapi/cli/tests/003-2.phpt
+++ b/sapi/cli/tests/003-2.phpt
@@ -4,7 +4,7 @@ defining INI options with -d (as 2nd arg)
<?php
include "skipif.inc";
if (substr(PHP_OS, 0, 3) == 'WIN') {
- die ("skip not for Windows");
+ die ("skip not for Windows");
}
?>
--FILE--
@@ -16,10 +16,8 @@ var_dump(`"$php" -nd max_execution_time=111 -r 'var_dump(ini_get("max_execution_
var_dump(`"$php" -nd max_execution_time=500 -r 'var_dump(ini_get("max_execution_time"));'`);
?>
-===DONE===
--EXPECT--
string(16) "string(3) "111"
"
string(16) "string(3) "500"
"
-===DONE===
diff --git a/sapi/cli/tests/003.phpt b/sapi/cli/tests/003.phpt
index 6584e2c7be..63e812d4a7 100644
--- a/sapi/cli/tests/003.phpt
+++ b/sapi/cli/tests/003.phpt
@@ -4,7 +4,7 @@ defining INI options with -d
<?php
include "skipif.inc";
if (substr(PHP_OS, 0, 3) == 'WIN') {
- die ("skip not for Windows");
+ die ("skip not for Windows");
}
?>
--FILE--
diff --git a/sapi/cli/tests/004.phpt b/sapi/cli/tests/004.phpt
index 78158ba70a..094161a8fa 100644
--- a/sapi/cli/tests/004.phpt
+++ b/sapi/cli/tests/004.phpt
@@ -20,11 +20,12 @@ string(45) "Exception: Function unknown() does not exist
"
string(42) "Exception: Function echo() does not exist
"
-string(119) "Function [ <internal:standard> function phpinfo ] {
+string(155) "Function [ <internal:standard> function phpinfo ] {
- Parameters [1] {
- Parameter #0 [ <optional> $what ]
+ Parameter #0 [ <optional> int $flags = INFO_ALL ]
}
+ - Return [ bool ]
}
"
diff --git a/sapi/cli/tests/005.phpt b/sapi/cli/tests/005.phpt
index 0a366b6975..990ea01327 100644
--- a/sapi/cli/tests/005.phpt
+++ b/sapi/cli/tests/005.phpt
@@ -16,7 +16,7 @@ var_dump(`"$php" -n --rc exception`);
echo "Done\n";
?>
--EXPECT--
-string(40) "Exception: Class unknown does not exist
+string(42) "Exception: Class "unknown" does not exist
"
string(183) "Class [ <internal:Core> class stdClass ] {
@@ -37,7 +37,7 @@ string(183) "Class [ <internal:Core> class stdClass ] {
}
"
-string(1607) "Class [ <internal:Core> class Exception implements Throwable ] {
+string(2194) "Class [ <internal:Core> class Exception implements Throwable, Stringable ] {
- Constants [0] {
}
@@ -49,53 +49,91 @@ string(1607) "Class [ <internal:Core> class Exception implements Throwable ] {
}
- Properties [7] {
- Property [ <default> protected $message ]
- Property [ <default> private $string ]
- Property [ <default> protected $code ]
- Property [ <default> protected $file ]
- Property [ <default> protected $line ]
- Property [ <default> private $trace ]
- Property [ <default> private $previous ]
+ Property [ protected $message = '' ]
+ Property [ private $string = '' ]
+ Property [ protected $code = 0 ]
+ Property [ protected $file = NULL ]
+ Property [ protected $line = NULL ]
+ Property [ private array $trace = Array ]
+ Property [ private ?Throwable $previous = NULL ]
}
- Methods [11] {
Method [ <internal:Core> final private method __clone ] {
+
+ - Parameters [0] {
+ }
+ - Return [ void ]
}
Method [ <internal:Core, ctor> public method __construct ] {
- Parameters [3] {
- Parameter #0 [ <optional> $message ]
- Parameter #1 [ <optional> $code ]
- Parameter #2 [ <optional> $previous ]
+ Parameter #0 [ <optional> string $message = "" ]
+ Parameter #1 [ <optional> int $code = 0 ]
+ Parameter #2 [ <optional> ?Throwable $previous = null ]
}
}
Method [ <internal:Core> public method __wakeup ] {
+
+ - Parameters [0] {
+ }
}
Method [ <internal:Core, prototype Throwable> final public method getMessage ] {
+
+ - Parameters [0] {
+ }
+ - Return [ string ]
}
Method [ <internal:Core, prototype Throwable> final public method getCode ] {
+
+ - Parameters [0] {
+ }
}
Method [ <internal:Core, prototype Throwable> final public method getFile ] {
+
+ - Parameters [0] {
+ }
+ - Return [ string ]
}
Method [ <internal:Core, prototype Throwable> final public method getLine ] {
+
+ - Parameters [0] {
+ }
+ - Return [ int ]
}
Method [ <internal:Core, prototype Throwable> final public method getTrace ] {
+
+ - Parameters [0] {
+ }
+ - Return [ array ]
}
Method [ <internal:Core, prototype Throwable> final public method getPrevious ] {
+
+ - Parameters [0] {
+ }
+ - Return [ ?Throwable ]
}
Method [ <internal:Core, prototype Throwable> final public method getTraceAsString ] {
+
+ - Parameters [0] {
+ }
+ - Return [ string ]
}
- Method [ <internal:Core, prototype Throwable> public method __toString ] {
+ Method [ <internal:Core, prototype Stringable> public method __toString ] {
+
+ - Parameters [0] {
+ }
+ - Return [ string ]
}
}
}
diff --git a/sapi/cli/tests/006.phpt b/sapi/cli/tests/006.phpt
index 54d1a96a88..3a55f99844 100644
--- a/sapi/cli/tests/006.phpt
+++ b/sapi/cli/tests/006.phpt
@@ -4,10 +4,10 @@ show information about extension
<?php
include "skipif.inc";
if (!extension_loaded("session")) {
- die("skip session extension required");
+ die("skip session extension required");
}
if (PCRE_JIT_SUPPORT == false) {
- die ("skip not pcre jit support builtin");
+ die ("skip not pcre jit support builtin");
}
?>
--INI--
@@ -24,9 +24,9 @@ var_dump(`$php -n --re pcre`);
echo "Done\n";
?>
--EXPECTF--
-string(44) "Exception: Extension unknown does not exist
+string(46) "Exception: Extension "unknown" does not exist
"
-string(37) "Exception: Extension does not exist
+string(39) "Exception: Extension "" does not exist
"
string(%d) "Extension [ <persistent> extension #%d pcre version %s ] {
@@ -68,92 +68,108 @@ string(%d) "Extension [ <persistent> extension #%d pcre version %s ] {
Function [ <internal:pcre> function preg_match ] {
- Parameters [5] {
- Parameter #0 [ <required> $pattern ]
- Parameter #1 [ <required> $subject ]
- Parameter #2 [ <optional> &$subpatterns ]
- Parameter #3 [ <optional> $flags ]
- Parameter #4 [ <optional> $offset ]
+ Parameter #0 [ <required> string $pattern ]
+ Parameter #1 [ <required> string $subject ]
+ Parameter #2 [ <optional> &$matches = null ]
+ Parameter #3 [ <optional> int $flags = 0 ]
+ Parameter #4 [ <optional> int $offset = 0 ]
}
+ - Return [ int|false ]
}
Function [ <internal:pcre> function preg_match_all ] {
- Parameters [5] {
- Parameter #0 [ <required> $pattern ]
- Parameter #1 [ <required> $subject ]
- Parameter #2 [ <optional> &$subpatterns ]
- Parameter #3 [ <optional> $flags ]
- Parameter #4 [ <optional> $offset ]
+ Parameter #0 [ <required> string $pattern ]
+ Parameter #1 [ <required> string $subject ]
+ Parameter #2 [ <optional> &$matches = null ]
+ Parameter #3 [ <optional> int $flags = 0 ]
+ Parameter #4 [ <optional> int $offset = 0 ]
}
+ - Return [ int|false|null ]
}
Function [ <internal:pcre> function preg_replace ] {
- Parameters [5] {
- Parameter #0 [ <required> $regex ]
- Parameter #1 [ <required> $replace ]
- Parameter #2 [ <required> $subject ]
- Parameter #3 [ <optional> $limit ]
- Parameter #4 [ <optional> &$count ]
+ Parameter #0 [ <required> array|string $pattern ]
+ Parameter #1 [ <required> array|string $replacement ]
+ Parameter #2 [ <required> array|string $subject ]
+ Parameter #3 [ <optional> int $limit = -1 ]
+ Parameter #4 [ <optional> &$count = null ]
}
+ - Return [ array|string|null ]
}
- Function [ <internal:pcre> function preg_replace_callback ] {
+ Function [ <internal:pcre> function preg_filter ] {
- - Parameters [6] {
- Parameter #0 [ <required> $regex ]
- Parameter #1 [ <required> $callback ]
- Parameter #2 [ <required> $subject ]
- Parameter #3 [ <optional> $limit ]
- Parameter #4 [ <optional> &$count ]
- Parameter #5 [ <optional> $flags ]
+ - Parameters [5] {
+ Parameter #0 [ <required> array|string $pattern ]
+ Parameter #1 [ <required> array|string $replacement ]
+ Parameter #2 [ <required> array|string $subject ]
+ Parameter #3 [ <optional> int $limit = -1 ]
+ Parameter #4 [ <optional> &$count = null ]
}
+ - Return [ array|string|null ]
}
- Function [ <internal:pcre> function preg_replace_callback_array ] {
+ Function [ <internal:pcre> function preg_replace_callback ] {
- - Parameters [5] {
- Parameter #0 [ <required> $pattern ]
- Parameter #1 [ <required> $subject ]
- Parameter #2 [ <optional> $limit ]
- Parameter #3 [ <optional> &$count ]
- Parameter #4 [ <optional> $flags ]
+ - Parameters [6] {
+ Parameter #0 [ <required> array|string $pattern ]
+ Parameter #1 [ <required> callable $callback ]
+ Parameter #2 [ <required> array|string $subject ]
+ Parameter #3 [ <optional> int $limit = -1 ]
+ Parameter #4 [ <optional> &$count = null ]
+ Parameter #5 [ <optional> int $flags = 0 ]
}
+ - Return [ array|string|null ]
}
- Function [ <internal:pcre> function preg_filter ] {
+ Function [ <internal:pcre> function preg_replace_callback_array ] {
- Parameters [5] {
- Parameter #0 [ <required> $regex ]
- Parameter #1 [ <required> $replace ]
- Parameter #2 [ <required> $subject ]
- Parameter #3 [ <optional> $limit ]
- Parameter #4 [ <optional> &$count ]
+ Parameter #0 [ <required> array $pattern ]
+ Parameter #1 [ <required> array|string $subject ]
+ Parameter #2 [ <optional> int $limit = -1 ]
+ Parameter #3 [ <optional> &$count = null ]
+ Parameter #4 [ <optional> int $flags = 0 ]
}
+ - Return [ array|string|null ]
}
Function [ <internal:pcre> function preg_split ] {
- Parameters [4] {
- Parameter #0 [ <required> $pattern ]
- Parameter #1 [ <required> $subject ]
- Parameter #2 [ <optional> $limit ]
- Parameter #3 [ <optional> $flags ]
+ Parameter #0 [ <required> string $pattern ]
+ Parameter #1 [ <required> string $subject ]
+ Parameter #2 [ <optional> int $limit = -1 ]
+ Parameter #3 [ <optional> int $flags = 0 ]
}
+ - Return [ array|false ]
}
Function [ <internal:pcre> function preg_quote ] {
- Parameters [2] {
- Parameter #0 [ <required> $str ]
- Parameter #1 [ <optional> $delim_char ]
+ Parameter #0 [ <required> string $str ]
+ Parameter #1 [ <optional> ?string $delimiter = null ]
}
+ - Return [ string ]
}
Function [ <internal:pcre> function preg_grep ] {
- Parameters [3] {
- Parameter #0 [ <required> $regex ]
- Parameter #1 [ <required> $input ]
- Parameter #2 [ <optional> $flags ]
+ Parameter #0 [ <required> string $pattern ]
+ Parameter #1 [ <required> array $array ]
+ Parameter #2 [ <optional> int $flags = 0 ]
}
+ - Return [ array|false ]
}
Function [ <internal:pcre> function preg_last_error ] {
- Parameters [0] {
}
+ - Return [ int ]
+ }
+ Function [ <internal:pcre> function preg_last_error_msg ] {
+
+ - Parameters [0] {
+ }
+ - Return [ string ]
}
}
}
diff --git a/sapi/cli/tests/007.phpt b/sapi/cli/tests/007.phpt
index 51858bae48..73faa33423 100644
--- a/sapi/cli/tests/007.phpt
+++ b/sapi/cli/tests/007.phpt
@@ -4,7 +4,7 @@ strip comments and whitespace with -w
<?php
include "skipif.inc";
if (substr(PHP_OS, 0, 3) == 'WIN') {
- die ("skip not for Windows");
+ die ("skip not for Windows");
}
?>
--FILE--
@@ -18,12 +18,12 @@ $code ='
/* some test script */
class test { /* {{{ */
- public $var = "test"; //test var
-#perl style comment
- private $pri; /* private attr */
+ public $var = "test"; //test var
+#perl style comment
+ private $pri; /* private attr */
- function foo(/* void */) {
- }
+ function foo(/* void */) {
+ }
}
/* }}} */
diff --git a/sapi/cli/tests/008.phpt b/sapi/cli/tests/008.phpt
index fb8518535a..c3acf6b863 100644
--- a/sapi/cli/tests/008.phpt
+++ b/sapi/cli/tests/008.phpt
@@ -4,7 +4,7 @@ execute a file with -f
<?php
include "skipif.inc";
if (substr(PHP_OS, 0, 3) == 'WIN') {
- die ("skip not for Windows");
+ die ("skip not for Windows");
}
?>
--FILE--
@@ -17,7 +17,7 @@ $code ='
<?php
class test {
- private $pri;
+ private $pri;
}
var_dump(test::$pri);
diff --git a/sapi/cli/tests/010-2.phpt b/sapi/cli/tests/010-2.phpt
index af998351bb..1780c3ffd6 100644
--- a/sapi/cli/tests/010-2.phpt
+++ b/sapi/cli/tests/010-2.phpt
@@ -4,7 +4,7 @@ executing a code with -R
<?php
include "skipif.inc";
if (substr(PHP_OS, 0, 3) == 'WIN') {
- die ("skip not for Windows");
+ die ("skip not for Windows");
}
?>
--FILE--
diff --git a/sapi/cli/tests/010.phpt b/sapi/cli/tests/010.phpt
index c316e213e3..d06007bd55 100644
--- a/sapi/cli/tests/010.phpt
+++ b/sapi/cli/tests/010.phpt
@@ -4,7 +4,7 @@ executing a file with -F
<?php
include "skipif.inc";
if (substr(PHP_OS, 0, 3) == 'WIN') {
- die ("skip not for Windows");
+ die ("skip not for Windows");
}
?>
--FILE--
@@ -32,7 +32,6 @@ file_put_contents($filename_txt, $txt);
var_dump(`cat "$filename_txt" | "$php" -n -F "$filename"`);
?>
-===DONE===
--CLEAN--
<?php
@unlink(__DIR__."/010.test.php");
@@ -43,4 +42,3 @@ string(25) "
string(10) "test
hello"
"
-===DONE===
diff --git a/sapi/cli/tests/011.phpt b/sapi/cli/tests/011.phpt
index 3ada7c53bf..24eb9fc2df 100644
--- a/sapi/cli/tests/011.phpt
+++ b/sapi/cli/tests/011.phpt
@@ -15,7 +15,7 @@ $code = '
$test = "var";
class test {
- private $var;
+ private $var;
}
echo test::$var;
@@ -31,8 +31,8 @@ var_dump(`"$php" -n -l some.unknown`);
$code = '
<?php
-class test
- private $var;
+class test
+ private $var;
}
?>
diff --git a/sapi/cli/tests/013.phpt b/sapi/cli/tests/013.phpt
index 3ca2ba833c..0684b8d057 100644
--- a/sapi/cli/tests/013.phpt
+++ b/sapi/cli/tests/013.phpt
@@ -4,7 +4,7 @@ running PHP code before and after processing input lines with -B and -E
<?php
include "skipif.inc";
if (substr(PHP_OS, 0, 3) == 'WIN') {
- die ("skip not for Windows");
+ die ("skip not for Windows");
}
?>
--FILE--
diff --git a/sapi/cli/tests/014.phpt b/sapi/cli/tests/014.phpt
index 1ee72e05f6..4a458d2ae7 100644
--- a/sapi/cli/tests/014.phpt
+++ b/sapi/cli/tests/014.phpt
@@ -13,12 +13,12 @@ $code = '
$test = "var"; //var
/* test class */
class test {
- private $var = array();
+ private $var = array();
- public static function foo(Test $arg) {
- echo "hello";
- var_dump($this);
- }
+ public static function foo(Test $arg) {
+ echo "hello";
+ var_dump($this);
+ }
}
$o = new test;
diff --git a/sapi/cli/tests/015.phpt b/sapi/cli/tests/015.phpt
index 5a5e6c5190..b64a5f0d50 100644
--- a/sapi/cli/tests/015.phpt
+++ b/sapi/cli/tests/015.phpt
@@ -4,7 +4,7 @@ CLI long options
<?php
include "skipif.inc";
if (substr(PHP_OS, 0, 3) == 'WIN') {
- die ("skip not for Windows");
+ die ("skip not for Windows");
}
?>
--FILE--
diff --git a/sapi/cli/tests/016.phpt b/sapi/cli/tests/016.phpt
index ea735d8d6e..bf23affe81 100644
--- a/sapi/cli/tests/016.phpt
+++ b/sapi/cli/tests/016.phpt
@@ -4,7 +4,7 @@ CLI -a and readline
<?php
include "skipif.inc";
if (!extension_loaded('readline') || readline_info('done') === NULL) {
- die ("skip need readline support");
+ die ("skip need readline support");
}
?>
--FILE--
@@ -52,9 +52,9 @@ a_function_w );
EOT;
foreach ($codes as $key => $code) {
- echo "\n--------------\nSnippet no. $key:\n--------------\n";
- $code = escapeshellarg($code);
- echo `echo $code | "$php" -a`, "\n";
+ echo "\n--------------\nSnippet no. $key:\n--------------\n";
+ $code = escapeshellarg($code);
+ echo `echo $code | "$php" -a`, "\n";
}
echo "\nDone\n";
diff --git a/sapi/cli/tests/017.phpt b/sapi/cli/tests/017.phpt
index 684e41691e..344daa7408 100644
--- a/sapi/cli/tests/017.phpt
+++ b/sapi/cli/tests/017.phpt
@@ -4,7 +4,7 @@ CLI -a and libedit
<?php
include "skipif.inc";
if (!extension_loaded('readline') || readline_info('done') !== NULL) {
- die ("skip need readline support using libedit");
+ die ("skip need readline support using libedit");
}
if(substr(PHP_OS, 0, 3) == 'WIN' ) {
die('skip not for Windows');
@@ -52,9 +52,9 @@ a_function_w );
EOT;
foreach ($codes as $key => $code) {
- echo "\n--------------\nSnippet no. $key:\n--------------\n";
- $code = escapeshellarg($code);
- echo `echo $code | "$php" -a`, "\n";
+ echo "\n--------------\nSnippet no. $key:\n--------------\n";
+ $code = escapeshellarg($code);
+ echo `echo $code | "$php" -a`, "\n";
}
echo "\nDone\n";
@@ -103,7 +103,7 @@ Snippet no. 5:
Interactive shell
-Parse error: syntax error, unexpected ')' in php shell code on line 1
+Parse error: Unmatched ')' in php shell code on line 1
Done
diff --git a/sapi/cli/tests/018.phpt b/sapi/cli/tests/018.phpt
index 9ebe4faa87..2aadfef62a 100644
--- a/sapi/cli/tests/018.phpt
+++ b/sapi/cli/tests/018.phpt
@@ -4,7 +4,7 @@ CLI php -m
<?php
include "skipif.inc";
if (substr(PHP_OS, 0, 3) == 'WIN') {
- die ("skip not for Windows");
+ die ("skip not for Windows");
}
?>
--FILE--
diff --git a/sapi/cli/tests/019.phpt b/sapi/cli/tests/019.phpt
index 2b8c0f007e..e8404d835e 100644
--- a/sapi/cli/tests/019.phpt
+++ b/sapi/cli/tests/019.phpt
@@ -4,7 +4,7 @@ CLI php -i
<?php
include "skipif.inc";
if (substr(PHP_OS, 0, 3) == 'WIN') {
- die ("skip not for Windows");
+ die ("skip not for Windows");
}
?>
--FILE--
diff --git a/sapi/cli/tests/020.phpt b/sapi/cli/tests/020.phpt
index 001cf62a38..fb7bcb4e7b 100644
--- a/sapi/cli/tests/020.phpt
+++ b/sapi/cli/tests/020.phpt
@@ -4,7 +4,7 @@ CLI php --ri
<?php
include "skipif.inc";
if (substr(PHP_OS, 0, 3) == 'WIN') {
- die ("skip not for Windows");
+ die ("skip not for Windows");
}
?>
--FILE--
diff --git a/sapi/cli/tests/021.phpt b/sapi/cli/tests/021.phpt
index a5d97c326d..837f64109d 100644
--- a/sapi/cli/tests/021.phpt
+++ b/sapi/cli/tests/021.phpt
@@ -4,7 +4,7 @@ CLI shell shebang
<?php
include 'skipif.inc';
if (substr(PHP_OS, 0, 3) == 'WIN') {
- die ("skip not for Windows");
+ die ("skip not for Windows");
}
if (strlen("#!".getenv('TEST_PHP_EXECUTABLE')) > 127) {
diff --git a/sapi/cli/tests/022.phpt b/sapi/cli/tests/022.phpt
index 3b97016b58..40c2265351 100644
--- a/sapi/cli/tests/022.phpt
+++ b/sapi/cli/tests/022.phpt
@@ -11,23 +11,23 @@ $php = getenv("TEST_PHP_EXECUTABLE");
$socket_file = tempnam(sys_get_temp_dir(), pathinfo(__FILE__, PATHINFO_FILENAME) . '.sock');
$test_file = __DIR__ . '/' . pathinfo(__FILE__, PATHINFO_FILENAME) . '.inc';
if (file_exists($socket_file)) {
- unlink($socket_file);
+ unlink($socket_file);
}
$socket = stream_socket_server('unix://' . $socket_file);
var_dump($socket);
if (!$socket) {
- exit(1);
+ exit(1);
}
$desc = array(
- 0 => $socket,
- 1 => STDOUT,
- 2 => STDERR,
+ 0 => $socket,
+ 1 => STDOUT,
+ 2 => STDERR,
);
$pipes = array();
$proc = proc_open("$php -n " . escapeshellarg($test_file), $desc, $pipes);
var_dump($proc);
if (!$proc) {
- exit(1);
+ exit(1);
}
$client_socket = stream_socket_client('unix://' . $socket_file);
diff --git a/sapi/cli/tests/023.phpt b/sapi/cli/tests/023.phpt
index 09b256a9af..4f827ff387 100644
--- a/sapi/cli/tests/023.phpt
+++ b/sapi/cli/tests/023.phpt
@@ -22,14 +22,14 @@ memory_limit = 70M
INI
);
$desc = array(
- 0 => array("pipe", "r"),
- 1 => array("pipe", "w"),
- 2 => array("pipe", "w"),
+ 0 => array("pipe", "r"),
+ 1 => array("pipe", "w"),
+ 2 => array("pipe", "w"),
);
$pipes = array();
$proc = proc_open("$php -c $ini_file -r 'echo ini_get(\"memory_limit\");'", $desc, $pipes);
if (!$proc) {
- exit(1);
+ exit(1);
}
var_dump(stream_get_contents($pipes[1]));
var_dump(stream_get_contents($pipes[2]));
diff --git a/sapi/cli/tests/argv_mb.phpt b/sapi/cli/tests/argv_mb.phpt
index 868b1a857f..5ed5cef343 100644
--- a/sapi/cli/tests/argv_mb.phpt
+++ b/sapi/cli/tests/argv_mb.phpt
@@ -17,7 +17,6 @@ var_dump(`$php -n $argv_fl 多字节字符串 マルãƒãƒã‚¤ãƒˆæ–‡å­—列 мно
@unlink($argv_fl);
?>
-==DONE==
--EXPECTF--
string(%d) "array(%d) {
[0]=>
@@ -32,4 +31,3 @@ string(%d) "array(%d) {
string(15) "flerbytesträng"
}
"
-==DONE==
diff --git a/sapi/cli/tests/argv_mb_bug77111.phpt b/sapi/cli/tests/argv_mb_bug77111.phpt
index 45913b841f..0ed6204b89 100644
--- a/sapi/cli/tests/argv_mb_bug77111.phpt
+++ b/sapi/cli/tests/argv_mb_bug77111.phpt
@@ -5,12 +5,12 @@ Bug #77111 php-win.exe corrupts unicode symbols from cli parameters
include "skipif.inc";
if (strtoupper(substr(PHP_OS, 0, 3)) !== 'WIN') {
- die("skip this test is for Windows platforms only");
+ die("skip this test is for Windows platforms only");
}
$php = dirname(getenv('TEST_PHP_EXECUTABLE')) . DIRECTORY_SEPARATOR . "php-win.exe";
if (!file_exists($php)) {
- die("skip php-win.exe doesn't exist");
+ die("skip php-win.exe doesn't exist");
}
?>
@@ -28,7 +28,6 @@ file_put_contents($argv_fl, "<?php file_put_contents('$out_fl', implode(' ', arr
var_dump(file_get_contents($out_fl));
?>
-==DONE==
--CLEAN--
<?php
$out_fl = __DIR__ . "\\argv_bug77111.txt";
@@ -36,7 +35,6 @@ $argv_fl = __DIR__ . DIRECTORY_SEPARATOR . "argv_test.php";
unlink($argv_fl);
unlink($out_fl);
?>
---EXPECTF--
+--EXPECT--
string(57) "Ästhetik Æstetik Esthétique Estética ЭÑтетика"
-==DONE==
diff --git a/sapi/cli/tests/bug43177.phpt b/sapi/cli/tests/bug43177.phpt
index 2ab08228b9..6c734e476a 100644
--- a/sapi/cli/tests/bug43177.phpt
+++ b/sapi/cli/tests/bug43177.phpt
@@ -8,30 +8,30 @@ include "skipif.inc";
<?php
include "php_cli_server.inc";
php_cli_server_start(<<<'SCRIPT'
- ini_set('display_errors', 0);
- switch($_SERVER["REQUEST_URI"]) {
- case "/parse":
- try {
+ ini_set('display_errors', 0);
+ switch($_SERVER["REQUEST_URI"]) {
+ case "/parse":
+ try {
eval("this is a parse error");
} catch (ParseError $e) {
}
- echo "OK\n";
- break;
- case "/fatal":
- eval("foo();");
- echo "OK\n";
- break;
- case "/compile":
- eval("class foo { final private final function bar() {} }");
- echo "OK\n";
- break;
- case "/fatal2":
- foo();
- echo "OK\n";
- break;
- default:
- return false;
- }
+ echo "OK\n";
+ break;
+ case "/fatal":
+ eval("foo();");
+ echo "OK\n";
+ break;
+ case "/compile":
+ eval("class foo { final private final function bar() {} }");
+ echo "OK\n";
+ break;
+ case "/fatal2":
+ foo();
+ echo "OK\n";
+ break;
+ default:
+ return false;
+ }
SCRIPT
);
@@ -39,7 +39,7 @@ $host = PHP_CLI_SERVER_HOSTNAME;
foreach(array("parse", "fatal", "fatal2", "compile") as $url) {
$fp = php_cli_server_connect();
- if(fwrite($fp, <<<HEADER
+ if(fwrite($fp, <<<HEADER
GET /$url HTTP/1.1
Host: {$host}
@@ -49,7 +49,7 @@ HEADER
while (!feof($fp)) {
echo fgets($fp);
}
- }
+ }
}
?>
diff --git a/sapi/cli/tests/bug44564.phpt b/sapi/cli/tests/bug44564.phpt
index 7dca62a7e8..6ef5b9f950 100644
--- a/sapi/cli/tests/bug44564.phpt
+++ b/sapi/cli/tests/bug44564.phpt
@@ -3,7 +3,7 @@ Bug #44564 (escapeshellarg removes UTF-8 multi-byte characters)
--SKIPIF--
<?php
if (false == setlocale(LC_CTYPE, "UTF8", "en_US.UTF-8")) {
- die("skip setlocale() failed\n");
+ die("skip setlocale() failed\n");
}
?>
--FILE--
diff --git a/sapi/cli/tests/bug62294.inc b/sapi/cli/tests/bug62294.inc
new file mode 100644
index 0000000000..836fd44f28
--- /dev/null
+++ b/sapi/cli/tests/bug62294.inc
@@ -0,0 +1,5 @@
+<?php
+
+register_shutdown_function(function() {
+ require 'path/to/an/unknown/file';
+});
diff --git a/sapi/cli/tests/bug62294.phpt b/sapi/cli/tests/bug62294.phpt
new file mode 100644
index 0000000000..04d0d8b60e
--- /dev/null
+++ b/sapi/cli/tests/bug62294.phpt
@@ -0,0 +1,12 @@
+--TEST--
+Bug #62294: register_shutdown_function() does not handle exit code correctly
+--FILE--
+<?php
+
+$php = getenv('TEST_PHP_EXECUTABLE');
+exec($php . ' -n ' . __DIR__ . '/bug62294.inc', $output, $exit_status);
+var_dump($exit_status);
+
+?>
+--EXPECT--
+int(255)
diff --git a/sapi/cli/tests/bug64529.phpt b/sapi/cli/tests/bug64529.phpt
index 7331b8303e..7350cd2046 100644
--- a/sapi/cli/tests/bug64529.phpt
+++ b/sapi/cli/tests/bug64529.phpt
@@ -3,14 +3,14 @@ Bug #64529 (Ran out of opcode space)
--SKIPIF--
<?php
if (substr(PHP_OS, 0, 3) == "WIN") {
- die("skip non windows test");
+ die("skip non windows test");
}
if (!extension_loaded("readline") || !readline_info("done")) {
- die("skip readline support required");
+ die("skip readline support required");
}
exec('which expect', $output, $ret);
if ($ret) {
- die("skip no expect installed");
+ die("skip no expect installed");
}
?>
--FILE--
@@ -20,7 +20,7 @@ $php_executable = getenv('TEST_PHP_EXECUTABLE');
$script = __DIR__ . "/expect.sh";
if (extension_loaded("readline")) {
- $expect_script = <<<SCRIPT
+ $expect_script = <<<SCRIPT
set php_executable [lindex \$argv 0]
@@ -38,7 +38,7 @@ exit
SCRIPT;
} else {
- $expect_script = <<<SCRIPT
+ $expect_script = <<<SCRIPT
set php_executable [lindex \$argv 0]
diff --git a/sapi/cli/tests/bug64544.phpt b/sapi/cli/tests/bug64544.phpt
index 33a6e16a10..87e8eda64a 100644
--- a/sapi/cli/tests/bug64544.phpt
+++ b/sapi/cli/tests/bug64544.phpt
@@ -3,7 +3,7 @@ Bug #64544 (Valgrind warnings after using putenv)
--SKIPIF--
<?php
if (substr(PHP_OS, 0, 3) == "WIN") {
- die("skip non windows test");
+ die("skip non windows test");
}
?>
--FILE--
diff --git a/sapi/cli/tests/bug65066_100.phpt b/sapi/cli/tests/bug65066_100.phpt
index 33f71cbd8b..c5eba532d5 100644
--- a/sapi/cli/tests/bug65066_100.phpt
+++ b/sapi/cli/tests/bug65066_100.phpt
@@ -21,9 +21,9 @@ Host: {$host}
HEADER
)) {
- while (!feof($fp)) {
- echo fgets($fp);
- }
+ while (!feof($fp)) {
+ echo fgets($fp);
+ }
}
?>
--EXPECTF--
diff --git a/sapi/cli/tests/bug65066_422.phpt b/sapi/cli/tests/bug65066_422.phpt
index 99827640a1..3e26866a26 100644
--- a/sapi/cli/tests/bug65066_422.phpt
+++ b/sapi/cli/tests/bug65066_422.phpt
@@ -21,9 +21,9 @@ Host: {$host}
HEADER
)) {
- while (!feof($fp)) {
- echo fgets($fp);
- }
+ while (!feof($fp)) {
+ echo fgets($fp);
+ }
}
?>
--EXPECTF--
diff --git a/sapi/cli/tests/bug65066_511.phpt b/sapi/cli/tests/bug65066_511.phpt
index 91042efed1..5a8734d848 100644
--- a/sapi/cli/tests/bug65066_511.phpt
+++ b/sapi/cli/tests/bug65066_511.phpt
@@ -21,9 +21,9 @@ Host: {$host}
HEADER
)) {
- while (!feof($fp)) {
- echo fgets($fp);
- }
+ while (!feof($fp)) {
+ echo fgets($fp);
+ }
}
?>
--EXPECTF--
diff --git a/sapi/cli/tests/bug65275.inc b/sapi/cli/tests/bug65275.inc
new file mode 100644
index 0000000000..addc026322
--- /dev/null
+++ b/sapi/cli/tests/bug65275.inc
@@ -0,0 +1,7 @@
+<?php
+
+register_shutdown_function(function() {
+ die(111);
+});
+
+die(222);
diff --git a/sapi/cli/tests/bug65275.phpt b/sapi/cli/tests/bug65275.phpt
new file mode 100644
index 0000000000..1d59515996
--- /dev/null
+++ b/sapi/cli/tests/bug65275.phpt
@@ -0,0 +1,12 @@
+--TEST--
+Bug #65275: Calling exit() in a shutdown function does not change the exit value in CLI
+--FILE--
+<?php
+
+$php = getenv('TEST_PHP_EXECUTABLE');
+exec($php . ' ' . __DIR__ . '/bug65275.inc', $output, $exit_status);
+var_dump($exit_status);
+
+?>
+--EXPECT--
+int(111)
diff --git a/sapi/cli/tests/bug66606_2.phpt b/sapi/cli/tests/bug66606_2.phpt
index f96a02a5f7..e599bb64e9 100644
--- a/sapi/cli/tests/bug66606_2.phpt
+++ b/sapi/cli/tests/bug66606_2.phpt
@@ -23,9 +23,9 @@ Content-Length: 3
a=b
HEADER
)) {
- while (!feof($fp)) {
- echo fgets($fp);
- }
+ while (!feof($fp)) {
+ echo fgets($fp);
+ }
}
fclose($fp);
diff --git a/sapi/cli/tests/bug69655.phpt b/sapi/cli/tests/bug69655.phpt
index 73791c95d5..b5612357f9 100644
--- a/sapi/cli/tests/bug69655.phpt
+++ b/sapi/cli/tests/bug69655.phpt
@@ -17,11 +17,11 @@ foreach (['MKCO', 'MKCOLL', 'M'] as $method) {
}
?>
--EXPECTF--
-Warning: file_get_contents(http://localhost:8964): failed to open stream: HTTP request failed! HTTP/1.0 501 Not Implemented
+Warning: file_get_contents(http://localhost:8964): Failed to open stream: HTTP request failed! HTTP/1.1 501 Not Implemented
in %s on line %d
-Warning: file_get_contents(http://localhost:8964): failed to open stream: HTTP request failed! HTTP/1.0 501 Not Implemented
+Warning: file_get_contents(http://localhost:8964): Failed to open stream: HTTP request failed! HTTP/1.1 501 Not Implemented
in %s on line %d
-Warning: file_get_contents(http://localhost:8964): failed to open stream: HTTP request failed! HTTP/1.0 501 Not Implemented
+Warning: file_get_contents(http://localhost:8964): Failed to open stream: HTTP request failed! HTTP/1.1 501 Not Implemented
in %s on line %d
diff --git a/sapi/cli/tests/bug70264.phpt b/sapi/cli/tests/bug70264.phpt
index 877b1194f2..e1b0ee8fe8 100644
--- a/sapi/cli/tests/bug70264.phpt
+++ b/sapi/cli/tests/bug70264.phpt
@@ -14,8 +14,8 @@ echo file_get_contents("http://" . PHP_CLI_SERVER_ADDRESS . "/..\\CREDITS");
echo file_get_contents("http://" . PHP_CLI_SERVER_ADDRESS . "/..%5CCREDITS");
?>
--EXPECTF--
-Warning: file_get_contents(http://%s/..\CREDITS): failed to open stream: HTTP request failed! HTTP/1.0 404 Not Found
+Warning: file_get_contents(http://%s/..\CREDITS): Failed to open stream: HTTP request failed! HTTP/1.1 404 Not Found
in %sbug70264.php on line %d
-Warning: file_get_contents(http://%s/..%5CCREDITS): failed to open stream: HTTP request failed! HTTP/1.0 404 Not Found
+Warning: file_get_contents(http://%s/..%5CCREDITS): Failed to open stream: HTTP request failed! HTTP/1.1 404 Not Found
in %sbug70264.php on line %d
diff --git a/sapi/cli/tests/bug70470.phpt b/sapi/cli/tests/bug70470.phpt
index 077e253787..13b9f2b343 100644
--- a/sapi/cli/tests/bug70470.phpt
+++ b/sapi/cli/tests/bug70470.phpt
@@ -22,7 +22,7 @@ fflush($fp);
usleep(200000);
fwrite($fp, "se\r\n\r\n");
while (!feof($fp)) {
- echo fgets($fp);
+ echo fgets($fp);
}
fclose($fp);
?>
diff --git a/sapi/cli/tests/bug71005.phpt b/sapi/cli/tests/bug71005.phpt
index 70521dbaec..b7b9719d0d 100644
--- a/sapi/cli/tests/bug71005.phpt
+++ b/sapi/cli/tests/bug71005.phpt
@@ -25,9 +25,9 @@ Host: {$host}
HEADER
)) {
- while (!feof($fp)) {
- echo fgets($fp);
- }
+ while (!feof($fp)) {
+ echo fgets($fp);
+ }
}
?>
diff --git a/sapi/cli/tests/bug71624.phpt b/sapi/cli/tests/bug71624.phpt
index 67e3e8f343..8b82ebab58 100644
--- a/sapi/cli/tests/bug71624.phpt
+++ b/sapi/cli/tests/bug71624.phpt
@@ -20,11 +20,11 @@ file_put_contents($filename_txt, $txt);
$test_args = ['$argi', '$argn'];
foreach ($test_args as $test_arg) {
- if (substr(PHP_OS, 0, 3) == 'WIN') {
- var_dump(`type "$filename_txt" | "$php" -n -R "echo $test_arg . PHP_EOL;"`);
- } else {
- var_dump(`cat "$filename_txt" | "$php" -n -R 'echo $test_arg . PHP_EOL;'`);
- }
+ if (substr(PHP_OS, 0, 3) == 'WIN') {
+ var_dump(`type "$filename_txt" | "$php" -n -R "echo $test_arg . PHP_EOL;"`);
+ } else {
+ var_dump(`cat "$filename_txt" | "$php" -n -R 'echo $test_arg . PHP_EOL;'`);
+ }
}
@unlink($filename_txt);
diff --git a/sapi/cli/tests/bug74600.phpt b/sapi/cli/tests/bug74600.phpt
index eee222aaa3..3520982df0 100644
--- a/sapi/cli/tests/bug74600.phpt
+++ b/sapi/cli/tests/bug74600.phpt
@@ -14,14 +14,14 @@ file_put_contents($ini_file, <<<INI
INI
);
$desc = array(
- 0 => array("pipe", "r"),
- 1 => array("pipe", "w"),
- 2 => array("pipe", "w"),
+ 0 => array("pipe", "r"),
+ 1 => array("pipe", "w"),
+ 2 => array("pipe", "w"),
);
$pipes = array();
$proc = proc_open("$php -c $ini_file -r 'echo \"okey\";'", $desc, $pipes);
if (!$proc) {
- exit(1);
+ exit(1);
}
var_dump(stream_get_contents($pipes[1]));
var_dump(stream_get_contents($pipes[2]));
diff --git a/sapi/cli/tests/bug77561.inc b/sapi/cli/tests/bug77561.inc
new file mode 100644
index 0000000000..e0ae5b2d13
--- /dev/null
+++ b/sapi/cli/tests/bug77561.inc
@@ -0,0 +1,4 @@
+#!/usr/bin/env php
+<?php
+declare(strict_types=1);
+echo "Test\n";
diff --git a/sapi/cli/tests/bug77561.phpt b/sapi/cli/tests/bug77561.phpt
new file mode 100644
index 0000000000..42ce9b53db
--- /dev/null
+++ b/sapi/cli/tests/bug77561.phpt
@@ -0,0 +1,10 @@
+--TEST--
+Bug #77561: Shebang line not stripped for non-primary script
+--FILE--
+<?php
+
+require __DIR__ . '/bug77561.inc';
+
+?>
+--EXPECT--
+Test
diff --git a/sapi/cli/tests/emptyheader.phpt b/sapi/cli/tests/emptyheader.phpt
index f301108b72..f0e31ce501 100644
--- a/sapi/cli/tests/emptyheader.phpt
+++ b/sapi/cli/tests/emptyheader.phpt
@@ -15,7 +15,7 @@ $fp = php_cli_server_connect();
fwrite($fp, "GET / HTTP/1.1\r\nUser-Agent\r\nAccept: */*\r\nReferer:\r\nHi\r\n\r\n");
fflush($fp);
while (!feof($fp)) {
- echo fgets($fp);
+ echo fgets($fp);
}
fclose($fp);
?>
diff --git a/sapi/cli/tests/ext_loading.phpt b/sapi/cli/tests/ext_loading.phpt
new file mode 100644
index 0000000000..220302da62
--- /dev/null
+++ b/sapi/cli/tests/ext_loading.phpt
@@ -0,0 +1,65 @@
+--TEST--
+Extension loading
+--SKIPIF--
+<?php
+$extDir = ini_get('extension_dir');
+if (!file_exists($extDir . '/opcache.so') && !file_exists($extDir . '/php_opcache.dll')) {
+ die('skip Opcache shared object not found in extension_dir');
+}
+?>
+--FILE--
+<?php
+
+
+function loadZendExt($extension) {
+ $cmd = [
+ PHP_BINARY, '-n',
+ '-dextension_dir=' . ini_get('extension_dir'),
+ '-dzend_extension=' . $extension,
+ '-r', 'echo "Done.";'
+ ];
+ $proc = proc_open($cmd, [['null'], ['pipe', 'w'], ['redirect', 1]], $pipes);
+ echo "Output: ", stream_get_contents($pipes[1]), "\n";
+}
+
+echo "Only extension name:\n";
+loadZendExt('opcache');
+
+echo "Name with file extension:\n";
+$name = PHP_OS_FAMILY == 'Windows' ? 'php_opcache.dll' : 'opcache.so';
+loadZendExt($name);
+
+echo "Absolute path:\n";
+$path = ini_get('extension_dir') . DIRECTORY_SEPARATOR . $name;
+loadZendExt($path);
+
+echo "Unknown extension name (unknown):\n";
+loadZendExt('unknown_ext');
+
+echo "Name with file extension (unknown):\n";
+$name = PHP_OS_FAMILY == 'Windows' ? 'php_unknown_ext.dll' : 'unknown_ext.so';
+loadZendExt($name);
+
+echo "Absolute path (unknown):\n";
+$path = ini_get('extension_dir') . DIRECTORY_SEPARATOR . $name;
+loadZendExt($path);
+
+?>
+--EXPECTF--
+Only extension name:
+Output: Done.
+Name with file extension:
+Output: Done.
+Absolute path:
+Output: Done.
+Unknown extension name (unknown):
+Output:
+Warning: Failed loading Zend extension 'unknown_ext' (tried: %s) in Unknown on line 0
+Done.
+Name with file extension (unknown):
+Output:
+Warning: Failed loading Zend extension '%Sunknown_ext%S' (tried: %s) in Unknown on line 0
+Done.
+Absolute path (unknown):
+Output: Failed loading %s
+Done.
diff --git a/sapi/cli/tests/php_cli_server.inc b/sapi/cli/tests/php_cli_server.inc
index d5f28cbb54..4cf8705a33 100644
--- a/sapi/cli/tests/php_cli_server.inc
+++ b/sapi/cli/tests/php_cli_server.inc
@@ -4,29 +4,29 @@ define("PHP_CLI_SERVER_PORT", 8964);
define("PHP_CLI_SERVER_ADDRESS", PHP_CLI_SERVER_HOSTNAME.":".PHP_CLI_SERVER_PORT);
function php_cli_server_start(
- ?string $code = 'echo "Hello world";',
- ?string $router = 'index.php',
- array $cmd_args = []
+ ?string $code = 'echo "Hello world";',
+ ?string $router = 'index.php',
+ array $cmd_args = []
) {
- $php_executable = getenv('TEST_PHP_EXECUTABLE');
- $doc_root = __DIR__;
+ $php_executable = getenv('TEST_PHP_EXECUTABLE');
+ $doc_root = __DIR__;
$error = null;
- if ($code) {
- file_put_contents($doc_root . '/' . ($router ?: 'index.php'), '<?php ' . $code . ' ?>');
- }
-
- $cmd = [$php_executable, '-t', $doc_root, '-n', ...$cmd_args, '-S', PHP_CLI_SERVER_ADDRESS];
- if (!is_null($router)) {
- $cmd[] = $router;
- }
-
- $descriptorspec = array(
- 0 => STDIN,
- 1 => STDOUT,
- 2 => array("null"),
- );
- $handle = proc_open($cmd, $descriptorspec, $pipes, $doc_root, null, array("suppress_errors" => true));
+ if ($code) {
+ file_put_contents($doc_root . '/' . ($router ?: 'index.php'), '<?php ' . $code . ' ?>');
+ }
+
+ $cmd = [$php_executable, '-t', $doc_root, '-n', ...$cmd_args, '-S', PHP_CLI_SERVER_ADDRESS];
+ if (!is_null($router)) {
+ $cmd[] = $router;
+ }
+
+ $descriptorspec = array(
+ 0 => STDIN,
+ 1 => STDOUT,
+ 2 => array("null"),
+ );
+ $handle = proc_open($cmd, $descriptorspec, $pipes, $doc_root, null, array("suppress_errors" => true));
// note: here we check the process is running
for ($i=0; $i < 120; $i++) {
diff --git a/sapi/cli/tests/php_cli_server_004.phpt b/sapi/cli/tests/php_cli_server_004.phpt
index d9c3b171f2..03c7619f1a 100644
--- a/sapi/cli/tests/php_cli_server_004.phpt
+++ b/sapi/cli/tests/php_cli_server_004.phpt
@@ -24,9 +24,9 @@ Referer:http://www.php.net/
HEADER
)) {
- while (!feof($fp)) {
- echo fgets($fp);
- }
+ while (!feof($fp)) {
+ echo fgets($fp);
+ }
}
?>
diff --git a/sapi/cli/tests/php_cli_server_005.phpt b/sapi/cli/tests/php_cli_server_005.phpt
index 2d62432270..41e57881a1 100644
--- a/sapi/cli/tests/php_cli_server_005.phpt
+++ b/sapi/cli/tests/php_cli_server_005.phpt
@@ -36,9 +36,9 @@ Content-Length: {$post_len}
{$post_data}
HEADER
)) {
- while (!feof($fp)) {
- echo fgets($fp);
- }
+ while (!feof($fp)) {
+ echo fgets($fp);
+ }
}
?>
diff --git a/sapi/cli/tests/php_cli_server_006.phpt b/sapi/cli/tests/php_cli_server_006.phpt
index 68f2b9789e..7ac36a03f0 100644
--- a/sapi/cli/tests/php_cli_server_006.phpt
+++ b/sapi/cli/tests/php_cli_server_006.phpt
@@ -20,9 +20,9 @@ Authorization: Basic Zm9vOmJhcg==
HEADER
)) {
- while (!feof($fp)) {
- echo fgets($fp);
- }
+ while (!feof($fp)) {
+ echo fgets($fp);
+ }
}
?>
diff --git a/sapi/cli/tests/php_cli_server_007.phpt b/sapi/cli/tests/php_cli_server_007.phpt
index b120befa95..b68064a51c 100644
--- a/sapi/cli/tests/php_cli_server_007.phpt
+++ b/sapi/cli/tests/php_cli_server_007.phpt
@@ -20,9 +20,9 @@ Authorization: Basic Zm9vOmJhcg==
HEADER
)) {
- while (!feof($fp)) {
- echo fgets($fp);
- }
+ while (!feof($fp)) {
+ echo fgets($fp);
+ }
}
?>
diff --git a/sapi/cli/tests/php_cli_server_008.phpt b/sapi/cli/tests/php_cli_server_008.phpt
index a6442e07eb..31c9e4ecaf 100644
--- a/sapi/cli/tests/php_cli_server_008.phpt
+++ b/sapi/cli/tests/php_cli_server_008.phpt
@@ -19,9 +19,9 @@ Host: {$host}
HEADER
)) {
- while (!feof($fp)) {
- echo fgets($fp);
- }
+ while (!feof($fp)) {
+ echo fgets($fp);
+ }
}
fclose($fp);
@@ -35,9 +35,9 @@ Host: {$host}
HEADER
)) {
- while (!feof($fp)) {
- echo fgets($fp);
- }
+ while (!feof($fp)) {
+ echo fgets($fp);
+ }
}
fclose($fp);
diff --git a/sapi/cli/tests/php_cli_server_009.phpt b/sapi/cli/tests/php_cli_server_009.phpt
index 988f484613..07ba46e89c 100644
--- a/sapi/cli/tests/php_cli_server_009.phpt
+++ b/sapi/cli/tests/php_cli_server_009.phpt
@@ -22,9 +22,9 @@ Host: {$host}
HEADER
)) {
- while (!feof($fp)) {
- echo fgets($fp);
- }
+ while (!feof($fp)) {
+ echo fgets($fp);
+ }
}
fclose($fp);
@@ -38,9 +38,9 @@ Host: {$host}
HEADER
)) {
- while (!feof($fp)) {
- echo fgets($fp);
- }
+ while (!feof($fp)) {
+ echo fgets($fp);
+ }
}
fclose($fp);
@@ -54,10 +54,10 @@ Host: {$host}
HEADER
)) {
- while (!feof($fp)) {
- echo fgets($fp);
- break;
- }
+ while (!feof($fp)) {
+ echo fgets($fp);
+ break;
+ }
}
fclose($fp);
diff --git a/sapi/cli/tests/php_cli_server_010.phpt b/sapi/cli/tests/php_cli_server_010.phpt
index b3b18498b3..517fd19add 100644
--- a/sapi/cli/tests/php_cli_server_010.phpt
+++ b/sapi/cli/tests/php_cli_server_010.phpt
@@ -19,9 +19,9 @@ Host: {$host}
HEADER
)) {
- while (!feof($fp)) {
- echo fgets($fp);
- }
+ while (!feof($fp)) {
+ echo fgets($fp);
+ }
}
fclose($fp);
@@ -35,9 +35,9 @@ Host: {$host}
HEADER
)) {
- while (!feof($fp)) {
- echo fgets($fp);
- }
+ while (!feof($fp)) {
+ echo fgets($fp);
+ }
}
fclose($fp);
diff --git a/sapi/cli/tests/php_cli_server_012.phpt b/sapi/cli/tests/php_cli_server_012.phpt
index 8796bd6fa2..6262aa2c73 100644
--- a/sapi/cli/tests/php_cli_server_012.phpt
+++ b/sapi/cli/tests/php_cli_server_012.phpt
@@ -23,9 +23,9 @@ Content-Length: 3
a=b
HEADER
)) {
- while (!feof($fp)) {
- echo fgets($fp);
- }
+ while (!feof($fp)) {
+ echo fgets($fp);
+ }
}
fclose($fp);
diff --git a/sapi/cli/tests/php_cli_server_013.phpt b/sapi/cli/tests/php_cli_server_013.phpt
index 09faa1cc0f..8042219afe 100644
--- a/sapi/cli/tests/php_cli_server_013.phpt
+++ b/sapi/cli/tests/php_cli_server_013.phpt
@@ -23,9 +23,9 @@ Content-Length: 3
a=b
HEADER
)) {
- while (!feof($fp)) {
- $output .= fgets($fp);
- }
+ while (!feof($fp)) {
+ $output .= fgets($fp);
+ }
}
echo preg_replace("/<style>(.*?)<\/style>/s", "<style>AAA</style>", $output), "\n";
@@ -42,9 +42,9 @@ Host: {$host}
HEADER
)) {
- while (!feof($fp)) {
- $output .= fgets($fp);
- }
+ while (!feof($fp)) {
+ $output .= fgets($fp);
+ }
}
echo preg_replace("/<style>(.*?)<\/style>/s", "<style>AAA</style>", $output), "\n";
@@ -60,9 +60,9 @@ Host: {$host}
HEADER
)) {
- while (!feof($fp)) {
- $output .= fgets($fp);
- }
+ while (!feof($fp)) {
+ $output .= fgets($fp);
+ }
}
echo preg_replace("/<style>(.*?)<\/style>/s", "<style>AAA</style>", $output), "\n";
diff --git a/sapi/cli/tests/php_cli_server_014.phpt b/sapi/cli/tests/php_cli_server_014.phpt
index 1106c800e8..5be3dd1a73 100644
--- a/sapi/cli/tests/php_cli_server_014.phpt
+++ b/sapi/cli/tests/php_cli_server_014.phpt
@@ -24,9 +24,9 @@ Content-Type: application/x-www-form-urlencoded
a=b
HEADER
)) {
- while (!feof($fp)) {
- $output .= fgets($fp);
- }
+ while (!feof($fp)) {
+ $output .= fgets($fp);
+ }
}
fclose($fp);
@@ -43,9 +43,9 @@ Content-Type: application/x-www-form-urlencoded
a=b
HEADER
)) {
- while (!feof($fp)) {
- $output .= fgets($fp);
- }
+ while (!feof($fp)) {
+ $output .= fgets($fp);
+ }
}
echo preg_replace("/<style>(.*?)<\/style>/s", "<style>AAA</style>", $output), "\n";
diff --git a/sapi/cli/tests/php_cli_server_015.phpt b/sapi/cli/tests/php_cli_server_015.phpt
index dc0e50ab15..af48758306 100644
--- a/sapi/cli/tests/php_cli_server_015.phpt
+++ b/sapi/cli/tests/php_cli_server_015.phpt
@@ -25,9 +25,9 @@ Host: {$host}
HEADER
)) {
- while (!feof($fp)) {
- $output .= fgets($fp);
- }
+ while (!feof($fp)) {
+ $output .= fgets($fp);
+ }
}
echo $output;
@unlink($dir . "/syntax_error.php");
diff --git a/sapi/cli/tests/php_cli_server_016.phpt b/sapi/cli/tests/php_cli_server_016.phpt
index d56cef4a64..be8855fb95 100644
--- a/sapi/cli/tests/php_cli_server_016.phpt
+++ b/sapi/cli/tests/php_cli_server_016.phpt
@@ -29,10 +29,10 @@ Host: {$host}
HEADER
)) {
- while (!feof($fp)) {
- echo fgets($fp);
+ while (!feof($fp)) {
+ echo fgets($fp);
break;
- }
+ }
}
fclose($fp);
diff --git a/sapi/cli/tests/php_cli_server_017.phpt b/sapi/cli/tests/php_cli_server_017.phpt
index 22d62c3b5e..7e54d9ef36 100644
--- a/sapi/cli/tests/php_cli_server_017.phpt
+++ b/sapi/cli/tests/php_cli_server_017.phpt
@@ -22,9 +22,9 @@ Host: {$host}
HEADER
)) {
- while (!feof($fp)) {
- echo fgets($fp);
- }
+ while (!feof($fp)) {
+ echo fgets($fp);
+ }
}
fclose($fp);
diff --git a/sapi/cli/tests/php_cli_server_020.phpt b/sapi/cli/tests/php_cli_server_020.phpt
index eb2a255a09..e4e5326353 100644
--- a/sapi/cli/tests/php_cli_server_020.phpt
+++ b/sapi/cli/tests/php_cli_server_020.phpt
@@ -19,9 +19,9 @@ Host: {$host}
HEADER
)) {
- while (!feof($fp)) {
- echo fgets($fp);
- }
+ while (!feof($fp)) {
+ echo fgets($fp);
+ }
}
?>
diff --git a/sapi/cli/tests/sapi_windows_set_ctrl_handler.phpt b/sapi/cli/tests/sapi_windows_set_ctrl_handler.phpt
index 4f1963d052..09030c90f8 100644
--- a/sapi/cli/tests/sapi_windows_set_ctrl_handler.phpt
+++ b/sapi/cli/tests/sapi_windows_set_ctrl_handler.phpt
@@ -15,65 +15,65 @@ $is_child = isset($argv[1]);
if ($is_child) {
- function handler($evt)
- {
- exit(3);
- }
+ function handler($evt)
+ {
+ exit(3);
+ }
- sapi_windows_set_ctrl_handler('handler');
+ sapi_windows_set_ctrl_handler('handler');
- while(1) usleep(100);
+ while(1) usleep(100);
} else {
- $cmd = PHP_BINARY . " -n " . $argv[0] . " 1";
- $spec = [0 => ["pipe", "r"], 1 => ["pipe", "w"]];
+ $cmd = PHP_BINARY . " -n " . $argv[0] . " 1";
+ $spec = [0 => ["pipe", "r"], 1 => ["pipe", "w"]];
- $proc = proc_open($cmd, $spec, $pipes, NULL, NULL, ["bypass_shell" => true, "create_process_group" => true]);
+ $proc = proc_open($cmd, $spec, $pipes, NULL, NULL, ["bypass_shell" => true, "create_process_group" => true]);
- if (!is_resource($proc)) {
- die("Failed to start child. ");
- }
+ if (!is_resource($proc)) {
+ die("Failed to start child. ");
+ }
- $child_pid = proc_get_status($proc)["pid"];
- echo "Started child $child_pid\n";
- usleep(300);
+ $child_pid = proc_get_status($proc)["pid"];
+ echo "Started child $child_pid\n";
+ usleep(300);
- $cmd = "tasklist /FI \"PID eq $child_pid\" /NH";
- echo "Running `$cmd` to check the process indeed exists:\n";
- echo trim(shell_exec($cmd)) . "\n";
+ $cmd = "tasklist /FI \"PID eq $child_pid\" /NH";
+ echo "Running `$cmd` to check the process indeed exists:\n";
+ echo trim(shell_exec($cmd)) . "\n";
- $evt = PHP_WINDOWS_EVENT_CTRL_C;
- echo "Sending ", get_evt_name($evt), " to child $child_pid\n";
- $ret = sapi_windows_generate_ctrl_event($evt, $child_pid);
+ $evt = PHP_WINDOWS_EVENT_CTRL_C;
+ echo "Sending ", get_evt_name($evt), " to child $child_pid\n";
+ $ret = sapi_windows_generate_ctrl_event($evt, $child_pid);
- echo ($ret ? "Successfully" : "Unsuccessfuly"), " sent ", get_evt_name($evt), " to child $child_pid\n";
+ echo ($ret ? "Successfully" : "Unsuccessfuly"), " sent ", get_evt_name($evt), " to child $child_pid\n";
- $max = 5000; $total = 0; $step = 100;
- while(proc_get_status($proc)["running"] && $max > $total) {
- usleep($step);
- $total += $step;
- }
+ $max = 5000; $total = 0; $step = 100;
+ while(proc_get_status($proc)["running"] && $max > $total) {
+ usleep($step);
+ $total += $step;
+ }
- $status = proc_get_status($proc);
- if ($status["running"]) {
- echo "Child $child_pid didn't exit after ${max}us\n";
+ $status = proc_get_status($proc);
+ if ($status["running"]) {
+ echo "Child $child_pid didn't exit after ${max}us\n";
foreach ($pipes as $pipe) {
fclose($pipe);
}
proc_terminate($proc);
- } else {
- echo "Child $child_pid exit with status ", $status["exitcode"], " after ${total}us\n";
- }
+ } else {
+ echo "Child $child_pid exit with status ", $status["exitcode"], " after ${total}us\n";
+ }
}
function get_evt_name(int $evt) : ?string
{
- if (PHP_WINDOWS_EVENT_CTRL_C == $evt) {
- return "CTRL+C";
- } if (PHP_WINDOWS_EVENT_CTRL_BREAK == $evt) {
- return "CTRL+BREAK";
- }
+ if (PHP_WINDOWS_EVENT_CTRL_C == $evt) {
+ return "CTRL+C";
+ } if (PHP_WINDOWS_EVENT_CTRL_BREAK == $evt) {
+ return "CTRL+BREAK";
+ }
- return NULL;
+ return NULL;
}
?>
diff --git a/sapi/cli/tests/skipif.inc b/sapi/cli/tests/skipif.inc
index 79e6c91004..0500d0bb75 100644
--- a/sapi/cli/tests/skipif.inc
+++ b/sapi/cli/tests/skipif.inc
@@ -1,7 +1,7 @@
<?php
if (php_sapi_name() != "cli") {
- die("skip CLI only");
+ die("skip CLI only");
}
?>
diff --git a/sapi/cli/tests/upload_2G.phpt b/sapi/cli/tests/upload_2G.phpt
index 6ac1bbf0aa..3d139ce650 100644
--- a/sapi/cli/tests/upload_2G.phpt
+++ b/sapi/cli/tests/upload_2G.phpt
@@ -5,27 +5,31 @@ file upload greater than 2G
include "skipif.inc";
if (PHP_INT_SIZE < 8) {
- die("skip need PHP_INT_SIZE>=8");
+ die("skip need PHP_INT_SIZE>=8");
+}
+
+if (disk_free_space(sys_get_temp_dir()) < 2300000000) {
+ die("skip need more than 2.15G of free disk space for the uploaded file");
}
if (!file_exists('/proc/meminfo')) {
- die('skip Cannot check free RAM from /proc/meminfo on this platform');
+ die('skip Cannot check free RAM from /proc/meminfo on this platform');
}
$free_ram = 0;
if ($f = fopen("/proc/meminfo","r")) {
- while (!feof($f)) {
- if (preg_match('/MemFree[^\d]*(\d+)/i', fgets($f), $m)) {
- $free_ram = max($free_ram, $m[1]/1024/1024);
- if ($free_ram > 3) {
- $enough_free_ram = true;
- }
- }
- }
+ while (!feof($f)) {
+ if (preg_match('/MemFree[^\d]*(\d+)/i', fgets($f), $m)) {
+ $free_ram = max($free_ram, $m[1]/1024/1024);
+ if ($free_ram > 3) {
+ $enough_free_ram = true;
+ }
+ }
+ }
}
if (empty($enough_free_ram)) {
- die(sprintf("skip need +3G free RAM, but only %01.2f available", $free_ram));
+ die(sprintf("skip need +3G free RAM, but only %01.2f available", $free_ram));
}
if (getenv('TRAVIS')) {
@@ -44,7 +48,7 @@ echo "Test\n";
include "php_cli_server.inc";
php_cli_server_start("var_dump(\$_FILES);", null,
- ["-d", "post_max_size=3G", "-d", "upload_max_filesize=3G"]);
+ ["-d", "post_max_size=3G", "-d", "upload_max_filesize=3G"]);
$length = 2150000000;
$output = "";
@@ -70,13 +74,13 @@ EOF
$data = str_repeat("0123456789", 10000);
for ($i = 0; $i < $length; $i += 10000 * 10) {
- fwrite($fp, $data) or die("write failed @ ($i)");
+ fwrite($fp, $data) or die("write failed @ ($i)");
}
fwrite($fp, $post) or die("write post failed");
while (!feof($fp)) {
- $output .= fgets($fp);
+ $output .= fgets($fp);
}
echo $output;
fclose($fp);
diff --git a/sapi/embed/config.m4 b/sapi/embed/config.m4
index 069f4dcd0c..39d7dcf0a3 100644
--- a/sapi/embed/config.m4
+++ b/sapi/embed/config.m4
@@ -10,10 +10,12 @@ AC_MSG_CHECKING([for embedded SAPI library support])
if test "$PHP_EMBED" != "no"; then
case "$PHP_EMBED" in
yes|shared)
+ LIBPHP_CFLAGS="-shared"
PHP_EMBED_TYPE=shared
INSTALL_IT="\$(mkinstalldirs) \$(INSTALL_ROOT)\$(prefix)/lib; \$(INSTALL) -m 0755 $SAPI_SHARED \$(INSTALL_ROOT)\$(prefix)/lib"
;;
static)
+ LIBPHP_CFLAGS="-static"
PHP_EMBED_TYPE=static
INSTALL_IT="\$(mkinstalldirs) \$(INSTALL_ROOT)\$(prefix)/lib; \$(INSTALL) -m 0644 $SAPI_STATIC \$(INSTALL_ROOT)\$(prefix)/lib"
;;
@@ -22,6 +24,7 @@ if test "$PHP_EMBED" != "no"; then
;;
esac
if test "$PHP_EMBED_TYPE" != "no"; then
+ PHP_SUBST(LIBPHP_CFLAGS)
PHP_SELECT_SAPI(embed, $PHP_EMBED_TYPE, php_embed.c, -DZEND_ENABLE_STATIC_TSRMLS_CACHE=1)
PHP_INSTALL_HEADERS([sapi/embed/php_embed.h])
fi
diff --git a/sapi/embed/php_embed.c b/sapi/embed/php_embed.c
index 4c7dec6dd0..b510d5105e 100644
--- a/sapi/embed/php_embed.c
+++ b/sapi/embed/php_embed.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
@@ -18,6 +16,7 @@
#include "php_embed.h"
#include "ext/standard/php_standard.h"
+#include "ext/standard/dl_arginfo.h"
#ifdef PHP_WIN32
#include <io.h>
@@ -93,9 +92,9 @@ static void php_embed_send_header(sapi_header_struct *sapi_header, void *server_
{
}
-static void php_embed_log_message(char *message, int syslog_type_int)
+static void php_embed_log_message(const char *message, int syslog_type_int)
{
- fprintf (stderr, "%s\n", message);
+ fprintf(stderr, "%s\n", message);
}
static void php_embed_register_variables(zval *track_vars_array)
@@ -144,15 +143,9 @@ EMBED_SAPI_API sapi_module_struct php_embed_module = {
};
/* }}} */
-/* {{{ arginfo ext/standard/dl.c */
-ZEND_BEGIN_ARG_INFO(arginfo_dl, 0)
- ZEND_ARG_INFO(0, extension_filename)
-ZEND_END_ARG_INFO()
-/* }}} */
-
static const zend_function_entry additional_functions[] = {
ZEND_FE(dl, arginfo_dl)
- {NULL, NULL, NULL}
+ ZEND_FE_END
};
EMBED_SAPI_API int php_embed_init(int argc, char **argv)
diff --git a/sapi/embed/php_embed.h b/sapi/embed/php_embed.h
index 855872fed8..6280e4e8f8 100644
--- a/sapi/embed/php_embed.h
+++ b/sapi/embed/php_embed.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/sapi/fpm/config.m4 b/sapi/fpm/config.m4
index ad89c1bb52..7c2fdec122 100644
--- a/sapi/fpm/config.m4
+++ b/sapi/fpm/config.m4
@@ -488,22 +488,6 @@ AC_DEFUN([AC_FPM_SELECT],
])
])
-AC_DEFUN([AC_FPM_APPARMOR],
-[
- AC_MSG_CHECKING([for apparmor])
-
- SAVED_LIBS="$LIBS"
- LIBS="$LIBS -lapparmor"
-
- AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <sys/apparmor.h>]], [[change_hat("test", 0);]])], [
- AC_DEFINE([HAVE_APPARMOR], 1, [do we have apparmor support?])
- AC_MSG_RESULT([yes])
- ], [
- LIBS="$SAVED_LIBS"
- AC_MSG_RESULT([no])
- ])
-])
-
AC_MSG_CHECKING(for FPM build)
if test "$PHP_FPM" != "no"; then
AC_MSG_RESULT($PHP_FPM)
@@ -521,7 +505,6 @@ if test "$PHP_FPM" != "no"; then
AC_FPM_DEVPOLL
AC_FPM_EPOLL
AC_FPM_SELECT
- AC_FPM_APPARMOR
PHP_ARG_WITH([fpm-user],,
[AS_HELP_STRING([[--with-fpm-user[=USER]]],
@@ -548,6 +531,12 @@ if test "$PHP_FPM" != "no"; then
[no],
[no])
+ PHP_ARG_WITH([fpm-apparmor],,
+ [AS_HELP_STRING([--with-fpm-apparmor],
+ [Support AppArmor confinement through libapparmor])],
+ [no],
+ [no])
+
if test "$PHP_FPM_SYSTEMD" != "no" ; then
PKG_CHECK_MODULES([SYSTEMD], [libsystemd >= 209])
@@ -580,6 +569,16 @@ if test "$PHP_FPM" != "no"; then
])
fi
+ if test "x$PHP_FPM_APPARMOR" != "xno" ; then
+ AC_CHECK_HEADERS([sys/apparmor.h])
+ AC_CHECK_LIB(apparmor, aa_change_profile, [
+ PHP_ADD_LIBRARY(apparmor)
+ AC_DEFINE(HAVE_APPARMOR, 1, [ AppArmor confinement available ])
+ ],[
+ AC_MSG_ERROR(libapparmor required but not found)
+ ])
+ fi
+
PHP_SUBST_OLD(php_fpm_systemd)
AC_DEFINE_UNQUOTED(PHP_FPM_SYSTEMD, "$php_fpm_systemd", [fpm systemd service type])
@@ -660,7 +659,7 @@ if test "$PHP_FPM" != "no"; then
BUILD_FPM="\$(CC) \$(CFLAGS_CLEAN) \$(EXTRA_CFLAGS) \$(EXTRA_LDFLAGS_PROGRAM) \$(LDFLAGS) \$(NATIVE_RPATHS) \$(PHP_GLOBAL_OBJS:.lo=.o) \$(PHP_BINARY_OBJS:.lo=.o) \$(PHP_FASTCGI_OBJS:.lo=.o) \$(PHP_FPM_OBJS:.lo=.o) \$(PHP_FRAMEWORKS) \$(EXTRA_LIBS) \$(FPM_EXTRA_LIBS) \$(ZEND_EXTRA_LIBS) -o \$(SAPI_FPM_PATH)"
;;
*)
- BUILD_FPM="\$(LIBTOOL) --mode=link \$(CC) -export-dynamic \$(CFLAGS_CLEAN) \$(EXTRA_CFLAGS) \$(EXTRA_LDFLAGS_PROGRAM) \$(LDFLAGS) \$(PHP_RPATHS) \$(PHP_GLOBAL_OBJS) \$(PHP_BINARY_OBJS) \$(PHP_FASTCGI_OBJS) \$(PHP_FPM_OBJS) \$(EXTRA_LIBS) \$(FPM_EXTRA_LIBS) \$(ZEND_EXTRA_LIBS) -o \$(SAPI_FPM_PATH)"
+ BUILD_FPM="\$(LIBTOOL) --mode=link \$(CC) -export-dynamic \$(CFLAGS_CLEAN) \$(EXTRA_CFLAGS) \$(EXTRA_LDFLAGS_PROGRAM) \$(LDFLAGS) \$(PHP_RPATHS) \$(PHP_GLOBAL_OBJS:.lo=.o) \$(PHP_BINARY_OBJS:.lo=.o) \$(PHP_FASTCGI_OBJS:.lo=.o) \$(PHP_FPM_OBJS:.lo=.o) \$(EXTRA_LIBS) \$(FPM_EXTRA_LIBS) \$(ZEND_EXTRA_LIBS) -o \$(SAPI_FPM_PATH)"
;;
esac
diff --git a/sapi/fpm/fpm/events/devpoll.c b/sapi/fpm/fpm/events/devpoll.c
index 68cc8dd615..0d165fe2fc 100644
--- a/sapi/fpm/fpm/events/devpoll.c
+++ b/sapi/fpm/fpm/events/devpoll.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
@@ -21,7 +19,7 @@
#include "../fpm.h"
#include "../zlog.h"
-#if HAVE_DEVPOLL
+#ifdef HAVE_DEVPOLL
#include <sys/types.h>
#include <sys/stat.h>
@@ -55,7 +53,7 @@ static int npollfds = 0;
struct fpm_event_module_s *fpm_event_devpoll_module() /* {{{ */
{
-#if HAVE_DEVPOLL
+#ifdef HAVE_DEVPOLL
return &devpoll_module;
#else
return NULL;
@@ -63,7 +61,7 @@ struct fpm_event_module_s *fpm_event_devpoll_module() /* {{{ */
}
/* }}} */
-#if HAVE_DEVPOLL
+#ifdef HAVE_DEVPOLL
/*
* Init module
diff --git a/sapi/fpm/fpm/events/devpoll.h b/sapi/fpm/fpm/events/devpoll.h
index d8ff66bf95..b05a456924 100644
--- a/sapi/fpm/fpm/events/devpoll.h
+++ b/sapi/fpm/fpm/events/devpoll.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/sapi/fpm/fpm/events/epoll.c b/sapi/fpm/fpm/events/epoll.c
index 4701339e78..9973ac0ddc 100644
--- a/sapi/fpm/fpm/events/epoll.c
+++ b/sapi/fpm/fpm/events/epoll.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
@@ -21,7 +19,7 @@
#include "../fpm.h"
#include "../zlog.h"
-#if HAVE_EPOLL
+#ifdef HAVE_EPOLL
#include <sys/epoll.h>
#include <errno.h>
@@ -50,7 +48,7 @@ static int epollfd = -1;
struct fpm_event_module_s *fpm_event_epoll_module() /* {{{ */
{
-#if HAVE_EPOLL
+#ifdef HAVE_EPOLL
return &epoll_module;
#else
return NULL;
@@ -58,7 +56,7 @@ struct fpm_event_module_s *fpm_event_epoll_module() /* {{{ */
}
/* }}} */
-#if HAVE_EPOLL
+#ifdef HAVE_EPOLL
/*
* Init the module
diff --git a/sapi/fpm/fpm/events/epoll.h b/sapi/fpm/fpm/events/epoll.h
index 783a2d25af..2469cbeaee 100644
--- a/sapi/fpm/fpm/events/epoll.h
+++ b/sapi/fpm/fpm/events/epoll.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/sapi/fpm/fpm/events/kqueue.c b/sapi/fpm/fpm/events/kqueue.c
index c5d1b4f003..69a3f24057 100644
--- a/sapi/fpm/fpm/events/kqueue.c
+++ b/sapi/fpm/fpm/events/kqueue.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
@@ -21,7 +19,7 @@
#include "../fpm.h"
#include "../zlog.h"
-#if HAVE_KQUEUE
+#ifdef HAVE_KQUEUE
#include <sys/types.h>
#include <sys/event.h>
@@ -56,7 +54,7 @@ static int kfd = 0;
*/
struct fpm_event_module_s *fpm_event_kqueue_module() /* {{{ */
{
-#if HAVE_KQUEUE
+#ifdef HAVE_KQUEUE
return &kqueue_module;
#else
return NULL;
@@ -64,7 +62,7 @@ struct fpm_event_module_s *fpm_event_kqueue_module() /* {{{ */
}
/* }}} */
-#if HAVE_KQUEUE
+#ifdef HAVE_KQUEUE
/*
* init kqueue and stuff
diff --git a/sapi/fpm/fpm/events/kqueue.h b/sapi/fpm/fpm/events/kqueue.h
index a09651b3b3..93db17fd7c 100644
--- a/sapi/fpm/fpm/events/kqueue.h
+++ b/sapi/fpm/fpm/events/kqueue.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/sapi/fpm/fpm/events/poll.c b/sapi/fpm/fpm/events/poll.c
index ced32d0215..0363c2ece1 100644
--- a/sapi/fpm/fpm/events/poll.c
+++ b/sapi/fpm/fpm/events/poll.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
@@ -21,7 +19,7 @@
#include "../fpm.h"
#include "../zlog.h"
-#if HAVE_POLL
+#ifdef HAVE_POLL
#include <poll.h>
#include <errno.h>
@@ -54,7 +52,7 @@ static int next_free_slot = 0;
*/
struct fpm_event_module_s *fpm_event_poll_module() /* {{{ */
{
-#if HAVE_POLL
+#ifdef HAVE_POLL
return &poll_module;
#else
return NULL;
@@ -62,7 +60,7 @@ struct fpm_event_module_s *fpm_event_poll_module() /* {{{ */
}
/* }}} */
-#if HAVE_POLL
+#ifdef HAVE_POLL
/*
* Init the module
@@ -218,7 +216,7 @@ static int fpm_event_poll_add(struct fpm_event_s *ev) /* {{{ */
return 0;
}
- zlog(ZLOG_ERROR, "poll: not enought space to add event (fd=%d)", ev->fd);
+ zlog(ZLOG_ERROR, "poll: not enough space to add event (fd=%d)", ev->fd);
return -1;
}
/* }}} */
diff --git a/sapi/fpm/fpm/events/poll.h b/sapi/fpm/fpm/events/poll.h
index 1a89f31102..371ecf1604 100644
--- a/sapi/fpm/fpm/events/poll.h
+++ b/sapi/fpm/fpm/events/poll.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/sapi/fpm/fpm/events/port.c b/sapi/fpm/fpm/events/port.c
index 1ffcd20a0d..d9aee3bfcd 100644
--- a/sapi/fpm/fpm/events/port.c
+++ b/sapi/fpm/fpm/events/port.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
@@ -21,7 +19,7 @@
#include "../fpm.h"
#include "../zlog.h"
-#if HAVE_PORT
+#ifdef HAVE_PORT
#include <port.h>
#include <poll.h>
@@ -51,7 +49,7 @@ static int pfd = -1;
struct fpm_event_module_s *fpm_event_port_module() /* {{{ */
{
-#if HAVE_PORT
+#ifdef HAVE_PORT
return &port_module;
#else
return NULL;
@@ -59,7 +57,7 @@ struct fpm_event_module_s *fpm_event_port_module() /* {{{ */
}
/* }}} */
-#if HAVE_PORT
+#ifdef HAVE_PORT
/*
* Init the module
diff --git a/sapi/fpm/fpm/events/port.h b/sapi/fpm/fpm/events/port.h
index 7329b2dff5..ced1d05c82 100644
--- a/sapi/fpm/fpm/events/port.h
+++ b/sapi/fpm/fpm/events/port.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/sapi/fpm/fpm/events/select.c b/sapi/fpm/fpm/events/select.c
index d69ac7f5dd..61b33c5569 100644
--- a/sapi/fpm/fpm/events/select.c
+++ b/sapi/fpm/fpm/events/select.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
@@ -21,7 +19,7 @@
#include "../fpm.h"
#include "../zlog.h"
-#if HAVE_SELECT
+#ifdef HAVE_SELECT
/* According to POSIX.1-2001 */
#include <sys/select.h>
@@ -57,7 +55,7 @@ static fd_set fds;
*/
struct fpm_event_module_s *fpm_event_select_module() /* {{{ */
{
-#if HAVE_SELECT
+#ifdef HAVE_SELECT
return &select_module;
#else
return NULL;
@@ -65,7 +63,7 @@ struct fpm_event_module_s *fpm_event_select_module() /* {{{ */
}
/* }}} */
-#if HAVE_SELECT
+#ifdef HAVE_SELECT
/*
* Init the module
diff --git a/sapi/fpm/fpm/events/select.h b/sapi/fpm/fpm/events/select.h
index 3b8445537f..7fc6d017a3 100644
--- a/sapi/fpm/fpm/events/select.h
+++ b/sapi/fpm/fpm/events/select.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/sapi/fpm/fpm/fpm_atomic.h b/sapi/fpm/fpm/fpm_atomic.h
index ec9e4f197d..1bb6106e45 100644
--- a/sapi/fpm/fpm/fpm_atomic.h
+++ b/sapi/fpm/fpm/fpm_atomic.h
@@ -3,11 +3,7 @@
#ifndef FPM_ATOMIC_H
#define FPM_ATOMIC_H 1
-#if HAVE_INTTYPES_H
-# include <inttypes.h>
-#else
-# include <stdint.h>
-#endif
+#include <inttypes.h>
#include <sched.h>
#ifdef HAVE_BUILTIN_ATOMIC
diff --git a/sapi/fpm/fpm/fpm_children.c b/sapi/fpm/fpm/fpm_children.c
index fd121372f3..fe92bdf1b0 100644
--- a/sapi/fpm/fpm/fpm_children.c
+++ b/sapi/fpm/fpm/fpm_children.c
@@ -346,7 +346,7 @@ static void fpm_child_resources_use(struct fpm_child_s *child) /* {{{ */
{
struct fpm_worker_pool_s *wp;
for (wp = fpm_worker_all_pools; wp; wp = wp->next) {
- if (wp == child->wp) {
+ if (wp == child->wp || wp == child->wp->shared) {
continue;
}
fpm_scoreboard_free(wp->scoreboard);
diff --git a/sapi/fpm/fpm/fpm_clock.c b/sapi/fpm/fpm/fpm_clock.c
index 8568d7928f..cd0bb7320c 100644
--- a/sapi/fpm/fpm/fpm_clock.c
+++ b/sapi/fpm/fpm/fpm_clock.c
@@ -2,7 +2,7 @@
#include "fpm_config.h"
-#if defined(HAVE_CLOCK_GETTIME)
+#ifdef HAVE_CLOCK_GETTIME
#include <time.h> /* for CLOCK_MONOTONIC */
#endif
diff --git a/sapi/fpm/fpm/fpm_conf.c b/sapi/fpm/fpm/fpm_conf.c
index 7a05286309..42f75a475d 100644
--- a/sapi/fpm/fpm/fpm_conf.c
+++ b/sapi/fpm/fpm/fpm_conf.c
@@ -9,11 +9,7 @@
#include <stdlib.h>
#include <stddef.h>
#include <string.h>
-#if HAVE_INTTYPES_H
-# include <inttypes.h>
-#else
-# include <stdint.h>
-#endif
+#include <inttypes.h>
#ifdef HAVE_GLOB
# include <glob.h>
#endif
@@ -139,6 +135,7 @@ static struct ini_value_parser_s ini_fpm_pool_options[] = {
{ "pm.process_idle_timeout", &fpm_conf_set_time, WPO(pm_process_idle_timeout) },
{ "pm.max_requests", &fpm_conf_set_integer, WPO(pm_max_requests) },
{ "pm.status_path", &fpm_conf_set_string, WPO(pm_status_path) },
+ { "pm.status_listen", &fpm_conf_set_string, WPO(pm_status_listen) },
{ "ping.path", &fpm_conf_set_string, WPO(ping_path) },
{ "ping.response", &fpm_conf_set_string, WPO(ping_response) },
{ "access.log", &fpm_conf_set_string, WPO(access_log) },
@@ -686,6 +683,55 @@ int fpm_worker_pool_config_free(struct fpm_worker_pool_config_s *wpc) /* {{{ */
}
/* }}} */
+#define FPM_WPC_STR_CP_EX(_cfg, _scfg, _sf, _df) \
+ do { \
+ if (_scfg->_df && !(_cfg->_sf = strdup(_scfg->_df))) { \
+ return -1; \
+ } \
+ } while (0)
+#define FPM_WPC_STR_CP(_cfg, _scfg, _field) FPM_WPC_STR_CP_EX(_cfg, _scfg, _field, _field)
+
+static int fpm_worker_pool_shared_status_alloc(struct fpm_worker_pool_s *shared_wp) { /* {{{ */
+ struct fpm_worker_pool_config_s *config, *shared_config;
+ config = fpm_worker_pool_config_alloc();
+ if (!config) {
+ return -1;
+ }
+ shared_config = shared_wp->config;
+
+ config->name = malloc(strlen(shared_config->name) + sizeof("_status"));
+ if (!config->name) {
+ return -1;
+ }
+ strcpy(config->name, shared_config->name);
+ strcpy(config->name + strlen(shared_config->name), "_status");
+
+ if (!shared_config->pm_status_path) {
+ shared_config->pm_status_path = strdup("/");
+ }
+
+ FPM_WPC_STR_CP_EX(config, shared_config, listen_address, pm_status_listen);
+#ifdef HAVE_FPM_ACL
+ FPM_WPC_STR_CP(config, shared_config, listen_acl_groups);
+ FPM_WPC_STR_CP(config, shared_config, listen_acl_users);
+#endif
+ FPM_WPC_STR_CP(config, shared_config, listen_allowed_clients);
+ FPM_WPC_STR_CP(config, shared_config, listen_group);
+ FPM_WPC_STR_CP(config, shared_config, listen_owner);
+ FPM_WPC_STR_CP(config, shared_config, listen_mode);
+ FPM_WPC_STR_CP(config, shared_config, user);
+ FPM_WPC_STR_CP(config, shared_config, group);
+ FPM_WPC_STR_CP(config, shared_config, pm_status_path);
+
+ config->pm = PM_STYLE_ONDEMAND;
+ config->pm_max_children = 2;
+
+ current_wp->shared = shared_wp;
+
+ return 0;
+}
+/* }}} */
+
static int fpm_evaluate_full_path(char **path, struct fpm_worker_pool_s *wp, char *default_prefix, int expand) /* {{{ */
{
char *prefix = NULL;
@@ -860,6 +906,10 @@ static int fpm_conf_process_all_pools() /* {{{ */
}
/* status */
+ if (wp->config->pm_status_listen && fpm_worker_pool_shared_status_alloc(wp)) {
+ zlog(ZLOG_ERROR, "[pool %s] failed to initialize a status listener pool", wp->config->name);
+ }
+
if (wp->config->pm_status_path && *wp->config->pm_status_path) {
size_t i;
char *status = wp->config->pm_status_path;
@@ -869,7 +919,7 @@ static int fpm_conf_process_all_pools() /* {{{ */
return -1;
}
- if (strlen(status) < 2) {
+ if (!wp->config->pm_status_listen && !wp->shared && strlen(status) < 2) {
zlog(ZLOG_ERROR, "[pool %s] the status path '%s' is not long enough", wp->config->name, status);
return -1;
}
@@ -899,7 +949,7 @@ static int fpm_conf_process_all_pools() /* {{{ */
for (i = 0; i < strlen(ping); i++) {
if (!isalnum(ping[i]) && ping[i] != '/' && ping[i] != '-' && ping[i] != '_' && ping[i] != '.' && ping[i] != '~') {
- zlog(ZLOG_ERROR, "[pool %s] the ping path '%s' must containt only the following characters '[alphanum]/_-.~'", wp->config->name, ping);
+ zlog(ZLOG_ERROR, "[pool %s] the ping path '%s' must contain only the following characters '[alphanum]/_-.~'", wp->config->name, ping);
return -1;
}
}
@@ -1538,7 +1588,7 @@ int fpm_conf_load_ini_file(char *filename) /* {{{ */
}
if (ini_recursion++ > 4) {
- zlog(ZLOG_ERROR, "failed to include more than 5 files recusively");
+ zlog(ZLOG_ERROR, "failed to include more than 5 files recursively");
close(fd);
return -1;
}
@@ -1638,7 +1688,11 @@ static void fpm_conf_dump() /* {{{ */
for (wp = fpm_worker_all_pools; wp; wp = wp->next) {
struct key_value_s *kv;
- if (!wp->config) continue;
+
+ if (!wp->config || wp->shared) {
+ continue;
+ }
+
zlog(ZLOG_NOTICE, "[%s]", STR2STR(wp->config->name));
zlog(ZLOG_NOTICE, "\tprefix = %s", STR2STR(wp->config->prefix));
zlog(ZLOG_NOTICE, "\tuser = %s", STR2STR(wp->config->user));
@@ -1667,6 +1721,7 @@ static void fpm_conf_dump() /* {{{ */
zlog(ZLOG_NOTICE, "\tpm.process_idle_timeout = %d", wp->config->pm_process_idle_timeout);
zlog(ZLOG_NOTICE, "\tpm.max_requests = %d", wp->config->pm_max_requests);
zlog(ZLOG_NOTICE, "\tpm.status_path = %s", STR2STR(wp->config->pm_status_path));
+ zlog(ZLOG_NOTICE, "\tpm.status_listen = %s", STR2STR(wp->config->pm_status_listen));
zlog(ZLOG_NOTICE, "\tping.path = %s", STR2STR(wp->config->ping_path));
zlog(ZLOG_NOTICE, "\tping.response = %s", STR2STR(wp->config->ping_response));
zlog(ZLOG_NOTICE, "\taccess.log = %s", STR2STR(wp->config->access_log));
diff --git a/sapi/fpm/fpm/fpm_conf.h b/sapi/fpm/fpm/fpm_conf.h
index 42fa3cca2e..cd71bb53fd 100644
--- a/sapi/fpm/fpm/fpm_conf.h
+++ b/sapi/fpm/fpm/fpm_conf.h
@@ -73,6 +73,7 @@ struct fpm_worker_pool_config_s {
int pm_process_idle_timeout;
int pm_max_requests;
char *pm_status_path;
+ char *pm_status_listen;
char *ping_path;
char *ping_response;
char *access_log;
diff --git a/sapi/fpm/fpm/fpm_events.c b/sapi/fpm/fpm/fpm_events.c
index 86592050c6..35b0ef8bb0 100644
--- a/sapi/fpm/fpm/fpm_events.c
+++ b/sapi/fpm/fpm/fpm_events.c
@@ -83,7 +83,7 @@ static void fpm_got_signal(struct fpm_event_s *ev, short which, void *arg) /* {{
/* epoll_wait() may report signal fd before read events for a finished child
* in the same bunch of events. Prevent immediate free of the child structure
* and so the fpm_event_s instance. Otherwise use after free happens during
- * attemp to process following read event. */
+ * attempt to process following read event. */
fpm_event_set_timer(&children_bury_timer, 0, &fpm_postponed_children_bury, NULL);
fpm_event_add(&children_bury_timer, 0);
break;
diff --git a/sapi/fpm/fpm/fpm_log.c b/sapi/fpm/fpm/fpm_log.c
index a09e80a490..6f1e517a9f 100644
--- a/sapi/fpm/fpm/fpm_log.c
+++ b/sapi/fpm/fpm/fpm_log.c
@@ -310,7 +310,7 @@ int fpm_log_write(char *log_format) /* {{{ */
continue;
}
- /* test if enought char after the header name + ': ' */
+ /* test if enough char after the header name + ': ' */
if (h->header_len <= format_len + 2) {
h = (sapi_header_struct*)zend_llist_get_next_ex(&sapi_headers->headers, &pos);
continue;
diff --git a/sapi/fpm/fpm/fpm_main.c b/sapi/fpm/fpm/fpm_main.c
index 7505afde76..c849a35980 100644
--- a/sapi/fpm/fpm/fpm_main.c
+++ b/sapi/fpm/fpm/fpm_main.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
@@ -35,11 +33,11 @@
#include <stdio.h>
#include "php.h"
-#if HAVE_SYS_TIME_H
+#ifdef HAVE_SYS_TIME_H
# include <sys/time.h>
#endif
-#if HAVE_UNISTD_H
+#ifdef HAVE_UNISTD_H
# include <unistd.h>
#endif
@@ -47,15 +45,15 @@
#include <locale.h>
-#if HAVE_SYS_TYPES_H
+#ifdef HAVE_SYS_TYPES_H
# include <sys/types.h>
#endif
-#if HAVE_SYS_WAIT_H
+#ifdef HAVE_SYS_WAIT_H
# include <sys/wait.h>
#endif
-#if HAVE_FCNTL_H
+#ifdef HAVE_FCNTL_H
# include <fcntl.h>
#endif
@@ -84,6 +82,7 @@ int __riscosify_control = __RISCOSIFY_STRICT_UNIX_SPECS;
#include <php_config.h>
#include "fpm.h"
+#include "fpm_main_arginfo.h"
#include "fpm_request.h"
#include "fpm_status.h"
#include "fpm_signals.h"
@@ -108,7 +107,7 @@ static int parent = 1;
static int request_body_fd;
static int fpm_is_running = 0;
-static char *sapi_cgibin_getenv(char *name, size_t name_len);
+static char *sapi_cgibin_getenv(const char *name, size_t name_len);
static void fastcgi_ini_parser(zval *arg1, zval *arg2, zval *arg3, int callback_type, void *arg);
#define PHP_MODE_STANDARD 1
@@ -186,11 +185,8 @@ static php_cgi_globals_struct php_cgi_globals;
#define CGIG(v) (php_cgi_globals.v)
#endif
-static int module_name_cmp(const void *a, const void *b) /* {{{ */
+static int module_name_cmp(Bucket *f, Bucket *s) /* {{{ */
{
- Bucket *f = (Bucket *) a;
- Bucket *s = (Bucket *) b;
-
return strcasecmp( ((zend_module_entry *) Z_PTR(f->val))->name,
((zend_module_entry *) Z_PTR(s->val))->name);
}
@@ -211,10 +207,9 @@ static void print_modules(void) /* {{{ */
}
/* }}} */
-static int print_extension_info(zend_extension *ext, void *arg) /* {{{ */
+static void print_extension_info(zend_extension *ext) /* {{{ */
{
php_printf("%s\n", ext->name);
- return 0;
}
/* }}} */
@@ -233,7 +228,7 @@ static void print_extensions(void) /* {{{ */
zend_llist_copy(&sorted_exts, &zend_extensions);
sorted_exts.dtor = NULL;
zend_llist_sort(&sorted_exts, extension_name_cmp);
- zend_llist_apply_with_argument(&sorted_exts, (llist_apply_with_arg_func_t) print_extension_info, NULL);
+ zend_llist_apply(&sorted_exts, (llist_apply_func_t) print_extension_info);
zend_llist_destroy(&sorted_exts);
}
/* }}} */
@@ -246,7 +241,7 @@ static inline size_t sapi_cgibin_single_write(const char *str, uint32_t str_leng
{
ssize_t ret;
- /* sapi has started which means everyhting must be send through fcgi */
+ /* sapi has started which means everything must be send through fcgi */
if (fpm_is_running) {
fcgi_request *request = (fcgi_request*) SG(server_context);
ret = fcgi_write(request, FCGI_STDOUT, str, str_length);
@@ -469,7 +464,7 @@ static size_t sapi_cgi_read_post(char *buffer, size_t count_bytes) /* {{{ */
}
/* }}} */
-static char *sapi_cgibin_getenv(char *name, size_t name_len) /* {{{ */
+static char *sapi_cgibin_getenv(const char *name, size_t name_len) /* {{{ */
{
/* if fpm has started, use fcgi env */
if (fpm_is_running) {
@@ -506,10 +501,10 @@ static char *sapi_cgi_read_cookies(void) /* {{{ */
}
/* }}} */
-static void cgi_php_load_env_var(char *var, unsigned int var_len, char *val, unsigned int val_len, void *arg) /* {{{ */
+static void cgi_php_load_env_var(const char *var, unsigned int var_len, char *val, unsigned int val_len, void *arg) /* {{{ */
{
- zval *array_ptr = (zval*)arg;
- int filter_arg = (Z_ARR_P(array_ptr) == Z_ARR(PG(http_globals)[TRACK_VARS_ENV]))?PARSE_ENV:PARSE_SERVER;
+ zval *array_ptr = (zval *) arg;
+ int filter_arg = (Z_ARR_P(array_ptr) == Z_ARR(PG(http_globals)[TRACK_VARS_ENV])) ? PARSE_ENV : PARSE_SERVER;
size_t new_val_len;
if (sapi_module.input_filter(filter_arg, var, &val, strlen(val), &new_val_len)) {
@@ -610,16 +605,14 @@ void sapi_cgi_log_fastcgi(int level, char *message, size_t len)
}
/* }}} */
-/* {{{ sapi_cgi_log_message
- */
-static void sapi_cgi_log_message(char *message, int syslog_type_int)
+/* {{{ sapi_cgi_log_message */
+static void sapi_cgi_log_message(const char *message, int syslog_type_int)
{
zlog_msg(ZLOG_NOTICE, "PHP message: ", message);
}
/* }}} */
-/* {{{ php_cgi_ini_activate_user_config
- */
+/* {{{ php_cgi_ini_activate_user_config */
static void php_cgi_ini_activate_user_config(char *path, int path_len, const char *doc_root, int doc_root_len)
{
char *ptr;
@@ -779,8 +772,7 @@ static int php_cgi_startup(sapi_module_struct *sapi_module) /* {{{ */
}
/* }}} */
-/* {{{ sapi_module_struct cgi_sapi_module
- */
+/* {{{ sapi_module_struct cgi_sapi_module */
static sapi_module_struct cgi_sapi_module = {
"fpm-fcgi", /* name */
"FPM/FastCGI", /* pretty name */
@@ -814,8 +806,7 @@ static sapi_module_struct cgi_sapi_module = {
};
/* }}} */
-/* {{{ php_cgi_usage
- */
+/* {{{ php_cgi_usage */
static void php_cgi_usage(char *argv0)
{
char *prog;
@@ -893,7 +884,7 @@ static int is_valid_path(const char *path)
initializes request_info structure
- specificly in this section we handle proper translations
+ specifically in this section we handle proper translations
for:
PATH_INFO
@@ -1392,19 +1383,18 @@ static void fastcgi_ini_parser(zval *arg1, zval *arg2, zval *arg3, int callback_
/* }}} */
PHP_INI_BEGIN()
- STD_PHP_INI_ENTRY("cgi.rfc2616_headers", "0", PHP_INI_ALL, OnUpdateBool, rfc2616_headers, php_cgi_globals_struct, php_cgi_globals)
- STD_PHP_INI_ENTRY("cgi.nph", "0", PHP_INI_ALL, OnUpdateBool, nph, php_cgi_globals_struct, php_cgi_globals)
- STD_PHP_INI_ENTRY("cgi.force_redirect", "1", PHP_INI_SYSTEM, OnUpdateBool, force_redirect, php_cgi_globals_struct, php_cgi_globals)
+ STD_PHP_INI_BOOLEAN("cgi.rfc2616_headers", "0", PHP_INI_ALL, OnUpdateBool, rfc2616_headers, php_cgi_globals_struct, php_cgi_globals)
+ STD_PHP_INI_BOOLEAN("cgi.nph", "0", PHP_INI_ALL, OnUpdateBool, nph, php_cgi_globals_struct, php_cgi_globals)
+ STD_PHP_INI_BOOLEAN("cgi.force_redirect", "1", PHP_INI_SYSTEM, OnUpdateBool, force_redirect, php_cgi_globals_struct, php_cgi_globals)
STD_PHP_INI_ENTRY("cgi.redirect_status_env", NULL, PHP_INI_SYSTEM, OnUpdateString, redirect_status_env, php_cgi_globals_struct, php_cgi_globals)
- STD_PHP_INI_ENTRY("cgi.fix_pathinfo", "1", PHP_INI_SYSTEM, OnUpdateBool, fix_pathinfo, php_cgi_globals_struct, php_cgi_globals)
- STD_PHP_INI_ENTRY("cgi.discard_path", "0", PHP_INI_SYSTEM, OnUpdateBool, discard_path, php_cgi_globals_struct, php_cgi_globals)
- STD_PHP_INI_ENTRY("fastcgi.logging", "1", PHP_INI_SYSTEM, OnUpdateBool, fcgi_logging, php_cgi_globals_struct, php_cgi_globals)
+ STD_PHP_INI_BOOLEAN("cgi.fix_pathinfo", "1", PHP_INI_SYSTEM, OnUpdateBool, fix_pathinfo, php_cgi_globals_struct, php_cgi_globals)
+ STD_PHP_INI_BOOLEAN("cgi.discard_path", "0", PHP_INI_SYSTEM, OnUpdateBool, discard_path, php_cgi_globals_struct, php_cgi_globals)
+ STD_PHP_INI_BOOLEAN("fastcgi.logging", "1", PHP_INI_SYSTEM, OnUpdateBool, fcgi_logging, php_cgi_globals_struct, php_cgi_globals)
STD_PHP_INI_ENTRY("fastcgi.error_header", NULL, PHP_INI_SYSTEM, OnUpdateString, error_header, php_cgi_globals_struct, php_cgi_globals)
STD_PHP_INI_ENTRY("fpm.config", NULL, PHP_INI_SYSTEM, OnUpdateString, fpm_config, php_cgi_globals_struct, php_cgi_globals)
PHP_INI_END()
-/* {{{ php_cgi_globals_ctor
- */
+/* {{{ php_cgi_globals_ctor */
static void php_cgi_globals_ctor(php_cgi_globals_struct *php_cgi_globals)
{
php_cgi_globals->rfc2616_headers = 0;
@@ -1420,8 +1410,7 @@ static void php_cgi_globals_ctor(php_cgi_globals_struct *php_cgi_globals)
}
/* }}} */
-/* {{{ PHP_MINIT_FUNCTION
- */
+/* {{{ PHP_MINIT_FUNCTION */
static PHP_MINIT_FUNCTION(cgi)
{
#ifdef ZTS
@@ -1434,8 +1423,7 @@ static PHP_MINIT_FUNCTION(cgi)
}
/* }}} */
-/* {{{ PHP_MSHUTDOWN_FUNCTION
- */
+/* {{{ PHP_MSHUTDOWN_FUNCTION */
static PHP_MSHUTDOWN_FUNCTION(cgi)
{
zend_hash_destroy(&CGIG(user_config_cache));
@@ -1445,8 +1433,7 @@ static PHP_MSHUTDOWN_FUNCTION(cgi)
}
/* }}} */
-/* {{{ PHP_MINFO_FUNCTION
- */
+/* {{{ PHP_MINFO_FUNCTION */
static PHP_MINFO_FUNCTION(cgi)
{
php_info_print_table_start();
@@ -1457,15 +1444,12 @@ static PHP_MINFO_FUNCTION(cgi)
}
/* }}} */
-ZEND_BEGIN_ARG_INFO(cgi_fcgi_sapi_no_arginfo, 0)
-ZEND_END_ARG_INFO()
-
PHP_FUNCTION(fastcgi_finish_request) /* {{{ */
{
fcgi_request *request = (fcgi_request*) SG(server_context);
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
if (!fcgi_is_closed(request)) {
@@ -1487,7 +1471,7 @@ PHP_FUNCTION(apache_request_headers) /* {{{ */
fcgi_request *request;
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
array_init(return_value);
@@ -1496,12 +1480,11 @@ PHP_FUNCTION(apache_request_headers) /* {{{ */
}
} /* }}} */
-/* {{{ proto array fpm_get_status
- * Returns the status of the fastcgi process manager */
+/* {{{ Returns the status of the fastcgi process manager */
PHP_FUNCTION(fpm_get_status) /* {{{ */
{
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
if (fpm_status_export_to_zval(return_value)) {
@@ -1510,18 +1493,10 @@ PHP_FUNCTION(fpm_get_status) /* {{{ */
}
/* }}} */
-static const zend_function_entry cgi_fcgi_sapi_functions[] = {
- PHP_FE(fastcgi_finish_request, cgi_fcgi_sapi_no_arginfo)
- PHP_FE(fpm_get_status, cgi_fcgi_sapi_no_arginfo)
- PHP_FE(apache_request_headers, cgi_fcgi_sapi_no_arginfo)
- PHP_FALIAS(getallheaders, apache_request_headers, cgi_fcgi_sapi_no_arginfo)
- PHP_FE_END
-};
-
static zend_module_entry cgi_module_entry = {
STANDARD_MODULE_HEADER,
"cgi-fcgi",
- cgi_fcgi_sapi_functions,
+ ext_functions,
PHP_MINIT(cgi),
PHP_MSHUTDOWN(cgi),
NULL,
@@ -1531,8 +1506,7 @@ static zend_module_entry cgi_module_entry = {
STANDARD_MODULE_PROPERTIES
};
-/* {{{ main
- */
+/* {{{ main */
int main(int argc, char *argv[])
{
int exit_status = FPM_EXIT_OK;
@@ -1807,7 +1781,7 @@ consult the installation file that came with this distribution, or visit \n\
<a href=\"http://php.net/install.windows\">the manual page</a>.</p>\n");
} zend_catch {
} zend_end_try();
-#if defined(ZTS) && !defined(PHP_DEBUG)
+#if defined(ZTS) && !PHP_DEBUG
/* XXX we're crashing here in msvc6 debug builds at
* php_message_handler_for_zend:839 because
* SG(request_info).path_translated is an invalid pointer.
@@ -1909,7 +1883,7 @@ consult the installation file that came with this distribution, or visit \n\
}
/*
- * have to duplicate SG(request_info).path_translated to be able to log errrors
+ * have to duplicate SG(request_info).path_translated to be able to log errors
* php_fopen_primary_script seems to delete SG(request_info).path_translated on failure
*/
primary_script = estrdup(SG(request_info).path_translated);
diff --git a/sapi/fpm/fpm/fpm_main.stub.php b/sapi/fpm/fpm/fpm_main.stub.php
new file mode 100644
index 0000000000..5d1883c6dd
--- /dev/null
+++ b/sapi/fpm/fpm/fpm_main.stub.php
@@ -0,0 +1,12 @@
+<?php
+
+/** @generate-function-entries */
+
+function fastcgi_finish_request(): bool {}
+
+function apache_request_headers(): array {}
+
+/** @alias apache_request_headers */
+function getallheaders(): array {}
+
+function fpm_get_status(): array|false {}
diff --git a/sapi/fpm/fpm/fpm_main_arginfo.h b/sapi/fpm/fpm/fpm_main_arginfo.h
new file mode 100644
index 0000000000..709ee60df2
--- /dev/null
+++ b/sapi/fpm/fpm/fpm_main_arginfo.h
@@ -0,0 +1,27 @@
+/* This is a generated file, edit the .stub.php file instead.
+ * Stub hash: 0888f3ba14649f0be06d47410221381bace54936 */
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_fastcgi_finish_request, 0, 0, _IS_BOOL, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_apache_request_headers, 0, 0, IS_ARRAY, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_getallheaders arginfo_apache_request_headers
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_fpm_get_status, 0, 0, MAY_BE_ARRAY|MAY_BE_FALSE)
+ZEND_END_ARG_INFO()
+
+
+ZEND_FUNCTION(fastcgi_finish_request);
+ZEND_FUNCTION(apache_request_headers);
+ZEND_FUNCTION(fpm_get_status);
+
+
+static const zend_function_entry ext_functions[] = {
+ ZEND_FE(fastcgi_finish_request, arginfo_fastcgi_finish_request)
+ ZEND_FE(apache_request_headers, arginfo_apache_request_headers)
+ ZEND_FALIAS(getallheaders, apache_request_headers, arginfo_getallheaders)
+ ZEND_FE(fpm_get_status, arginfo_fpm_get_status)
+ ZEND_FE_END
+};
diff --git a/sapi/fpm/fpm/fpm_php.c b/sapi/fpm/fpm/fpm_php.c
index d940ba661c..96648f4437 100644
--- a/sapi/fpm/fpm/fpm_php.c
+++ b/sapi/fpm/fpm/fpm_php.c
@@ -48,7 +48,7 @@ static int fpm_php_zend_ini_alter_master(char *name, int name_length, char *new_
}
/* }}} */
-static void fpm_php_disable(char *value, int (*zend_disable)(char *, size_t)) /* {{{ */
+static void fpm_php_disable(char *value, int (*zend_disable)(const char *, size_t)) /* {{{ */
{
char *s = 0, *e = value;
@@ -96,9 +96,7 @@ int fpm_php_apply_defines_ex(struct key_value_s *kv, int mode) /* {{{ */
}
if (!strcmp(name, "disable_functions") && *value) {
- char *v = strdup(value);
- PG(disable_functions) = v;
- fpm_php_disable(v, zend_disable_function);
+ zend_disable_functions(value);
return 1;
}
diff --git a/sapi/fpm/fpm/fpm_php_trace.c b/sapi/fpm/fpm/fpm_php_trace.c
index cfdcf65094..0e1d8e3f6c 100644
--- a/sapi/fpm/fpm/fpm_php_trace.c
+++ b/sapi/fpm/fpm/fpm_php_trace.c
@@ -9,11 +9,7 @@
#include <stdio.h>
#include <stddef.h>
-#if HAVE_INTTYPES_H
-# include <inttypes.h>
-#else
-# include <stdint.h>
-#endif
+#include <inttypes.h>
#include <unistd.h>
#include <sys/time.h>
#include <sys/types.h>
@@ -104,7 +100,7 @@ static int fpm_php_trace_dump(struct fpm_child_s *child, FILE *slowlog) /* {{{ *
} else if (ZEND_CALL_KIND_EX(*call_info) == ZEND_CALL_NESTED_CODE) {
memcpy(buf, "[INCLUDE_OR_EVAL]", sizeof("[INCLUDE_OR_EVAL]"));
} else {
- ZEND_ASSERT(0);
+ ZEND_UNREACHABLE();
}
} else {
if (0 > fpm_trace_get_strz(buf, buf_size, function_name + offsetof(zend_string, val))) {
diff --git a/sapi/fpm/fpm/fpm_process_ctl.c b/sapi/fpm/fpm/fpm_process_ctl.c
index 2bc00178ea..a2f0f935e4 100644
--- a/sapi/fpm/fpm/fpm_process_ctl.c
+++ b/sapi/fpm/fpm/fpm_process_ctl.c
@@ -390,7 +390,7 @@ static void fpm_pctl_perform_idle_server_maintenance(struct timeval *now) /* {{{
if (idle < wp->config->pm_min_spare_servers) {
if (wp->running_children >= wp->config->pm_max_children) {
- if (!wp->warn_max_children) {
+ if (!wp->warn_max_children && !wp->shared) {
fpm_scoreboard_update(0, 0, 0, 0, 0, 1, 0, FPM_SCOREBOARD_ACTION_INC, wp->scoreboard);
zlog(ZLOG_WARNING, "[pool %s] server reached pm.max_children setting (%d), consider raising it", wp->config->name, wp->config->pm_max_children);
wp->warn_max_children = 1;
@@ -409,7 +409,7 @@ static void fpm_pctl_perform_idle_server_maintenance(struct timeval *now) /* {{{
/* get sure it won't exceed max_children */
children_to_fork = MIN(children_to_fork, wp->config->pm_max_children - wp->running_children);
if (children_to_fork <= 0) {
- if (!wp->warn_max_children) {
+ if (!wp->warn_max_children && !wp->shared) {
fpm_scoreboard_update(0, 0, 0, 0, 0, 1, 0, FPM_SCOREBOARD_ACTION_INC, wp->scoreboard);
zlog(ZLOG_WARNING, "[pool %s] server reached pm.max_children setting (%d), consider raising it", wp->config->name, wp->config->pm_max_children);
wp->warn_max_children = 1;
@@ -513,7 +513,7 @@ void fpm_pctl_on_socket_accept(struct fpm_event_s *ev, short which, void *arg) /
/* zlog(ZLOG_DEBUG, "[pool %s] heartbeat running_children=%d", wp->config->name, wp->running_children);*/
if (wp->running_children >= wp->config->pm_max_children) {
- if (!wp->warn_max_children) {
+ if (!wp->warn_max_children && !wp->shared) {
fpm_scoreboard_update(0, 0, 0, 0, 0, 1, 0, FPM_SCOREBOARD_ACTION_INC, wp->scoreboard);
zlog(ZLOG_WARNING, "[pool %s] server reached max_children setting (%d), consider raising it", wp->config->name, wp->config->pm_max_children);
wp->warn_max_children = 1;
@@ -528,7 +528,6 @@ void fpm_pctl_on_socket_accept(struct fpm_event_s *ev, short which, void *arg) /
return;
}
}
-
wp->warn_max_children = 0;
fpm_children_make(wp, 1, 1, 1);
diff --git a/sapi/fpm/fpm/fpm_request.h b/sapi/fpm/fpm/fpm_request.h
index 15bce58e4b..4d287427d6 100644
--- a/sapi/fpm/fpm/fpm_request.h
+++ b/sapi/fpm/fpm/fpm_request.h
@@ -3,12 +3,18 @@
#ifndef FPM_REQUEST_H
#define FPM_REQUEST_H 1
-void fpm_request_accepting(); /* hanging in accept() */
-void fpm_request_reading_headers(); /* start reading fastcgi request from very first byte */
-void fpm_request_info(); /* not a stage really but a point in the php code, where all request params have become known to sapi */
-void fpm_request_executing(); /* the script is executing */
-void fpm_request_end(void); /* request ended: script response have been sent to web server */
-void fpm_request_finished(); /* request processed: cleaning current request */
+/* hanging in accept() */
+void fpm_request_accepting();
+/* start reading fastcgi request from very first byte */
+void fpm_request_reading_headers();
+/* not a stage really but a point in the php code, where all request params have become known to sapi */
+void fpm_request_info();
+/* the script is executing */
+void fpm_request_executing();
+/* request ended: script response have been sent to web server */
+void fpm_request_end(void);
+/* request processed: cleaning current request */
+void fpm_request_finished();
struct fpm_child_s;
struct timeval;
diff --git a/sapi/fpm/fpm/fpm_scoreboard.c b/sapi/fpm/fpm/fpm_scoreboard.c
index 328f999f0c..fe36a9755b 100644
--- a/sapi/fpm/fpm/fpm_scoreboard.c
+++ b/sapi/fpm/fpm/fpm_scoreboard.c
@@ -71,6 +71,11 @@ int fpm_scoreboard_init_main() /* {{{ */
wp->scoreboard->pm = wp->config->pm;
wp->scoreboard->start_epoch = time(NULL);
strlcpy(wp->scoreboard->pool, wp->config->name, sizeof(wp->scoreboard->pool));
+
+ if (wp->shared) {
+ /* shared pool is added after non shared ones so the shared scoreboard is allocated */
+ wp->scoreboard->shared = wp->shared->scoreboard;
+ }
}
return 0;
}
@@ -101,7 +106,7 @@ void fpm_scoreboard_update(int idle, int active, int lq, int lq_len, int request
if (lq_len >= 0) {
scoreboard->lq_len = lq_len;
}
-#ifdef HAVE_FPM_LQ /* prevent unnecessary test */
+#if HAVE_FPM_LQ /* prevent unnecessary test */
if (scoreboard->lq > scoreboard->lq_max) {
scoreboard->lq_max = scoreboard->lq;
}
diff --git a/sapi/fpm/fpm/fpm_scoreboard.h b/sapi/fpm/fpm/fpm_scoreboard.h
index 1fecde1d0f..060eddea98 100644
--- a/sapi/fpm/fpm/fpm_scoreboard.h
+++ b/sapi/fpm/fpm/fpm_scoreboard.h
@@ -63,6 +63,7 @@ struct fpm_scoreboard_s {
unsigned int nprocs;
int free_proc;
unsigned long int slow_rq;
+ struct fpm_scoreboard_s *shared;
struct fpm_scoreboard_proc_s *procs[];
};
diff --git a/sapi/fpm/fpm/fpm_signals.c b/sapi/fpm/fpm/fpm_signals.c
index d3214b3d16..f5a5ae5ec1 100644
--- a/sapi/fpm/fpm/fpm_signals.c
+++ b/sapi/fpm/fpm/fpm_signals.c
@@ -197,7 +197,7 @@ int fpm_signals_init_main() /* {{{ */
}
if (0 > fcntl(sp[0], F_SETFD, FD_CLOEXEC) || 0 > fcntl(sp[1], F_SETFD, FD_CLOEXEC)) {
- zlog(ZLOG_SYSERROR, "falied to init signals: fcntl(F_SETFD, FD_CLOEXEC)");
+ zlog(ZLOG_SYSERROR, "failed to init signals: fcntl(F_SETFD, FD_CLOEXEC)");
return -1;
}
diff --git a/sapi/fpm/fpm/fpm_sockets.h b/sapi/fpm/fpm/fpm_sockets.h
index 9d899c0757..8f1e3846b2 100644
--- a/sapi/fpm/fpm/fpm_sockets.h
+++ b/sapi/fpm/fpm/fpm_sockets.h
@@ -14,7 +14,7 @@
/*
On FreeBSD and OpenBSD, backlog negative values are truncated to SOMAXCONN
*/
-#if (__FreeBSD__) || (__OpenBSD__)
+#if defined(__FreeBSD__) || defined(__OpenBSD__)
#define FPM_BACKLOG_DEFAULT -1
#else
#define FPM_BACKLOG_DEFAULT 511
diff --git a/sapi/fpm/fpm/fpm_status.c b/sapi/fpm/fpm/fpm_status.c
index 36d2240635..ecce6e32c4 100644
--- a/sapi/fpm/fpm/fpm_status.c
+++ b/sapi/fpm/fpm/fpm_status.c
@@ -53,7 +53,6 @@ int fpm_status_export_to_zval(zval *status)
double cpu;
int i;
-
scoreboard_p = fpm_scoreboard_acquire(NULL, 1);
if (!scoreboard_p) {
zlog(ZLOG_NOTICE, "[pool %s] status: scoreboard already in use.", scoreboard_p->pool);
@@ -85,11 +84,9 @@ int fpm_status_export_to_zval(zval *status)
add_assoc_long(status, "start-time", scoreboard.start_epoch);
add_assoc_long(status, "start-since", now_epoch - scoreboard.start_epoch);
add_assoc_long(status, "accepted-conn", scoreboard.requests);
-#ifdef HAVE_FPM_LQ
add_assoc_long(status, "listen-queue", scoreboard.lq);
add_assoc_long(status, "max-listen-queue", scoreboard.lq_max);
add_assoc_long(status, "listen-queue-len", scoreboard.lq_len);
-#endif
add_assoc_long(status, "idle-processes", scoreboard.idle);
add_assoc_long(status, "active-processes", scoreboard.active);
add_assoc_long(status, "total-processes", scoreboard.idle + scoreboard.active);
@@ -103,14 +100,12 @@ int fpm_status_export_to_zval(zval *status)
continue;
}
proc_p = &procs[i];
-#ifdef HAVE_FPM_LQ
/* prevent NaN */
if (procs[i].cpu_duration.tv_sec == 0 && procs[i].cpu_duration.tv_usec == 0) {
cpu = 0.;
} else {
cpu = (procs[i].last_request_cpu.tms_utime + procs[i].last_request_cpu.tms_stime + procs[i].last_request_cpu.tms_cutime + procs[i].last_request_cpu.tms_cstime) / fpm_scoreboard_get_tick() / (procs[i].cpu_duration.tv_sec + procs[i].cpu_duration.tv_usec / 1000000.) * 100.;
}
-#endif
array_init(&fpm_proc_stat);
add_assoc_long(&fpm_proc_stat, "pid", procs[i].pid);
@@ -130,9 +125,7 @@ int fpm_status_export_to_zval(zval *status)
add_assoc_long(&fpm_proc_stat, "request-length", procs[i].content_length);
add_assoc_string(&fpm_proc_stat, "user", procs[i].auth_user[0] != '\0' ? procs[i].auth_user : "-");
add_assoc_string(&fpm_proc_stat, "script", procs[i].script_filename[0] != '\0' ? procs[i].script_filename : "-");
-#ifdef HAVE_FPM_LQ
add_assoc_double(&fpm_proc_stat, "last-request-cpu", procs[i].request_stage == FPM_REQUEST_ACCEPTING ? cpu : 0.);
-#endif
add_assoc_long(&fpm_proc_stat, "last-request-memory", procs[i].request_stage == FPM_REQUEST_ACCEPTING ? procs[i].memory : 0);
add_next_index_zval(&fpm_proc_stats, &fpm_proc_stat);
}
@@ -178,6 +171,9 @@ int fpm_status_handle_request(void) /* {{{ */
fpm_request_executing();
scoreboard_p = fpm_scoreboard_get();
+ if (scoreboard_p->shared) {
+ scoreboard_p = scoreboard_p->shared;
+ }
if (!scoreboard_p) {
zlog(ZLOG_ERROR, "status: unable to find or access status shared memory");
SG(sapi_headers).http_response_code = 500;
@@ -245,11 +241,9 @@ int fpm_status_handle_request(void) /* {{{ */
"<tr><th>start time</th><td>%s</td></tr>\n"
"<tr><th>start since</th><td>%lu</td></tr>\n"
"<tr><th>accepted conn</th><td>%lu</td></tr>\n"
-#ifdef HAVE_FPM_LQ
"<tr><th>listen queue</th><td>%d</td></tr>\n"
"<tr><th>max listen queue</th><td>%d</td></tr>\n"
"<tr><th>listen queue len</th><td>%u</td></tr>\n"
-#endif
"<tr><th>idle processes</th><td>%d</td></tr>\n"
"<tr><th>active processes</th><td>%d</td></tr>\n"
"<tr><th>total processes</th><td>%d</td></tr>\n"
@@ -275,9 +269,7 @@ int fpm_status_handle_request(void) /* {{{ */
"<th>content length</th>"
"<th>user</th>"
"<th>script</th>"
-#ifdef HAVE_FPM_LQ
"<th>last request cpu</th>"
-#endif
"<th>last request memory</th>"
"</tr>\n";
@@ -294,9 +286,7 @@ int fpm_status_handle_request(void) /* {{{ */
"<td>%zu</td>"
"<td>%s</td>"
"<td>%s</td>"
-#ifdef HAVE_FPM_LQ
"<td>%.2f</td>"
-#endif
"<td>%zu</td>"
"</tr>\n";
@@ -317,11 +307,9 @@ int fpm_status_handle_request(void) /* {{{ */
"<start-time>%s</start-time>\n"
"<start-since>%lu</start-since>\n"
"<accepted-conn>%lu</accepted-conn>\n"
-#ifdef HAVE_FPM_LQ
"<listen-queue>%d</listen-queue>\n"
"<max-listen-queue>%d</max-listen-queue>\n"
"<listen-queue-len>%u</listen-queue-len>\n"
-#endif
"<idle-processes>%d</idle-processes>\n"
"<active-processes>%d</active-processes>\n"
"<total-processes>%d</total-processes>\n"
@@ -346,9 +334,7 @@ int fpm_status_handle_request(void) /* {{{ */
"<content-length>%zu</content-length>"
"<user>%s</user>"
"<script>%s</script>"
-#ifdef HAVE_FPM_LQ
"<last-request-cpu>%.2f</last-request-cpu>"
-#endif
"<last-request-memory>%zu</last-request-memory>"
"</process>\n"
;
@@ -367,11 +353,9 @@ int fpm_status_handle_request(void) /* {{{ */
"\"start time\":%s,"
"\"start since\":%lu,"
"\"accepted conn\":%lu,"
-#ifdef HAVE_FPM_LQ
"\"listen queue\":%d,"
"\"max listen queue\":%d,"
"\"listen queue len\":%u,"
-#endif
"\"idle processes\":%d,"
"\"active processes\":%d,"
"\"total processes\":%d,"
@@ -397,9 +381,7 @@ int fpm_status_handle_request(void) /* {{{ */
"\"content length\":%zu,"
"\"user\":\"%s\","
"\"script\":\"%s\","
-#ifdef HAVE_FPM_LQ
"\"last request cpu\":%.2f,"
-#endif
"\"last request memory\":%zu"
"}";
@@ -417,11 +399,9 @@ int fpm_status_handle_request(void) /* {{{ */
"start time: %s\n"
"start since: %lu\n"
"accepted conn: %lu\n"
-#ifdef HAVE_FPM_LQ
"listen queue: %d\n"
"max listen queue: %d\n"
"listen queue len: %u\n"
-#endif
"idle processes: %d\n"
"active processes: %d\n"
"total processes: %d\n"
@@ -444,9 +424,7 @@ int fpm_status_handle_request(void) /* {{{ */
"content length: %zu\n"
"user: %s\n"
"script: %s\n"
-#ifdef HAVE_FPM_LQ
"last request cpu: %.2f\n"
-#endif
"last request memory: %zu\n";
}
}
@@ -459,11 +437,9 @@ int fpm_status_handle_request(void) /* {{{ */
time_buffer,
(unsigned long) (now_epoch - scoreboard.start_epoch),
scoreboard.requests,
-#ifdef HAVE_FPM_LQ
scoreboard.lq,
scoreboard.lq_max,
scoreboard.lq_len,
-#endif
scoreboard.idle,
scoreboard.active,
scoreboard.idle + scoreboard.active,
@@ -486,9 +462,7 @@ int fpm_status_handle_request(void) /* {{{ */
zend_string *tmp_query_string;
char *query_string;
struct timeval duration, now;
-#ifdef HAVE_FPM_LQ
float cpu;
-#endif
fpm_clock_get(&now);
@@ -517,19 +491,17 @@ int fpm_status_handle_request(void) /* {{{ */
if (!encode) {
query_string = proc.query_string;
} else {
- tmp_query_string = php_escape_html_entities_ex((unsigned char *)proc.query_string, strlen(proc.query_string), 1, ENT_HTML_IGNORE_ERRORS & ENT_COMPAT, NULL, 1);
+ tmp_query_string = php_escape_html_entities_ex((const unsigned char *) proc.query_string, strlen(proc.query_string), 1, ENT_HTML_IGNORE_ERRORS & ENT_COMPAT, NULL, /* double_encode */ 1, /* quiet */ 0);
query_string = ZSTR_VAL(tmp_query_string);
}
}
-#ifdef HAVE_FPM_LQ
/* prevent NaN */
if (proc.cpu_duration.tv_sec == 0 && proc.cpu_duration.tv_usec == 0) {
cpu = 0.;
} else {
cpu = (proc.last_request_cpu.tms_utime + proc.last_request_cpu.tms_stime + proc.last_request_cpu.tms_cutime + proc.last_request_cpu.tms_cstime) / fpm_scoreboard_get_tick() / (proc.cpu_duration.tv_sec + proc.cpu_duration.tv_usec / 1000000.) * 100.;
}
-#endif
if (proc.request_stage == FPM_REQUEST_ACCEPTING) {
duration = proc.duration;
@@ -551,9 +523,7 @@ int fpm_status_handle_request(void) /* {{{ */
proc.content_length,
proc.auth_user[0] != '\0' ? proc.auth_user : "-",
proc.script_filename[0] != '\0' ? proc.script_filename : "-",
-#ifdef HAVE_FPM_LQ
proc.request_stage == FPM_REQUEST_ACCEPTING ? cpu : 0.,
-#endif
proc.request_stage == FPM_REQUEST_ACCEPTING ? proc.memory : 0);
PUTS(buffer);
efree(buffer);
diff --git a/sapi/fpm/fpm/fpm_stdio.c b/sapi/fpm/fpm/fpm_stdio.c
index ddedfb48c7..1742467b36 100644
--- a/sapi/fpm/fpm/fpm_stdio.c
+++ b/sapi/fpm/fpm/fpm_stdio.c
@@ -49,7 +49,7 @@ static inline int fpm_use_error_log() { /* {{{ */
* - SysV init launch php-fpm as a daemon
* - Systemd launch php-fpm in foreground
*/
-#if HAVE_UNISTD_H
+#ifdef HAVE_UNISTD_H
if (fpm_global_config.daemonize || (!isatty(STDERR_FILENO) && !fpm_globals.force_stderr)) {
#else
if (fpm_global_config.daemonize) {
diff --git a/sapi/fpm/fpm/fpm_trace_pread.c b/sapi/fpm/fpm/fpm_trace_pread.c
index 604882eff3..22b476f778 100644
--- a/sapi/fpm/fpm/fpm_trace_pread.c
+++ b/sapi/fpm/fpm/fpm_trace_pread.c
@@ -9,11 +9,7 @@
#include <fcntl.h>
#include <stdio.h>
-#if HAVE_INTTYPES_H
-# include <inttypes.h>
-#else
-# include <stdint.h>
-#endif
+#include <inttypes.h>
#include "fpm_trace.h"
#include "fpm_process_ctl.h"
diff --git a/sapi/fpm/fpm/fpm_worker_pool.h b/sapi/fpm/fpm/fpm_worker_pool.h
index 8f4f440a84..ac596cde60 100644
--- a/sapi/fpm/fpm/fpm_worker_pool.h
+++ b/sapi/fpm/fpm/fpm_worker_pool.h
@@ -18,6 +18,7 @@ enum fpm_address_domain {
struct fpm_worker_pool_s {
struct fpm_worker_pool_s *next;
+ struct fpm_worker_pool_s *shared;
struct fpm_worker_pool_config_s *config;
char *user, *home; /* for setting env USER and HOME */
enum fpm_address_domain listen_address_domain;
diff --git a/sapi/fpm/tests/bug76601-reload-child-signals.phpt b/sapi/fpm/tests/bug76601-reload-child-signals.phpt
index b4e99b7e4a..f095ed667c 100644
--- a/sapi/fpm/tests/bug76601-reload-child-signals.phpt
+++ b/sapi/fpm/tests/bug76601-reload-child-signals.phpt
@@ -31,14 +31,14 @@ EOT;
/*
* If a child miss SIGQUIT then reload process should stuck
* for at least process_control_timeout that is set greater
- * than timout in log reading functions.
+ * than timeout in log reading functions.
*
* Alternative way is to set log_level=debug and filter result of
* $tester->getLogLines(2000) for lines containing SIGKILL
- *
+ *
* [22-Oct-2019 03:28:19.532703] DEBUG: pid 21315, fpm_pctl_kill_all(), line 161: [pool unconfined] sending signal 9 SIGKILL to child 21337
* [22-Oct-2019 03:28:19.533471] DEBUG: pid 21315, fpm_children_bury(), line 259: [pool unconfined] child 21337 exited on signal 9 (SIGKILL) after 1.003055 seconds from start
- *
+ *
* but it has less probability of failure detection. Additionally it requires more
* $tester->expectLogNotice() around last reload due to presence of debug messages.
*/
diff --git a/sapi/fpm/tests/fcgi.inc b/sapi/fpm/tests/fcgi.inc
index 721b94b504..0d16e5ba0b 100644
--- a/sapi/fpm/tests/fcgi.inc
+++ b/sapi/fpm/tests/fcgi.inc
@@ -485,7 +485,7 @@ class Client
}
/**
- * Execute a request to the FastCGI application asyncronously
+ * Execute a request to the FastCGI application asynchronously
*
* This sends request to application and returns the assigned ID for that request.
*
@@ -508,7 +508,7 @@ class Client
// Pick random number between 1 and max 16 bit unsigned int 65535
$id = mt_rand(1, (1 << 16) - 1);
- // Using persistent sockets implies you want them keept alive by server!
+ // Using persistent sockets implies you want them kept alive by server!
$keepAlive = intval($this->_keepAlive || $this->_persistentSocket);
$request = $this->buildPacket(
diff --git a/sapi/fpm/tests/getallheaders.phpt b/sapi/fpm/tests/getallheaders.phpt
index b1f9683788..90ecae3e44 100644
--- a/sapi/fpm/tests/getallheaders.phpt
+++ b/sapi/fpm/tests/getallheaders.phpt
@@ -31,27 +31,27 @@ $tester = new FPM\Tester($cfg, $code);
$tester->start();
$tester->expectLogStartNotices();
$tester->request(
- '',
- [
- 'HTTP_X_FOO' => 'BAR',
- 'HTTP_FOO' => 'foo'
- ]
- )->expectBody(
- [
- 'Test Start',
- 'array(4) {',
- ' ["Foo"]=>',
- ' string(3) "foo"',
- ' ["X-Foo"]=>',
- ' string(3) "BAR"',
- ' ["Content-Length"]=>',
- ' string(1) "0"',
- ' ["Content-Type"]=>',
- ' string(0) ""',
- '}',
- 'Test End',
- ]
- );
+ '',
+ [
+ 'HTTP_X_FOO' => 'BAR',
+ 'HTTP_FOO' => 'foo'
+ ]
+ )->expectBody(
+ [
+ 'Test Start',
+ 'array(4) {',
+ ' ["Foo"]=>',
+ ' string(3) "foo"',
+ ' ["X-Foo"]=>',
+ ' string(3) "BAR"',
+ ' ["Content-Length"]=>',
+ ' string(1) "0"',
+ ' ["Content-Type"]=>',
+ ' string(0) ""',
+ '}',
+ 'Test End',
+ ]
+ );
$tester->terminate();
$tester->expectLogTerminatingNotices();
$tester->close();
diff --git a/sapi/fpm/tests/response.inc b/sapi/fpm/tests/response.inc
index 7ee9cd4640..b531feacdc 100644
--- a/sapi/fpm/tests/response.inc
+++ b/sapi/fpm/tests/response.inc
@@ -202,7 +202,7 @@ class Response
{
// check default headers
return (
- $this->checkHeader('X-Powered-By', '|^PHP/7|', true) &&
+ $this->checkHeader('X-Powered-By', '|^PHP/8|', true) &&
$this->checkHeader('Content-type', '|^' . $contentType . '(;\s?charset=\w+)?|', true)
);
}
diff --git a/sapi/fpm/tests/status-basic.phpt b/sapi/fpm/tests/status-basic.phpt
index 323592262f..245fc425ca 100644
--- a/sapi/fpm/tests/status-basic.phpt
+++ b/sapi/fpm/tests/status-basic.phpt
@@ -12,7 +12,7 @@ $cfg = <<<EOT
error_log = {{FILE:LOG}}
[unconfined]
listen = {{ADDR}}
-pm = static
+pm = static
pm.max_children = 1
pm.status_path = /status
EOT;
diff --git a/sapi/fpm/tests/status-listen.phpt b/sapi/fpm/tests/status-listen.phpt
new file mode 100644
index 0000000000..c6476c0332
--- /dev/null
+++ b/sapi/fpm/tests/status-listen.phpt
@@ -0,0 +1,51 @@
+--TEST--
+FPM: Status listen test
+--SKIPIF--
+<?php include "skipif.inc"; ?>
+--FILE--
+<?php
+
+require_once "tester.inc";
+
+$cfg = <<<EOT
+[global]
+error_log = {{FILE:LOG}}
+[unconfined]
+listen = {{ADDR}}
+pm = static
+pm.max_children = 1
+pm.status_listen = {{ADDR[status]}}
+pm.status_path = /status
+EOT;
+
+$expectedStatusData = [
+ 'pool' => 'unconfined',
+ 'process manager' => 'static',
+ 'listen queue' => 0,
+ 'max listen queue' => 0,
+ 'idle processes' => 1,
+ 'active processes' => 0,
+ 'total processes' => 1,
+ 'max active processes' => 1,
+ 'max children reached' => 0,
+ 'slow requests' => 0,
+];
+
+$tester = new FPM\Tester($cfg);
+$tester->start();
+$tester->expectLogStartNotices();
+$tester->request()->expectEmptyBody();
+$tester->status($expectedStatusData, '{{ADDR[status]}}');
+$tester->terminate();
+$tester->expectLogTerminatingNotices();
+$tester->close();
+
+?>
+Done
+--EXPECT--
+Done
+--CLEAN--
+<?php
+require_once "tester.inc";
+FPM\Tester::clean();
+?>
diff --git a/sapi/fpm/www.conf.in b/sapi/fpm/www.conf.in
index 934f97b09e..3d5658a65d 100644
--- a/sapi/fpm/www.conf.in
+++ b/sapi/fpm/www.conf.in
@@ -71,7 +71,7 @@ listen = 127.0.0.1:9000
; process.priority = -19
; Set the process dumpable flag (PR_SET_DUMPABLE prctl) even if the process user
-; or group is differrent than the master process user. It allows to create process
+; or group is different than the master process user. It allows to create process
; core dump and ptrace the process for the pool user.
; Default Value: no
; process.dumpable = yes
@@ -140,7 +140,7 @@ pm.max_spare_servers = 3
;pm.max_requests = 500
; The URI to view the FPM status page. If this value is not set, no URI will be
-; recognized as a status page. It shows the following informations:
+; recognized as a status page. It shows the following information:
; pool - the name of the pool;
; process manager - static, dynamic or ondemand;
; start time - the date and time FPM has started;
@@ -238,6 +238,22 @@ pm.max_spare_servers = 3
; Default Value: not set
;pm.status_path = /status
+; The address on which to accept FastCGI status request. This creates a new
+; invisible pool that can handle requests independently. This is useful
+; if the main pool is busy with long running requests because it is still possible
+; to get the status before finishing the long running requests.
+;
+; Valid syntaxes are:
+; 'ip.add.re.ss:port' - to listen on a TCP socket to a specific IPv4 address on
+; a specific port;
+; '[ip:6:addr:ess]:port' - to listen on a TCP socket to a specific IPv6 address on
+; a specific port;
+; 'port' - to listen on a TCP socket to all addresses
+; (IPv6 and IPv4-mapped) on a specific port;
+; '/path/to/unix/socket' - to listen on a unix socket.
+; Default Value: value of the listen option
+;pm.status_listen = 127.0.0.1:9001
+
; The ping URI to call the monitoring page of FPM. If this value is not set, no
; URI will be recognized as a ping page. This could be used to test from outside
; that FPM is alive and responding, or to
@@ -270,13 +286,13 @@ pm.max_spare_servers = 3
; %d: time taken to serve the request
; it can accept the following format:
; - %{seconds}d (default)
-; - %{miliseconds}d
+; - %{milliseconds}d
; - %{mili}d
; - %{microseconds}d
; - %{micro}d
; %e: an environment variable (same as $_ENV or $_SERVER)
; it must be associated with embraces to specify the name of the env
-; variable. Some exemples:
+; variable. Some examples:
; - server specifics like: %{REQUEST_METHOD}e or %{SERVER_PROTOCOL}e
; - HTTP headers like: %{HTTP_HOST}e or %{HTTP_USER_AGENT}e
; %f: script filename
@@ -375,7 +391,7 @@ pm.max_spare_servers = 3
; Redirect worker stdout and stderr into main error log. If not set, stdout and
; stderr will be redirected to /dev/null according to FastCGI specs.
-; Note: on highloaded environement, this can cause some delay in the page
+; Note: on highloaded environment, this can cause some delay in the page
; process time (several ms).
; Default Value: no
;catch_workers_output = yes
diff --git a/sapi/fuzzer/Makefile.frag b/sapi/fuzzer/Makefile.frag
new file mode 100644
index 0000000000..50feac3a9a
--- /dev/null
+++ b/sapi/fuzzer/Makefile.frag
@@ -0,0 +1,24 @@
+fuzzer: $(PHP_FUZZER_BINARIES)
+
+FUZZER_BUILD = $(LIBTOOL) --mode=link $(FUZZING_CC) -export-dynamic $(CFLAGS_CLEAN) $(EXTRA_CFLAGS) $(EXTRA_LDFLAGS_PROGRAM) $(LDFLAGS) $(PHP_RPATHS) $(PHP_GLOBAL_OBJS) $(PHP_BINARY_OBJS) $(EXTRA_LIBS) $(ZEND_EXTRA_LIBS) $(FUZZING_LIB) -rpath /ORIGIN/lib
+
+$(SAPI_FUZZER_PATH)/php-fuzz-parser: $(PHP_GLOBAL_OBJS) $(PHP_SAPI_OBJS) $(PHP_FUZZER_PARSER_OBJS)
+ $(FUZZER_BUILD) $(PHP_FUZZER_PARSER_OBJS) -o $@
+
+$(SAPI_FUZZER_PATH)/php-fuzz-execute: $(PHP_GLOBAL_OBJS) $(PHP_SAPI_OBJS) $(PHP_FUZZER_EXECUTE_OBJS)
+ $(FUZZER_BUILD) $(PHP_FUZZER_EXECUTE_OBJS) -o $@
+
+$(SAPI_FUZZER_PATH)/php-fuzz-unserialize: $(PHP_GLOBAL_OBJS) $(PHP_SAPI_OBJS) $(PHP_FUZZER_UNSERIALIZE_OBJS)
+ $(FUZZER_BUILD) $(PHP_FUZZER_UNSERIALIZE_OBJS) -o $@
+
+$(SAPI_FUZZER_PATH)/php-fuzz-unserializehash: $(PHP_GLOBAL_OBJS) $(PHP_SAPI_OBJS) $(PHP_FUZZER_UNSERIALIZEHASH_OBJS)
+ $(FUZZER_BUILD) $(PHP_FUZZER_UNSERIALIZEHASH_OBJS) -o $@
+
+$(SAPI_FUZZER_PATH)/php-fuzz-json: $(PHP_GLOBAL_OBJS) $(PHP_SAPI_OBJS) $(PHP_FUZZER_JSON_OBJS)
+ $(FUZZER_BUILD) $(PHP_FUZZER_JSON_OBJS) -o $@
+
+$(SAPI_FUZZER_PATH)/php-fuzz-exif: $(PHP_GLOBAL_OBJS) $(PHP_SAPI_OBJS) $(PHP_FUZZER_EXIF_OBJS)
+ $(FUZZER_BUILD) $(PHP_FUZZER_EXIF_OBJS) -o $@
+
+$(SAPI_FUZZER_PATH)/php-fuzz-mbstring: $(PHP_GLOBAL_OBJS) $(PHP_SAPI_OBJS) $(PHP_FUZZER_MBSTRING_OBJS)
+ $(FUZZER_BUILD) $(PHP_FUZZER_MBSTRING_OBJS) -o $@
diff --git a/sapi/fuzzer/README.md b/sapi/fuzzer/README.md
new file mode 100644
index 0000000000..f79baa6c00
--- /dev/null
+++ b/sapi/fuzzer/README.md
@@ -0,0 +1,77 @@
+Fuzzing SAPI for PHP
+--------------------
+
+The following `./configure` options can be used to enable the fuzzing SAPI, as well as all availablefuzzers. If you don't build the exif/json/mbstring extensions, fuzzers for these extensions will not be built.
+
+```sh
+CC=clang CXX=clang++ \
+./configure \
+ --disable-all \
+ --enable-fuzzer \
+ --with-pic \
+ --enable-debug-assertions \
+ --enable-exif \
+ --enable-mbstring
+```
+
+The `--with-pic` option is required to avoid a linking failure. The `--enable-debug-assertions` option can be used to enable debug assertions despite the use of a release build.
+
+You will need a recent version of clang that supports the `-fsanitize=fuzzer-no-link` option.
+
+When running `make` it creates these binaries in `sapi/fuzzer/`:
+
+* `php-fuzz-parser`: Fuzzing language parser and compiler
+* `php-fuzz-unserialize`: Fuzzing unserialize() function
+* `php-fuzz-unserializehash`: Fuzzing unserialize() for HashContext objects
+* `php-fuzz-json`: Fuzzing JSON parser (requires --enable-json)
+* `php-fuzz-exif`: Fuzzing `exif_read_data()` function (requires --enable-exif)
+* `php-fuzz-mbstring`: Fuzzing `mb_ereg[i]()` (requires --enable-mbstring)
+* `php-fuzz-execute`: Fuzzing the executor
+
+Some fuzzers have a seed corpus in `sapi/fuzzer/corpus`. You can use it as follows:
+
+```sh
+cp -r sapi/fuzzer/corpus/exif ./my-exif-corpus
+sapi/fuzzer/php-fuzz-exif ./my-exif-corpus
+```
+
+For the unserialize fuzzer, a dictionary of internal classes should be generated first:
+
+```sh
+sapi/cli/php sapi/fuzzer/generate_unserialize_dict.php
+cp -r sapi/fuzzer/corpus/unserialize ./my-unserialize-corpus
+sapi/fuzzer/php-fuzz-unserialize -dict=$PWD/sapi/fuzzer/dict/unserialize ./my-unserialize-corpus
+```
+
+For the unserializehash fuzzer, generate a corpus of initial hash serializations:
+
+```sh
+sapi/cli/php sapi/fuzzer/generate_unserializehash_corpus.php
+cp -r sapi/fuzzer/corpus/unserializehash ./my-unserialize-corpus
+sapi/fuzzer/php-fuzz-unserializehash ./my-unserialize-corpus
+```
+
+For the parser fuzzer, a corpus may be generated from Zend test files:
+
+```sh
+sapi/cli/php sapi/fuzzer/generate_parser_corpus.php
+mkdir ./my-parser-corpus
+sapi/fuzzer/php-fuzz-parser -merge=1 ./my-parser-corpus sapi/fuzzer/corpus/parser
+sapi/fuzzer/php-fuzz-parser -only_ascii=1 ./my-parser-corpus
+```
+
+For the mbstring fuzzer, you may want to build the libonig dependency with instrumentation. At this time, libonig is not clean under ubsan, so only the fuzzer and address sanitizers may be used.
+
+```sh
+git clone https://github.com/kkos/oniguruma.git
+pushd oniguruma
+autoreconf -vfi
+./configure CC=clang CFLAGS="-fsanitize=fuzzer-no-link,address -O2 -g"
+make
+popd
+
+export ONIG_CFLAGS="-I$PWD/oniguruma/src"
+export ONIG_LIBS="-L$PWD/oniguruma/src/.libs -l:libonig.a"
+```
+
+This will link an instrumented libonig statically into the PHP binary.
diff --git a/sapi/fuzzer/config.m4 b/sapi/fuzzer/config.m4
new file mode 100644
index 0000000000..92327fc1d4
--- /dev/null
+++ b/sapi/fuzzer/config.m4
@@ -0,0 +1,93 @@
+AC_MSG_CHECKING(for clang fuzzer SAPI)
+
+PHP_ARG_ENABLE([fuzzer],,
+ [AS_HELP_STRING([--enable-fuzzer],
+ [Build PHP as clang fuzzing test module (for developers)])],
+ [no],
+ [no])
+
+PHP_ARG_ENABLE([fuzzer-msan],,
+ [AS_HELP_STRING([--enable-fuzzer-msan],
+ [Enable msan instead of asan/ubsan when fuzzing])],
+ [no],
+ [no])
+
+dnl For newer clang versions see https://llvm.org/docs/LibFuzzer.html#fuzzer-usage
+dnl for relevant flags.
+
+dnl Macro to define fuzzing target
+dnl PHP_FUZZER_TARGET(name, target-var)
+dnl
+AC_DEFUN([PHP_FUZZER_TARGET], [
+ PHP_FUZZER_BINARIES="$PHP_FUZZER_BINARIES $SAPI_FUZZER_PATH/php-fuzz-$1"
+ PHP_SUBST($2)
+ PHP_ADD_SOURCES_X([sapi/fuzzer],[fuzzer-$1.c],[],$2)
+ $2="[$]$2 $FUZZER_COMMON_OBJS"
+])
+
+if test "$PHP_FUZZER" != "no"; then
+ AC_MSG_RESULT([yes])
+ dnl Don't use PHP_REQUIRE_CXX() to avoid unnecessarily pulling in -lstdc++
+ AC_PROG_CXX
+ AC_PROG_CXXCPP
+ PHP_ADD_MAKEFILE_FRAGMENT($abs_srcdir/sapi/fuzzer/Makefile.frag)
+ SAPI_FUZZER_PATH=sapi/fuzzer
+ PHP_SUBST(SAPI_FUZZER_PATH)
+ if test -z "$LIB_FUZZING_ENGINE"; then
+ FUZZING_LIB="-fsanitize=fuzzer"
+ FUZZING_CC="$CC"
+ AX_CHECK_COMPILE_FLAG([-fsanitize=fuzzer-no-link], [
+ CFLAGS="$CFLAGS -fsanitize=fuzzer-no-link"
+ CXXFLAGS="$CXXFLAGS -fsanitize=fuzzer-no-link"
+
+ if test "$PHP_FUZZER_MSAN" = "yes"; then
+ CFLAGS="$CFLAGS -fsanitize=memory -fsanitize-memory-track-origins"
+ CXXFLAGS="$CXXFLAGS -fsanitize=memory -fsanitize-memory-track-origins"
+ else
+ CFLAGS="$CFLAGS -fsanitize=address"
+ CXXFLAGS="$CXXFLAGS -fsanitize=address"
+
+ dnl Don't include -fundefined in CXXFLAGS, because that would also require linking
+ dnl with a C++ compiler.
+ dnl Disable object-size sanitizer, because it is incompatible with our zend_function
+ dnl union, and this can't be easily fixed.
+ dnl We need to specify -fno-sanitize-recover=undefined here, otherwise ubsan warnings
+ dnl will not be considered failures by the fuzzer.
+ CFLAGS="$CFLAGS -fsanitize=undefined -fno-sanitize=object-size -fno-sanitize-recover=undefined"
+ fi
+ ],[
+ AC_MSG_ERROR(Compiler doesn't support -fsanitize=fuzzer-no-link)
+ ])
+ else
+ FUZZING_LIB="$LIB_FUZZING_ENGINE"
+ FUZZING_CC="$CXX -stdlib=libc++"
+ fi
+ PHP_SUBST(FUZZING_LIB)
+ PHP_SUBST(FUZZING_CC)
+
+ dnl PHP_SELECT_SAPI(fuzzer-parser, program, $FUZZER_SOURCES, , '$(SAPI_FUZZER_PATH)')
+
+ PHP_ADD_BUILD_DIR([sapi/fuzzer])
+ PHP_FUZZER_BINARIES=""
+ PHP_BINARIES="$PHP_BINARIES fuzzer"
+ PHP_INSTALLED_SAPIS="$PHP_INSTALLED_SAPIS fuzzer"
+
+ PHP_ADD_SOURCES_X([sapi/fuzzer], [fuzzer-sapi.c], [], FUZZER_COMMON_OBJS)
+
+ PHP_FUZZER_TARGET([parser], PHP_FUZZER_PARSER_OBJS)
+ PHP_FUZZER_TARGET([execute], PHP_FUZZER_EXECUTE_OBJS)
+ PHP_FUZZER_TARGET([unserialize], PHP_FUZZER_UNSERIALIZE_OBJS)
+ PHP_FUZZER_TARGET([unserializehash], PHP_FUZZER_UNSERIALIZEHASH_OBJS)
+ PHP_FUZZER_TARGET([json], PHP_FUZZER_JSON_OBJS)
+
+ if test -n "$enable_exif" && test "$enable_exif" != "no"; then
+ PHP_FUZZER_TARGET([exif], PHP_FUZZER_EXIF_OBJS)
+ fi
+ if test -n "$enable_mbstring" && test "$enable_mbstring" != "no"; then
+ PHP_FUZZER_TARGET([mbstring], PHP_FUZZER_MBSTRING_OBJS)
+ fi
+
+ PHP_SUBST(PHP_FUZZER_BINARIES)
+fi
+
+AC_MSG_RESULT($PHP_FUZZER)
diff --git a/sapi/fuzzer/corpus/exif/bug34704.jpg b/sapi/fuzzer/corpus/exif/bug34704.jpg
new file mode 100644
index 0000000000..42b14c1908
--- /dev/null
+++ b/sapi/fuzzer/corpus/exif/bug34704.jpg
Binary files differ
diff --git a/sapi/fuzzer/corpus/exif/bug34704_2.jpg b/sapi/fuzzer/corpus/exif/bug34704_2.jpg
new file mode 100644
index 0000000000..42b14c1908
--- /dev/null
+++ b/sapi/fuzzer/corpus/exif/bug34704_2.jpg
Binary files differ
diff --git a/sapi/fuzzer/corpus/exif/bug48378.jpeg b/sapi/fuzzer/corpus/exif/bug48378.jpeg
new file mode 100644
index 0000000000..759d805709
--- /dev/null
+++ b/sapi/fuzzer/corpus/exif/bug48378.jpeg
Binary files differ
diff --git a/sapi/fuzzer/corpus/exif/bug54002_1.jpeg b/sapi/fuzzer/corpus/exif/bug54002_1.jpeg
new file mode 100644
index 0000000000..a622d6d213
--- /dev/null
+++ b/sapi/fuzzer/corpus/exif/bug54002_1.jpeg
Binary files differ
diff --git a/sapi/fuzzer/corpus/exif/bug54002_2.jpeg b/sapi/fuzzer/corpus/exif/bug54002_2.jpeg
new file mode 100644
index 0000000000..a622d6d213
--- /dev/null
+++ b/sapi/fuzzer/corpus/exif/bug54002_2.jpeg
Binary files differ
diff --git a/sapi/fuzzer/corpus/exif/bug62523_1.jpg b/sapi/fuzzer/corpus/exif/bug62523_1.jpg
new file mode 100644
index 0000000000..9a63d1e84d
--- /dev/null
+++ b/sapi/fuzzer/corpus/exif/bug62523_1.jpg
@@ -0,0 +1,9 @@
+<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
+<html><head>
+<title>301 Moved Permanently</title>
+</head><body>
+<h1>Moved Permanently</h1>
+<p>The document has moved <a href="http://www.getid3.org/temp/62523.jpg">here</a>.</p>
+<hr>
+<address>Apache Server at getid3.org Port 80</address>
+</body></html>
diff --git a/sapi/fuzzer/corpus/exif/bug62523_3.jpg b/sapi/fuzzer/corpus/exif/bug62523_3.jpg
new file mode 100644
index 0000000000..3ee91368ce
--- /dev/null
+++ b/sapi/fuzzer/corpus/exif/bug62523_3.jpg
@@ -0,0 +1,12 @@
+<html>
+ <head><title>Found</title></head>
+ <body>
+ <h1>Found</h1>
+ <p>The resource was found at <a href="http://dl.dropboxusercontent.com/u/7562584/Bugs/Php/bad_exif.jpeg">http://dl.dropboxusercontent.com/u/7562584/Bugs/Php/bad_exif.jpeg</a>;
+you should be redirected automatically.
+
+<!-- --></p>
+ <hr noshade>
+ <div align="right">WSGI Server</div>
+ </body>
+</html>
diff --git a/sapi/fuzzer/corpus/exif/bug68113.jpg b/sapi/fuzzer/corpus/exif/bug68113.jpg
new file mode 100644
index 0000000000..3ce7a620fb
--- /dev/null
+++ b/sapi/fuzzer/corpus/exif/bug68113.jpg
Binary files differ
diff --git a/sapi/fuzzer/corpus/exif/bug68113_2.jpg b/sapi/fuzzer/corpus/exif/bug68113_2.jpg
new file mode 100644
index 0000000000..3ce7a620fb
--- /dev/null
+++ b/sapi/fuzzer/corpus/exif/bug68113_2.jpg
Binary files differ
diff --git a/sapi/fuzzer/corpus/exif/bug68799.jpg b/sapi/fuzzer/corpus/exif/bug68799.jpg
new file mode 100644
index 0000000000..acc326dbbf
--- /dev/null
+++ b/sapi/fuzzer/corpus/exif/bug68799.jpg
Binary files differ
diff --git a/sapi/fuzzer/corpus/exif/bug72094_1.jpg b/sapi/fuzzer/corpus/exif/bug72094_1.jpg
new file mode 100644
index 0000000000..d21382b44b
--- /dev/null
+++ b/sapi/fuzzer/corpus/exif/bug72094_1.jpg
Binary files differ
diff --git a/sapi/fuzzer/corpus/exif/bug72094_2.jpg b/sapi/fuzzer/corpus/exif/bug72094_2.jpg
new file mode 100644
index 0000000000..ec414ce02b
--- /dev/null
+++ b/sapi/fuzzer/corpus/exif/bug72094_2.jpg
Binary files differ
diff --git a/sapi/fuzzer/corpus/exif/bug72094_3.jpg b/sapi/fuzzer/corpus/exif/bug72094_3.jpg
new file mode 100644
index 0000000000..8b05314b67
--- /dev/null
+++ b/sapi/fuzzer/corpus/exif/bug72094_3.jpg
Binary files differ
diff --git a/sapi/fuzzer/corpus/exif/bug72094_4.jpg b/sapi/fuzzer/corpus/exif/bug72094_4.jpg
new file mode 100644
index 0000000000..ca6d453c2c
--- /dev/null
+++ b/sapi/fuzzer/corpus/exif/bug72094_4.jpg
Binary files differ
diff --git a/sapi/fuzzer/corpus/exif/bug72603.jpeg b/sapi/fuzzer/corpus/exif/bug72603.jpeg
new file mode 100644
index 0000000000..1764c805fb
--- /dev/null
+++ b/sapi/fuzzer/corpus/exif/bug72603.jpeg
Binary files differ
diff --git a/sapi/fuzzer/corpus/exif/bug72618.jpg b/sapi/fuzzer/corpus/exif/bug72618.jpg
new file mode 100644
index 0000000000..0a61ae2e02
--- /dev/null
+++ b/sapi/fuzzer/corpus/exif/bug72618.jpg
Binary files differ
diff --git a/sapi/fuzzer/corpus/exif/bug72627.tiff b/sapi/fuzzer/corpus/exif/bug72627.tiff
new file mode 100644
index 0000000000..229190a604
--- /dev/null
+++ b/sapi/fuzzer/corpus/exif/bug72627.tiff
Binary files differ
diff --git a/sapi/fuzzer/corpus/exif/bug73737.tiff b/sapi/fuzzer/corpus/exif/bug73737.tiff
new file mode 100644
index 0000000000..2cb036fc47
--- /dev/null
+++ b/sapi/fuzzer/corpus/exif/bug73737.tiff
Binary files differ
diff --git a/sapi/fuzzer/corpus/exif/bug76130_1.jpg b/sapi/fuzzer/corpus/exif/bug76130_1.jpg
new file mode 100644
index 0000000000..e063e46d22
--- /dev/null
+++ b/sapi/fuzzer/corpus/exif/bug76130_1.jpg
Binary files differ
diff --git a/sapi/fuzzer/corpus/exif/bug76130_2.jpg b/sapi/fuzzer/corpus/exif/bug76130_2.jpg
new file mode 100644
index 0000000000..a9e79dca5c
--- /dev/null
+++ b/sapi/fuzzer/corpus/exif/bug76130_2.jpg
Binary files differ
diff --git a/sapi/fuzzer/corpus/exif/bug76423.jpg b/sapi/fuzzer/corpus/exif/bug76423.jpg
new file mode 100644
index 0000000000..08fe2bbc57
--- /dev/null
+++ b/sapi/fuzzer/corpus/exif/bug76423.jpg
Binary files differ
diff --git a/sapi/fuzzer/corpus/exif/bug76557.jpg b/sapi/fuzzer/corpus/exif/bug76557.jpg
new file mode 100644
index 0000000000..d678f07c0f
--- /dev/null
+++ b/sapi/fuzzer/corpus/exif/bug76557.jpg
Binary files differ
diff --git a/sapi/fuzzer/corpus/exif/bug77540.jpg b/sapi/fuzzer/corpus/exif/bug77540.jpg
new file mode 100644
index 0000000000..559022db0e
--- /dev/null
+++ b/sapi/fuzzer/corpus/exif/bug77540.jpg
Binary files differ
diff --git a/sapi/fuzzer/corpus/exif/bug77563.jpg b/sapi/fuzzer/corpus/exif/bug77563.jpg
new file mode 100644
index 0000000000..d6280151f0
--- /dev/null
+++ b/sapi/fuzzer/corpus/exif/bug77563.jpg
Binary files differ
diff --git a/sapi/fuzzer/corpus/exif/bug77753.tiff b/sapi/fuzzer/corpus/exif/bug77753.tiff
new file mode 100644
index 0000000000..b237f39e2b
--- /dev/null
+++ b/sapi/fuzzer/corpus/exif/bug77753.tiff
Binary files differ
diff --git a/sapi/fuzzer/corpus/exif/bug77831.tiff b/sapi/fuzzer/corpus/exif/bug77831.tiff
new file mode 100644
index 0000000000..c7e9f4472b
--- /dev/null
+++ b/sapi/fuzzer/corpus/exif/bug77831.tiff
Binary files differ
diff --git a/sapi/fuzzer/corpus/exif/bug77950.tiff b/sapi/fuzzer/corpus/exif/bug77950.tiff
new file mode 100644
index 0000000000..5c8250ab04
--- /dev/null
+++ b/sapi/fuzzer/corpus/exif/bug77950.tiff
Binary files differ
diff --git a/sapi/fuzzer/corpus/exif/bug77988.jpg b/sapi/fuzzer/corpus/exif/bug77988.jpg
new file mode 100644
index 0000000000..120ff8565a
--- /dev/null
+++ b/sapi/fuzzer/corpus/exif/bug77988.jpg
Binary files differ
diff --git a/sapi/fuzzer/corpus/exif/duplicate_copyright_tag_leak.tiff b/sapi/fuzzer/corpus/exif/duplicate_copyright_tag_leak.tiff
new file mode 100644
index 0000000000..48c7fe61ff
--- /dev/null
+++ b/sapi/fuzzer/corpus/exif/duplicate_copyright_tag_leak.tiff
Binary files differ
diff --git a/sapi/fuzzer/corpus/exif/exif_encoding_crash.jpg b/sapi/fuzzer/corpus/exif/exif_encoding_crash.jpg
new file mode 100644
index 0000000000..55138abe55
--- /dev/null
+++ b/sapi/fuzzer/corpus/exif/exif_encoding_crash.jpg
Binary files differ
diff --git a/sapi/fuzzer/corpus/exif/image007.jpg b/sapi/fuzzer/corpus/exif/image007.jpg
new file mode 100644
index 0000000000..852654075a
--- /dev/null
+++ b/sapi/fuzzer/corpus/exif/image007.jpg
Binary files differ
diff --git a/sapi/fuzzer/corpus/exif/image008.jpg b/sapi/fuzzer/corpus/exif/image008.jpg
new file mode 100644
index 0000000000..3e8bfe4512
--- /dev/null
+++ b/sapi/fuzzer/corpus/exif/image008.jpg
Binary files differ
diff --git a/sapi/fuzzer/corpus/exif/image009.jpg b/sapi/fuzzer/corpus/exif/image009.jpg
new file mode 100644
index 0000000000..8803ddccd4
--- /dev/null
+++ b/sapi/fuzzer/corpus/exif/image009.jpg
Binary files differ
diff --git a/sapi/fuzzer/corpus/exif/image010.jpg b/sapi/fuzzer/corpus/exif/image010.jpg
new file mode 100644
index 0000000000..31ed6d678d
--- /dev/null
+++ b/sapi/fuzzer/corpus/exif/image010.jpg
Binary files differ
diff --git a/sapi/fuzzer/corpus/exif/image011.jpg b/sapi/fuzzer/corpus/exif/image011.jpg
new file mode 100644
index 0000000000..fcd5783ec7
--- /dev/null
+++ b/sapi/fuzzer/corpus/exif/image011.jpg
Binary files differ
diff --git a/sapi/fuzzer/corpus/exif/image012.jpg b/sapi/fuzzer/corpus/exif/image012.jpg
new file mode 100644
index 0000000000..dd25e06181
--- /dev/null
+++ b/sapi/fuzzer/corpus/exif/image012.jpg
Binary files differ
diff --git a/sapi/fuzzer/corpus/exif/image013.jpg b/sapi/fuzzer/corpus/exif/image013.jpg
new file mode 100644
index 0000000000..93ded26667
--- /dev/null
+++ b/sapi/fuzzer/corpus/exif/image013.jpg
Binary files differ
diff --git a/sapi/fuzzer/corpus/exif/image014.jpg b/sapi/fuzzer/corpus/exif/image014.jpg
new file mode 100644
index 0000000000..7657a0a4c7
--- /dev/null
+++ b/sapi/fuzzer/corpus/exif/image014.jpg
Binary files differ
diff --git a/sapi/fuzzer/corpus/exif/image015.jpg b/sapi/fuzzer/corpus/exif/image015.jpg
new file mode 100644
index 0000000000..6f52dec4d7
--- /dev/null
+++ b/sapi/fuzzer/corpus/exif/image015.jpg
Binary files differ
diff --git a/sapi/fuzzer/corpus/exif/image016.tiff b/sapi/fuzzer/corpus/exif/image016.tiff
new file mode 100644
index 0000000000..1712113933
--- /dev/null
+++ b/sapi/fuzzer/corpus/exif/image016.tiff
Binary files differ
diff --git a/sapi/fuzzer/corpus/exif/image017.tiff b/sapi/fuzzer/corpus/exif/image017.tiff
new file mode 100644
index 0000000000..89800d8796
--- /dev/null
+++ b/sapi/fuzzer/corpus/exif/image017.tiff
Binary files differ
diff --git a/sapi/fuzzer/corpus/exif/image018.tiff b/sapi/fuzzer/corpus/exif/image018.tiff
new file mode 100644
index 0000000000..6b4492f7cd
--- /dev/null
+++ b/sapi/fuzzer/corpus/exif/image018.tiff
Binary files differ
diff --git a/sapi/fuzzer/corpus/exif/image020.tiff b/sapi/fuzzer/corpus/exif/image020.tiff
new file mode 100644
index 0000000000..87f187821a
--- /dev/null
+++ b/sapi/fuzzer/corpus/exif/image020.tiff
Binary files differ
diff --git a/sapi/fuzzer/corpus/exif/image021.tiff b/sapi/fuzzer/corpus/exif/image021.tiff
new file mode 100644
index 0000000000..190f30b93a
--- /dev/null
+++ b/sapi/fuzzer/corpus/exif/image021.tiff
Binary files differ
diff --git a/sapi/fuzzer/corpus/exif/image022.tiff b/sapi/fuzzer/corpus/exif/image022.tiff
new file mode 100644
index 0000000000..88f4373341
--- /dev/null
+++ b/sapi/fuzzer/corpus/exif/image022.tiff
Binary files differ
diff --git a/sapi/fuzzer/corpus/exif/image023.tiff b/sapi/fuzzer/corpus/exif/image023.tiff
new file mode 100644
index 0000000000..dc33f6ed90
--- /dev/null
+++ b/sapi/fuzzer/corpus/exif/image023.tiff
Binary files differ
diff --git a/sapi/fuzzer/corpus/exif/image024.jpg b/sapi/fuzzer/corpus/exif/image024.jpg
new file mode 100644
index 0000000000..0b5a42e894
--- /dev/null
+++ b/sapi/fuzzer/corpus/exif/image024.jpg
Binary files differ
diff --git a/sapi/fuzzer/corpus/exif/image025.jpg b/sapi/fuzzer/corpus/exif/image025.jpg
new file mode 100644
index 0000000000..a5c0e17c7a
--- /dev/null
+++ b/sapi/fuzzer/corpus/exif/image025.jpg
Binary files differ
diff --git a/sapi/fuzzer/corpus/exif/image026.tiff b/sapi/fuzzer/corpus/exif/image026.tiff
new file mode 100644
index 0000000000..8fdafc738f
--- /dev/null
+++ b/sapi/fuzzer/corpus/exif/image026.tiff
Binary files differ
diff --git a/sapi/fuzzer/corpus/exif/image027.tiff b/sapi/fuzzer/corpus/exif/image027.tiff
new file mode 100644
index 0000000000..7c3a37a90a
--- /dev/null
+++ b/sapi/fuzzer/corpus/exif/image027.tiff
Binary files differ
diff --git a/sapi/fuzzer/corpus/exif/tag_with_illegal_zero_components.jpeg b/sapi/fuzzer/corpus/exif/tag_with_illegal_zero_components.jpeg
new file mode 100644
index 0000000000..c000b938df
--- /dev/null
+++ b/sapi/fuzzer/corpus/exif/tag_with_illegal_zero_components.jpeg
Binary files differ
diff --git a/sapi/fuzzer/corpus/exif/temporary_buffer_leak.jpg b/sapi/fuzzer/corpus/exif/temporary_buffer_leak.jpg
new file mode 100644
index 0000000000..c9f7ce821f
--- /dev/null
+++ b/sapi/fuzzer/corpus/exif/temporary_buffer_leak.jpg
Binary files differ
diff --git a/sapi/fuzzer/corpus/exif/test1.jpg b/sapi/fuzzer/corpus/exif/test1.jpg
new file mode 100644
index 0000000000..121decb65a
--- /dev/null
+++ b/sapi/fuzzer/corpus/exif/test1.jpg
Binary files differ
diff --git a/sapi/fuzzer/corpus/exif/test2.jpg b/sapi/fuzzer/corpus/exif/test2.jpg
new file mode 100644
index 0000000000..f60ecded6f
--- /dev/null
+++ b/sapi/fuzzer/corpus/exif/test2.jpg
Binary files differ
diff --git a/sapi/fuzzer/corpus/exif/test22.jpg b/sapi/fuzzer/corpus/exif/test22.jpg
new file mode 100644
index 0000000000..f60ecded6f
--- /dev/null
+++ b/sapi/fuzzer/corpus/exif/test22.jpg
Binary files differ
diff --git a/sapi/fuzzer/corpus/exif/test3.jpg b/sapi/fuzzer/corpus/exif/test3.jpg
new file mode 100644
index 0000000000..7547a16630
--- /dev/null
+++ b/sapi/fuzzer/corpus/exif/test3.jpg
Binary files differ
diff --git a/sapi/fuzzer/corpus/exif/test4.jpg b/sapi/fuzzer/corpus/exif/test4.jpg
new file mode 100644
index 0000000000..8a23a7b658
--- /dev/null
+++ b/sapi/fuzzer/corpus/exif/test4.jpg
Binary files differ
diff --git a/sapi/fuzzer/corpus/exif/test5.jpg b/sapi/fuzzer/corpus/exif/test5.jpg
new file mode 100644
index 0000000000..d03cac18a3
--- /dev/null
+++ b/sapi/fuzzer/corpus/exif/test5.jpg
Binary files differ
diff --git a/sapi/fuzzer/corpus/exif/test6.jpg b/sapi/fuzzer/corpus/exif/test6.jpg
new file mode 100644
index 0000000000..073cefdfe0
--- /dev/null
+++ b/sapi/fuzzer/corpus/exif/test6.jpg
Binary files differ
diff --git a/sapi/fuzzer/corpus/exif/zero_length_makernote_leak.tiff b/sapi/fuzzer/corpus/exif/zero_length_makernote_leak.tiff
new file mode 100644
index 0000000000..f1541b39b6
--- /dev/null
+++ b/sapi/fuzzer/corpus/exif/zero_length_makernote_leak.tiff
Binary files differ
diff --git a/sapi/fuzzer/corpus/json/1.json b/sapi/fuzzer/corpus/json/1.json
new file mode 100644
index 0000000000..8161287aab
--- /dev/null
+++ b/sapi/fuzzer/corpus/json/1.json
@@ -0,0 +1 @@
+{"prop":{"prop":null}}
diff --git a/sapi/fuzzer/corpus/json/10.json b/sapi/fuzzer/corpus/json/10.json
new file mode 100644
index 0000000000..59483c2539
--- /dev/null
+++ b/sapi/fuzzer/corpus/json/10.json
@@ -0,0 +1 @@
+{"a":100.1,"b":"foo"}
diff --git a/sapi/fuzzer/corpus/json/11.json b/sapi/fuzzer/corpus/json/11.json
new file mode 100644
index 0000000000..e3907a414c
--- /dev/null
+++ b/sapi/fuzzer/corpus/json/11.json
@@ -0,0 +1 @@
+[100.1,"bar"]
diff --git a/sapi/fuzzer/corpus/json/12.json b/sapi/fuzzer/corpus/json/12.json
new file mode 100644
index 0000000000..222a6678f9
--- /dev/null
+++ b/sapi/fuzzer/corpus/json/12.json
@@ -0,0 +1,2 @@
+{"0":0,"\u0000ab":1,"1":"\u0000null-prefixed value"}
+
diff --git a/sapi/fuzzer/corpus/json/13.json b/sapi/fuzzer/corpus/json/13.json
new file mode 100644
index 0000000000..b9c504cdbe
--- /dev/null
+++ b/sapi/fuzzer/corpus/json/13.json
@@ -0,0 +1 @@
+{ "test": { "foo": "bar" } }
diff --git a/sapi/fuzzer/corpus/json/14.json b/sapi/fuzzer/corpus/json/14.json
new file mode 100644
index 0000000000..0014681471
--- /dev/null
+++ b/sapi/fuzzer/corpus/json/14.json
@@ -0,0 +1,2 @@
+"aa\udbff\udffdzz"
+
diff --git a/sapi/fuzzer/corpus/json/15.json b/sapi/fuzzer/corpus/json/15.json
new file mode 100644
index 0000000000..92591f81a3
--- /dev/null
+++ b/sapi/fuzzer/corpus/json/15.json
@@ -0,0 +1 @@
+"latin 1234 -\/ russian мама мыла раму specialchars \u0002 \b \n U+1D11E >ð„ž<"
diff --git a/sapi/fuzzer/corpus/json/16.json b/sapi/fuzzer/corpus/json/16.json
new file mode 100644
index 0000000000..2129292029
--- /dev/null
+++ b/sapi/fuzzer/corpus/json/16.json
@@ -0,0 +1 @@
+{"test":"123343e871700"}
diff --git a/sapi/fuzzer/corpus/json/17.json b/sapi/fuzzer/corpus/json/17.json
new file mode 100644
index 0000000000..4e4676b299
--- /dev/null
+++ b/sapi/fuzzer/corpus/json/17.json
@@ -0,0 +1 @@
+[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[["Too deep"]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]
diff --git a/sapi/fuzzer/corpus/json/18.json b/sapi/fuzzer/corpus/json/18.json
new file mode 100644
index 0000000000..81873afdec
--- /dev/null
+++ b/sapi/fuzzer/corpus/json/18.json
@@ -0,0 +1 @@
+{"myInt":99,"myFloat":123.45,"myNull":null,"myBool":true,"myString":"Hello World"}
diff --git a/sapi/fuzzer/corpus/json/19.json b/sapi/fuzzer/corpus/json/19.json
new file mode 100644
index 0000000000..cc33c95a71
--- /dev/null
+++ b/sapi/fuzzer/corpus/json/19.json
@@ -0,0 +1 @@
+"\u65e5\u672c\u8a9e\u30c6\u30ad\u30b9\u30c8\u3067\u3059\u300201234\uff15\uff16\uff17\uff18\uff19\u3002"
diff --git a/sapi/fuzzer/corpus/json/2.json b/sapi/fuzzer/corpus/json/2.json
new file mode 100644
index 0000000000..3a9a9722e2
--- /dev/null
+++ b/sapi/fuzzer/corpus/json/2.json
@@ -0,0 +1 @@
+{"largenum":123456789012345678901234567890}
diff --git a/sapi/fuzzer/corpus/json/3.json b/sapi/fuzzer/corpus/json/3.json
new file mode 100644
index 0000000000..b004f2079d
--- /dev/null
+++ b/sapi/fuzzer/corpus/json/3.json
@@ -0,0 +1 @@
+["<foo>","'bar'","\"baz\"","&blong&"]
diff --git a/sapi/fuzzer/corpus/json/4.json b/sapi/fuzzer/corpus/json/4.json
new file mode 100644
index 0000000000..8e73a26dab
--- /dev/null
+++ b/sapi/fuzzer/corpus/json/4.json
@@ -0,0 +1 @@
+["\u003Cfoo\u003E","\u0027bar\u0027","\u0022baz\u0022","\u0026blong\u0026"]
diff --git a/sapi/fuzzer/corpus/json/5.json b/sapi/fuzzer/corpus/json/5.json
new file mode 100644
index 0000000000..5c7912450d
--- /dev/null
+++ b/sapi/fuzzer/corpus/json/5.json
@@ -0,0 +1,5 @@
+[
+{"":"value"},
+{"":"value", "key":"value"},
+{"key":"value", "":"value"}
+]
diff --git a/sapi/fuzzer/corpus/json/6.json b/sapi/fuzzer/corpus/json/6.json
new file mode 100644
index 0000000000..2d852843f1
--- /dev/null
+++ b/sapi/fuzzer/corpus/json/6.json
@@ -0,0 +1 @@
+[123,13452345,123.13452345]
diff --git a/sapi/fuzzer/corpus/json/7.json b/sapi/fuzzer/corpus/json/7.json
new file mode 100644
index 0000000000..6e74debaf0
--- /dev/null
+++ b/sapi/fuzzer/corpus/json/7.json
@@ -0,0 +1,2 @@
+["\ud834\udd00"]
+
diff --git a/sapi/fuzzer/corpus/json/8.json b/sapi/fuzzer/corpus/json/8.json
new file mode 100644
index 0000000000..7ea60c3af9
--- /dev/null
+++ b/sapi/fuzzer/corpus/json/8.json
@@ -0,0 +1 @@
+{"zero": 0e0}
diff --git a/sapi/fuzzer/corpus/json/9.json b/sapi/fuzzer/corpus/json/9.json
new file mode 100644
index 0000000000..49e7327986
--- /dev/null
+++ b/sapi/fuzzer/corpus/json/9.json
@@ -0,0 +1 @@
+[null,null,"abc"]
diff --git a/sapi/fuzzer/corpus/json/fail1.json b/sapi/fuzzer/corpus/json/fail1.json
new file mode 100644
index 0000000000..6216b865f1
--- /dev/null
+++ b/sapi/fuzzer/corpus/json/fail1.json
@@ -0,0 +1 @@
+"A JSON payload should be an object or array, not a string." \ No newline at end of file
diff --git a/sapi/fuzzer/corpus/json/fail10.json b/sapi/fuzzer/corpus/json/fail10.json
new file mode 100644
index 0000000000..5d8c0047bd
--- /dev/null
+++ b/sapi/fuzzer/corpus/json/fail10.json
@@ -0,0 +1 @@
+{"Extra value after close": true} "misplaced quoted value" \ No newline at end of file
diff --git a/sapi/fuzzer/corpus/json/fail11.json b/sapi/fuzzer/corpus/json/fail11.json
new file mode 100644
index 0000000000..76eb95b458
--- /dev/null
+++ b/sapi/fuzzer/corpus/json/fail11.json
@@ -0,0 +1 @@
+{"Illegal expression": 1 + 2} \ No newline at end of file
diff --git a/sapi/fuzzer/corpus/json/fail12.json b/sapi/fuzzer/corpus/json/fail12.json
new file mode 100644
index 0000000000..77580a4522
--- /dev/null
+++ b/sapi/fuzzer/corpus/json/fail12.json
@@ -0,0 +1 @@
+{"Illegal invocation": alert()} \ No newline at end of file
diff --git a/sapi/fuzzer/corpus/json/fail13.json b/sapi/fuzzer/corpus/json/fail13.json
new file mode 100644
index 0000000000..379406b59b
--- /dev/null
+++ b/sapi/fuzzer/corpus/json/fail13.json
@@ -0,0 +1 @@
+{"Numbers cannot have leading zeroes": 013} \ No newline at end of file
diff --git a/sapi/fuzzer/corpus/json/fail14.json b/sapi/fuzzer/corpus/json/fail14.json
new file mode 100644
index 0000000000..0ed366b38a
--- /dev/null
+++ b/sapi/fuzzer/corpus/json/fail14.json
@@ -0,0 +1 @@
+{"Numbers cannot be hex": 0x14} \ No newline at end of file
diff --git a/sapi/fuzzer/corpus/json/fail15.json b/sapi/fuzzer/corpus/json/fail15.json
new file mode 100644
index 0000000000..fc8376b605
--- /dev/null
+++ b/sapi/fuzzer/corpus/json/fail15.json
@@ -0,0 +1 @@
+["Illegal backslash escape: \x15"] \ No newline at end of file
diff --git a/sapi/fuzzer/corpus/json/fail16.json b/sapi/fuzzer/corpus/json/fail16.json
new file mode 100644
index 0000000000..3fe21d4b53
--- /dev/null
+++ b/sapi/fuzzer/corpus/json/fail16.json
@@ -0,0 +1 @@
+[\naked] \ No newline at end of file
diff --git a/sapi/fuzzer/corpus/json/fail17.json b/sapi/fuzzer/corpus/json/fail17.json
new file mode 100644
index 0000000000..62b9214aed
--- /dev/null
+++ b/sapi/fuzzer/corpus/json/fail17.json
@@ -0,0 +1 @@
+["Illegal backslash escape: \017"] \ No newline at end of file
diff --git a/sapi/fuzzer/corpus/json/fail18.json b/sapi/fuzzer/corpus/json/fail18.json
new file mode 100644
index 0000000000..edac92716f
--- /dev/null
+++ b/sapi/fuzzer/corpus/json/fail18.json
@@ -0,0 +1 @@
+[[[[[[[[[[[[[[[[[[[["Too deep"]]]]]]]]]]]]]]]]]]]] \ No newline at end of file
diff --git a/sapi/fuzzer/corpus/json/fail19.json b/sapi/fuzzer/corpus/json/fail19.json
new file mode 100644
index 0000000000..3b9c46fa9a
--- /dev/null
+++ b/sapi/fuzzer/corpus/json/fail19.json
@@ -0,0 +1 @@
+{"Missing colon" null} \ No newline at end of file
diff --git a/sapi/fuzzer/corpus/json/fail2.json b/sapi/fuzzer/corpus/json/fail2.json
new file mode 100644
index 0000000000..6b7c11e5a5
--- /dev/null
+++ b/sapi/fuzzer/corpus/json/fail2.json
@@ -0,0 +1 @@
+["Unclosed array" \ No newline at end of file
diff --git a/sapi/fuzzer/corpus/json/fail20.json b/sapi/fuzzer/corpus/json/fail20.json
new file mode 100644
index 0000000000..27c1af3e72
--- /dev/null
+++ b/sapi/fuzzer/corpus/json/fail20.json
@@ -0,0 +1 @@
+{"Double colon":: null} \ No newline at end of file
diff --git a/sapi/fuzzer/corpus/json/fail21.json b/sapi/fuzzer/corpus/json/fail21.json
new file mode 100644
index 0000000000..62474573b2
--- /dev/null
+++ b/sapi/fuzzer/corpus/json/fail21.json
@@ -0,0 +1 @@
+{"Comma instead of colon", null} \ No newline at end of file
diff --git a/sapi/fuzzer/corpus/json/fail22.json b/sapi/fuzzer/corpus/json/fail22.json
new file mode 100644
index 0000000000..a7752581bc
--- /dev/null
+++ b/sapi/fuzzer/corpus/json/fail22.json
@@ -0,0 +1 @@
+["Colon instead of comma": false] \ No newline at end of file
diff --git a/sapi/fuzzer/corpus/json/fail23.json b/sapi/fuzzer/corpus/json/fail23.json
new file mode 100644
index 0000000000..494add1ca1
--- /dev/null
+++ b/sapi/fuzzer/corpus/json/fail23.json
@@ -0,0 +1 @@
+["Bad value", truth] \ No newline at end of file
diff --git a/sapi/fuzzer/corpus/json/fail24.json b/sapi/fuzzer/corpus/json/fail24.json
new file mode 100644
index 0000000000..caff239bfc
--- /dev/null
+++ b/sapi/fuzzer/corpus/json/fail24.json
@@ -0,0 +1 @@
+['single quote'] \ No newline at end of file
diff --git a/sapi/fuzzer/corpus/json/fail25.json b/sapi/fuzzer/corpus/json/fail25.json
new file mode 100644
index 0000000000..8b7ad23e01
--- /dev/null
+++ b/sapi/fuzzer/corpus/json/fail25.json
@@ -0,0 +1 @@
+[" tab character in string "] \ No newline at end of file
diff --git a/sapi/fuzzer/corpus/json/fail26.json b/sapi/fuzzer/corpus/json/fail26.json
new file mode 100644
index 0000000000..845d26a6a5
--- /dev/null
+++ b/sapi/fuzzer/corpus/json/fail26.json
@@ -0,0 +1 @@
+["tab\ character\ in\ string\ "] \ No newline at end of file
diff --git a/sapi/fuzzer/corpus/json/fail27.json b/sapi/fuzzer/corpus/json/fail27.json
new file mode 100644
index 0000000000..6b01a2ca4a
--- /dev/null
+++ b/sapi/fuzzer/corpus/json/fail27.json
@@ -0,0 +1,2 @@
+["line
+break"] \ No newline at end of file
diff --git a/sapi/fuzzer/corpus/json/fail28.json b/sapi/fuzzer/corpus/json/fail28.json
new file mode 100644
index 0000000000..621a0101c6
--- /dev/null
+++ b/sapi/fuzzer/corpus/json/fail28.json
@@ -0,0 +1,2 @@
+["line\
+break"] \ No newline at end of file
diff --git a/sapi/fuzzer/corpus/json/fail29.json b/sapi/fuzzer/corpus/json/fail29.json
new file mode 100644
index 0000000000..47ec421bb6
--- /dev/null
+++ b/sapi/fuzzer/corpus/json/fail29.json
@@ -0,0 +1 @@
+[0e] \ No newline at end of file
diff --git a/sapi/fuzzer/corpus/json/fail3.json b/sapi/fuzzer/corpus/json/fail3.json
new file mode 100644
index 0000000000..168c81eb78
--- /dev/null
+++ b/sapi/fuzzer/corpus/json/fail3.json
@@ -0,0 +1 @@
+{unquoted_key: "keys must be quoted"} \ No newline at end of file
diff --git a/sapi/fuzzer/corpus/json/fail30.json b/sapi/fuzzer/corpus/json/fail30.json
new file mode 100644
index 0000000000..8ab0bc4b8b
--- /dev/null
+++ b/sapi/fuzzer/corpus/json/fail30.json
@@ -0,0 +1 @@
+[0e+] \ No newline at end of file
diff --git a/sapi/fuzzer/corpus/json/fail31.json b/sapi/fuzzer/corpus/json/fail31.json
new file mode 100644
index 0000000000..1cce602b51
--- /dev/null
+++ b/sapi/fuzzer/corpus/json/fail31.json
@@ -0,0 +1 @@
+[0e+-1] \ No newline at end of file
diff --git a/sapi/fuzzer/corpus/json/fail32.json b/sapi/fuzzer/corpus/json/fail32.json
new file mode 100644
index 0000000000..45cba7396f
--- /dev/null
+++ b/sapi/fuzzer/corpus/json/fail32.json
@@ -0,0 +1 @@
+{"Comma instead if closing brace": true, \ No newline at end of file
diff --git a/sapi/fuzzer/corpus/json/fail33.json b/sapi/fuzzer/corpus/json/fail33.json
new file mode 100644
index 0000000000..ca5eb19dc9
--- /dev/null
+++ b/sapi/fuzzer/corpus/json/fail33.json
@@ -0,0 +1 @@
+["mismatch"} \ No newline at end of file
diff --git a/sapi/fuzzer/corpus/json/fail4.json b/sapi/fuzzer/corpus/json/fail4.json
new file mode 100644
index 0000000000..9de168bf34
--- /dev/null
+++ b/sapi/fuzzer/corpus/json/fail4.json
@@ -0,0 +1 @@
+["extra comma",] \ No newline at end of file
diff --git a/sapi/fuzzer/corpus/json/fail5.json b/sapi/fuzzer/corpus/json/fail5.json
new file mode 100644
index 0000000000..ddf3ce3d24
--- /dev/null
+++ b/sapi/fuzzer/corpus/json/fail5.json
@@ -0,0 +1 @@
+["double extra comma",,] \ No newline at end of file
diff --git a/sapi/fuzzer/corpus/json/fail6.json b/sapi/fuzzer/corpus/json/fail6.json
new file mode 100644
index 0000000000..ed91580e1b
--- /dev/null
+++ b/sapi/fuzzer/corpus/json/fail6.json
@@ -0,0 +1 @@
+[ , "<-- missing value"] \ No newline at end of file
diff --git a/sapi/fuzzer/corpus/json/fail7.json b/sapi/fuzzer/corpus/json/fail7.json
new file mode 100644
index 0000000000..8a96af3e4e
--- /dev/null
+++ b/sapi/fuzzer/corpus/json/fail7.json
@@ -0,0 +1 @@
+["Comma after the close"], \ No newline at end of file
diff --git a/sapi/fuzzer/corpus/json/fail8.json b/sapi/fuzzer/corpus/json/fail8.json
new file mode 100644
index 0000000000..b28479c6ec
--- /dev/null
+++ b/sapi/fuzzer/corpus/json/fail8.json
@@ -0,0 +1 @@
+["Extra close"]] \ No newline at end of file
diff --git a/sapi/fuzzer/corpus/json/fail9.json b/sapi/fuzzer/corpus/json/fail9.json
new file mode 100644
index 0000000000..5815574f36
--- /dev/null
+++ b/sapi/fuzzer/corpus/json/fail9.json
@@ -0,0 +1 @@
+{"Extra comma": true,} \ No newline at end of file
diff --git a/sapi/fuzzer/corpus/json/pass1.json b/sapi/fuzzer/corpus/json/pass1.json
new file mode 100644
index 0000000000..70e2685436
--- /dev/null
+++ b/sapi/fuzzer/corpus/json/pass1.json
@@ -0,0 +1,58 @@
+[
+ "JSON Test Pattern pass1",
+ {"object with 1 member":["array with 1 element"]},
+ {},
+ [],
+ -42,
+ true,
+ false,
+ null,
+ {
+ "integer": 1234567890,
+ "real": -9876.543210,
+ "e": 0.123456789e-12,
+ "E": 1.234567890E+34,
+ "": 23456789012E66,
+ "zero": 0,
+ "one": 1,
+ "space": " ",
+ "quote": "\"",
+ "backslash": "\\",
+ "controls": "\b\f\n\r\t",
+ "slash": "/ & \/",
+ "alpha": "abcdefghijklmnopqrstuvwyz",
+ "ALPHA": "ABCDEFGHIJKLMNOPQRSTUVWYZ",
+ "digit": "0123456789",
+ "0123456789": "digit",
+ "special": "`1~!@#$%^&*()_+-={':[,]}|;.</>?",
+ "hex": "\u0123\u4567\u89AB\uCDEF\uabcd\uef4A",
+ "true": true,
+ "false": false,
+ "null": null,
+ "array":[ ],
+ "object":{ },
+ "address": "50 St. James Street",
+ "url": "http://www.JSON.org/",
+ "comment": "// /* <!-- --",
+ "# -- --> */": " ",
+ " s p a c e d " :[1,2 , 3
+
+,
+
+4 , 5 , 6 ,7 ],"compact":[1,2,3,4,5,6,7],
+ "jsontext": "{\"object with 1 member\":[\"array with 1 element\"]}",
+ "quotes": "&#34; \u0022 %22 0x22 034 &#x22;",
+ "\/\\\"\uCAFE\uBABE\uAB98\uFCDE\ubcda\uef4A\b\f\n\r\t`1~!@#$%^&*()_+-=[]{}|;:',./<>?"
+: "A key can be any string"
+ },
+ 0.5 ,98.6
+,
+99.44
+,
+
+1066,
+1e1,
+0.1e1,
+1e-1,
+1e00,2e+00,2e-00
+,"rosebud"] \ No newline at end of file
diff --git a/sapi/fuzzer/corpus/json/pass2.json b/sapi/fuzzer/corpus/json/pass2.json
new file mode 100644
index 0000000000..d3c63c7ad8
--- /dev/null
+++ b/sapi/fuzzer/corpus/json/pass2.json
@@ -0,0 +1 @@
+[[[[[[[[[[[[[[[[[[["Not too deep"]]]]]]]]]]]]]]]]]]] \ No newline at end of file
diff --git a/sapi/fuzzer/corpus/json/pass3.json b/sapi/fuzzer/corpus/json/pass3.json
new file mode 100644
index 0000000000..4528d51f1a
--- /dev/null
+++ b/sapi/fuzzer/corpus/json/pass3.json
@@ -0,0 +1,6 @@
+{
+ "JSON Test Pattern pass3": {
+ "The outermost value": "must be an object or array.",
+ "In this test": "It is an object."
+ }
+}
diff --git a/sapi/fuzzer/corpus/unserialize/__serialize_007 b/sapi/fuzzer/corpus/unserialize/__serialize_007
new file mode 100644
index 0000000000..6709aca303
--- /dev/null
+++ b/sapi/fuzzer/corpus/unserialize/__serialize_007
@@ -0,0 +1 @@
+O:13:"ArrayIterator":2:{i:0;i:0;s:1:"x";R:2;}
diff --git a/sapi/fuzzer/corpus/unserialize/bug7131 b/sapi/fuzzer/corpus/unserialize/bug7131
new file mode 100644
index 0000000000..1ba49d8da1
--- /dev/null
+++ b/sapi/fuzzer/corpus/unserialize/bug7131
@@ -0,0 +1 @@
+C:11:"ArrayObject":11:{x:i:0;r:3;X} \ No newline at end of file
diff --git a/sapi/fuzzer/corpus/unserialize/bug71313 b/sapi/fuzzer/corpus/unserialize/bug71313
new file mode 100644
index 0000000000..4163b0350a
--- /dev/null
+++ b/sapi/fuzzer/corpus/unserialize/bug71313
@@ -0,0 +1 @@
+C:16:"SplObjectStorage":113:{x:i:2;O:8:"stdClass":0:{},a:2:{s:4:"prev";i:2;s:4:"next";O:8:"stdClass":0:{}};r:7;,R:2;s:4:"next";;r:3;};m:a:0:{}} \ No newline at end of file
diff --git a/sapi/fuzzer/corpus/unserialize/bug73144_1 b/sapi/fuzzer/corpus/unserialize/bug73144_1
new file mode 100644
index 0000000000..0d6d600520
--- /dev/null
+++ b/sapi/fuzzer/corpus/unserialize/bug73144_1
@@ -0,0 +1 @@
+a:2:{i:0;O:1:"0":2:0s:1:"0";i:0;s:1:"0";a:1:{i:0;C:11:"ArrayObject":7:{x:i:0;r}
diff --git a/sapi/fuzzer/corpus/unserialize/bug73144_2 b/sapi/fuzzer/corpus/unserialize/bug73144_2
new file mode 100644
index 0000000000..d1145066c5
--- /dev/null
+++ b/sapi/fuzzer/corpus/unserialize/bug73144_2
@@ -0,0 +1 @@
+C:11:"ArrayObject":34:{x:i:1;O:8:"stdClass":1:{};m:a:0:{}} \ No newline at end of file
diff --git a/sapi/fuzzer/corpus/unserialize/bug73825 b/sapi/fuzzer/corpus/unserialize/bug73825
new file mode 100644
index 0000000000..dc9b0e4334
--- /dev/null
+++ b/sapi/fuzzer/corpus/unserialize/bug73825
@@ -0,0 +1 @@
+O:8:"00000000":
diff --git a/sapi/fuzzer/corpus/unserialize/bug74101 b/sapi/fuzzer/corpus/unserialize/bug74101
new file mode 100644
index 0000000000..b8d2fd2308
--- /dev/null
+++ b/sapi/fuzzer/corpus/unserialize/bug74101
@@ -0,0 +1 @@
+O:9:"Exception":799999999999999999999999999997:0i:0;a:0:{}i:2;i:0;i:0;R:2;
diff --git a/sapi/fuzzer/corpus/unserialize/bug74103 b/sapi/fuzzer/corpus/unserialize/bug74103
new file mode 100644
index 0000000000..ab2f70239c
--- /dev/null
+++ b/sapi/fuzzer/corpus/unserialize/bug74103
@@ -0,0 +1 @@
+a:7:{i:0;i:04;s:1:"a";i:2;i:9617006;i:4;s:1:"a";i:4;s:1:"a";R:5;s:1:"7";R:3;s:1:"a";R:5;;s:18;}}
diff --git a/sapi/fuzzer/corpus/unserialize/bug74111 b/sapi/fuzzer/corpus/unserialize/bug74111
new file mode 100644
index 0000000000..c1196ee7de
--- /dev/null
+++ b/sapi/fuzzer/corpus/unserialize/bug74111
@@ -0,0 +1 @@
+O:8:"stdClass":00000000
diff --git a/sapi/fuzzer/corpus/unserialize/bug74614 b/sapi/fuzzer/corpus/unserialize/bug74614
new file mode 100644
index 0000000000..c7174893fe
--- /dev/null
+++ b/sapi/fuzzer/corpus/unserialize/bug74614
@@ -0,0 +1 @@
+a:3020000000000000000000000000000001:{i:0;a:0:{}i:1;i:2;i:2;i:3;i:3;i:4;i:4;i:5;i:5;i:6;i:6;i:7;i:7;i:8;i:8;R:2;}
diff --git a/sapi/fuzzer/corpus/unserialize/bug75054 b/sapi/fuzzer/corpus/unserialize/bug75054
new file mode 100644
index 0000000000..866e5b8fca
--- /dev/null
+++ b/sapi/fuzzer/corpus/unserialize/bug75054
@@ -0,0 +1 @@
+a:9:{i:0;s:4:"0000";i:0;s:4:"0000";i:0;R:2;s:4:"5003";R:2;s:4:"0000";R:2;s:4:"0000";R:2;s:4:"000";R:2;s:4:"0000";d:0;s:4:"0000";a:9:{s:4:"0000"; \ No newline at end of file
diff --git a/sapi/fuzzer/corpus/unserialize/int_min_iv b/sapi/fuzzer/corpus/unserialize/int_min_iv
new file mode 100644
index 0000000000..6900dce088
--- /dev/null
+++ b/sapi/fuzzer/corpus/unserialize/int_min_iv
@@ -0,0 +1 @@
+i:-9223372036854775808;
diff --git a/sapi/fuzzer/corpus/unserialize/leak_17628 b/sapi/fuzzer/corpus/unserialize/leak_17628
new file mode 100644
index 0000000000..45fd8644db
--- /dev/null
+++ b/sapi/fuzzer/corpus/unserialize/leak_17628
@@ -0,0 +1 @@
+a:2:{i:0;O:19:"SplDoublyLinkedList":8:i:0;i:04;i:965556;a:6:{i:0;R:04;S:1:"a";i:2;i:961;a:8:{i:0;i:04;i:0;i:0026;i:0;a:2:{i:0;O:13:"RegexIterator":1: i:6176;a:8:{i:0;i:04;S:1:"a";i:2;i:96140012;s:1:"a";i:0;i:91755555500000016742;i:8;a:8:{i:0;i:048;i:2;d:0000800000001000000000000014000000000000000000000040400000004000000516742;i:9;a:8:{i:0;i:048;i:2;d:0000800000001000000000000000000000000000002;i:04;a:9:{i:5;R:11;s:4:"m000";O:9:"Eepictxon":85:{i:5;R:2;s:4:"m000";O:9:"Eepictxon":8:0i:-012;s:1:"a";i:0;i:96170026;i:0;i:04;S:1:"a";i:2;i:9617006;a:7:{i:6;a:7:{i:0;a:9:{i:5;R:1;s:4:"m000";O:9:"Eepictxon":86:{i:5;R:2;s:4:"m000";O:9:"Eepictxon":8:0i:-01400;a:8:{i:0;i:04;i:0;i:0026;i:0;a:2:{i:0;a:2:{i:0;O:19:"SplDoublyLinkedList":8:i:0;86:{i:5;R:2;on":8:0i:-0140012;s:1:"a";i:0;i:96170026;i:0;i:04;S:1:"a";i:2;i:9617006;a:7:{i:07006;a:7:{i:0;a:9:{i:5;R:1;s:4:"m000";O \ No newline at end of file
diff --git a/sapi/fuzzer/corpus/unserialize/leak_17639 b/sapi/fuzzer/corpus/unserialize/leak_17639
new file mode 100644
index 0000000000..fb8625a700
--- /dev/null
+++ b/sapi/fuzzer/corpus/unserialize/leak_17639
@@ -0,0 +1 @@
+a:7:{i:6;i:0;S:1:" ";i:1;i:6;a:8:{i:0;i:4;S:1:" ";i:2;i:9;R:4;S:1:" ";a:2:{i:5;O:13:"RegexIterator":1 i:7;a:8:{i:0;a:7:{i:0;R:10; \ No newline at end of file
diff --git a/sapi/fuzzer/corpus/unserialize/leak_17646 b/sapi/fuzzer/corpus/unserialize/leak_17646
new file mode 100644
index 0000000000..ac7969e683
--- /dev/null
+++ b/sapi/fuzzer/corpus/unserialize/leak_17646
@@ -0,0 +1 @@
+O:13:"RegexIter\tor":3:{S:1:"x";a:9:{i:04;R:1;i:5312;O:13:"RegexIterator":53;¥i:08032617006;a:7:{i:0;R:04;S:1:"a";i:2;i:5312;O:13:"RegexIterator":53;¥i:080326170;O:1:"0":2:1s:1:"1";i:0;i:0;O:13:"Liþÿÿÿterator":2:{i:0;a:6:{i:0;O:1:"0":2:1s:1:"1";i:0;i:1;r:9;}s:1:"1";i:0;i:11111101111110;O:1:"0":4:1s:1:"0";a:6:{i:0;a:2:{i:0;O:10:"ValueError":4:{i:0;O:10:"ValueError":2:{i:0;O:10:"ValueError":4:{i:Error":4:a:7:{s:2:"c{i:0;";a:7:{S:O: \ No newline at end of file
diff --git a/sapi/fuzzer/corpus/unserialize/oss_fuzz_27628 b/sapi/fuzzer/corpus/unserialize/oss_fuzz_27628
new file mode 100644
index 0000000000..e22d1c8888
--- /dev/null
+++ b/sapi/fuzzer/corpus/unserialize/oss_fuzz_27628
@@ -0,0 +1 @@
+O:1:"ÿ":4 S:8:" ";O:5:"ErRor":4 S:8:"previous";O:1:"ÿ":1 s:1:" ";R:3;} \ No newline at end of file
diff --git a/sapi/fuzzer/corpus/unserialize/oss_fuzz_27876 b/sapi/fuzzer/corpus/unserialize/oss_fuzz_27876
new file mode 100644
index 0000000000..98c5a5b19c
--- /dev/null
+++ b/sapi/fuzzer/corpus/unserialize/oss_fuzz_27876
@@ -0,0 +1 @@
+a:2:{i:7;O:5:"ErRor":5 S:8:"previous";a:5:{i:7;R:3; \ No newline at end of file
diff --git a/sapi/fuzzer/corpus/unserialize/oss_fuzz_27978 b/sapi/fuzzer/corpus/unserialize/oss_fuzz_27978
new file mode 100644
index 0000000000..22b45ddf87
--- /dev/null
+++ b/sapi/fuzzer/corpus/unserialize/oss_fuzz_27978
@@ -0,0 +1 @@
+O:1:"ÿ":4 S:8:" ";O:5:"ErRor":3 S:8:"previous";R:2;S:8:"previous"; \ No newline at end of file
diff --git a/sapi/fuzzer/corpus/unserialize/splobjectstorage_negative_count b/sapi/fuzzer/corpus/unserialize/splobjectstorage_negative_count
new file mode 100644
index 0000000000..29a3ac47af
--- /dev/null
+++ b/sapi/fuzzer/corpus/unserialize/splobjectstorage_negative_count
@@ -0,0 +1 @@
+C:16:"SplObjectStorage":25:{x:i:-9223372036854775808;}
diff --git a/sapi/fuzzer/dict/parser b/sapi/fuzzer/dict/parser
new file mode 100644
index 0000000000..8b382afac9
--- /dev/null
+++ b/sapi/fuzzer/dict/parser
@@ -0,0 +1,85 @@
+"exit"
+"die"
+"fn"
+"function"
+"const"
+"return"
+"yield"
+"yield from"
+"try"
+"catch"
+"finally"
+"throw"
+"if"
+"elseif"
+"endif"
+"else"
+"while"
+"endwhile"
+"do"
+"for"
+"endfor"
+"foreach"
+"endforeach"
+"declare"
+"enddeclare"
+"instanceof"
+"as"
+"switch"
+"endswitch"
+"case"
+"default"
+"break"
+"continue"
+"goto"
+"echo"
+"print"
+"class"
+"interface"
+"trait"
+"extends"
+"implements"
+"new"
+"clone"
+"var"
+"int"
+"integer"
+"float"
+"double"
+"real"
+"string"
+"binary"
+"array"
+"object"
+"bool"
+"boolean"
+"unset"
+"eval"
+"include"
+"include_once"
+"require"
+"require_once"
+"namespace"
+"use"
+"insteadof"
+"global"
+"isset"
+"empty"
+"__halt_compiler"
+"static"
+"abstract"
+"final"
+"private"
+"protected"
+"public"
+"unset"
+"list"
+"callable"
+"__class__"
+"__trait__"
+"__function__"
+"__method__"
+"__line__"
+"__file__"
+"__dir__"
+"__namespace__"
diff --git a/sapi/fuzzer/fuzzer-execute.c b/sapi/fuzzer/fuzzer-execute.c
new file mode 100644
index 0000000000..1259acb31e
--- /dev/null
+++ b/sapi/fuzzer/fuzzer-execute.c
@@ -0,0 +1,90 @@
+/*
+ +----------------------------------------------------------------------+
+ | Copyright (c) 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: Nikita Popov <nikic@php.net> |
+ +----------------------------------------------------------------------+
+ */
+
+#include <main/php.h>
+
+#include "fuzzer.h"
+#include "fuzzer-sapi.h"
+
+#define MAX_STEPS 1000
+#define MAX_SIZE (8 * 1024)
+static uint32_t steps_left;
+
+/* Because the fuzzer is always compiled with clang,
+ * we can assume that we don't use global registers / hybrid VM. */
+typedef int (ZEND_FASTCALL *opcode_handler_t)(zend_execute_data *);
+
+static void fuzzer_execute_ex(zend_execute_data *execute_data) {
+ while (1) {
+ int ret;
+ if (--steps_left == 0) {
+ /* Reset steps before bailing out, so code running after bailout (e.g. in
+ * destructors) will get another MAX_STEPS, rather than UINT32_MAX steps. */
+ steps_left = MAX_STEPS;
+ zend_bailout();
+ }
+
+ if ((ret = ((opcode_handler_t) EX(opline)->handler)(execute_data)) != 0) {
+ if (ret > 0) {
+ execute_data = EG(current_execute_data);
+ } else {
+ return;
+ }
+ }
+ }
+}
+
+static zend_op_array *(*orig_compile_string)(zend_string *source_string, const char *filename);
+
+static zend_op_array *fuzzer_compile_string(zend_string *str, const char *filename) {
+ if (ZSTR_LEN(str) > MAX_SIZE) {
+ /* Avoid compiling huge inputs via eval(). */
+ zend_bailout();
+ }
+
+ return orig_compile_string(str, filename);
+}
+
+int LLVMFuzzerTestOneInput(const uint8_t *Data, size_t Size) {
+ if (Size > MAX_SIZE) {
+ /* Large inputs have a large impact on fuzzer performance,
+ * but are unlikely to be necessary to reach new codepaths. */
+ return 0;
+ }
+
+ steps_left = MAX_STEPS;
+ fuzzer_do_request_from_buffer("/fuzzer.php", (const char *) Data, Size, /* execute */ 1);
+
+ return 0;
+}
+
+int LLVMFuzzerInitialize(int *argc, char ***argv) {
+ /* Compilation will often trigger fatal errors.
+ * Use tracked allocation mode to avoid leaks in that case. */
+ putenv("USE_TRACKED_ALLOC=1");
+
+ /* Just like other SAPIs, ignore SIGPIPEs. */
+ signal(SIGPIPE, SIG_IGN);
+
+ fuzzer_init_php();
+
+ zend_execute_ex = fuzzer_execute_ex;
+ orig_compile_string = zend_compile_string;
+ zend_compile_string = fuzzer_compile_string;
+
+ /* fuzzer_shutdown_php(); */
+ return 0;
+}
diff --git a/sapi/fuzzer/fuzzer-exif.c b/sapi/fuzzer/fuzzer-exif.c
new file mode 100644
index 0000000000..71f1c88b78
--- /dev/null
+++ b/sapi/fuzzer/fuzzer-exif.c
@@ -0,0 +1,72 @@
+/*
+ +----------------------------------------------------------------------+
+ | Copyright (c) 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: Stanislav Malyshev <stas@php.net> |
+ +----------------------------------------------------------------------+
+ */
+
+#include "fuzzer.h"
+
+#include "Zend/zend.h"
+#include "main/php_config.h"
+#include "main/php_main.h"
+#include "ext/standard/php_var.h"
+
+#include <stdio.h>
+#include <stdint.h>
+#include <stdlib.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+
+#include "fuzzer-sapi.h"
+
+int LLVMFuzzerTestOneInput(const uint8_t *Data, size_t Size) {
+#if HAVE_EXIF
+ php_stream *stream;
+ zval stream_zv;
+
+ if (Size > 256 * 1024) {
+ /* Large inputs have a large impact on fuzzer performance,
+ * but are unlikely to be necessary to reach new codepaths. */
+ return 0;
+ }
+
+ if (fuzzer_request_startup() == FAILURE) {
+ return 0;
+ }
+
+ stream = php_stream_memory_create(TEMP_STREAM_DEFAULT);
+ php_stream_write(stream, (const char *) Data, Size);
+ php_stream_to_zval(stream, &stream_zv);
+
+ fuzzer_call_php_func_zval("exif_read_data", 1, &stream_zv);
+
+ zval_ptr_dtor(&stream_zv);
+
+ /* cleanup */
+ php_request_shutdown(NULL);
+
+ return 0;
+#else
+ fprintf(stderr, "\n\nERROR:\nPHP built without EXIF, recompile with --enable-exif to use this fuzzer\n");
+ exit(1);
+#endif
+}
+
+int LLVMFuzzerInitialize(int *argc, char ***argv) {
+ fuzzer_init_php();
+
+ /* fuzzer_shutdown_php(); */
+ return 0;
+}
+
diff --git a/sapi/fuzzer/fuzzer-json.c b/sapi/fuzzer/fuzzer-json.c
new file mode 100644
index 0000000000..85fa8bbc8e
--- /dev/null
+++ b/sapi/fuzzer/fuzzer-json.c
@@ -0,0 +1,62 @@
+/*
+ +----------------------------------------------------------------------+
+ | Copyright (c) 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: Johannes Schlüter <johanes@php.net> |
+ | Stanislav Malyshev <stas@php.net> |
+ +----------------------------------------------------------------------+
+ */
+
+
+
+#include "fuzzer.h"
+
+#include "Zend/zend.h"
+#include "main/php_config.h"
+#include "main/php_main.h"
+
+#include <stdio.h>
+#include <stdint.h>
+#include <stdlib.h>
+
+#include "fuzzer-sapi.h"
+#include "ext/json/php_json_parser.h"
+
+int LLVMFuzzerTestOneInput(const uint8_t *Data, size_t Size) {
+ char *data = malloc(Size+1);
+ memcpy(data, Data, Size);
+ data[Size] = '\0';
+
+ if (fuzzer_request_startup() == FAILURE) {
+ return 0;
+ }
+
+ for (int option = 0; option <=1; ++option) {
+ zval result;
+ php_json_parser parser;
+ php_json_parser_init(&parser, &result, data, Size, option, 10);
+ if (php_json_yyparse(&parser) == SUCCESS) {
+ zval_ptr_dtor(&result);
+ }
+ }
+
+ php_request_shutdown(NULL);
+
+ free(data);
+ return 0;
+}
+
+int LLVMFuzzerInitialize(int *argc, char ***argv) {
+ fuzzer_init_php();
+
+ /* fuzzer_shutdown_php(); */
+ return 0;
+}
diff --git a/sapi/fuzzer/fuzzer-mbstring.c b/sapi/fuzzer/fuzzer-mbstring.c
new file mode 100644
index 0000000000..c8f084dbd4
--- /dev/null
+++ b/sapi/fuzzer/fuzzer-mbstring.c
@@ -0,0 +1,78 @@
+/*
+ +----------------------------------------------------------------------+
+ | Copyright (c) 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: Stanislav Malyshev <stas@php.net> |
+ +----------------------------------------------------------------------+
+ */
+
+
+#include "fuzzer.h"
+
+#include "Zend/zend.h"
+#include "main/php_config.h"
+#include "main/php_main.h"
+#include "oniguruma.h"
+
+#include <stdio.h>
+#include <stdint.h>
+#include <stdlib.h>
+
+#include "fuzzer-sapi.h"
+
+int LLVMFuzzerTestOneInput(const uint8_t *Data, size_t Size) {
+#ifdef HAVE_MBREGEX
+ char *args[2];
+ char *data = malloc(Size+1);
+ memcpy(data, Data, Size);
+ data[Size] = '\0';
+
+ if (fuzzer_request_startup() == FAILURE) {
+ return 0;
+ }
+
+ fuzzer_setup_dummy_frame();
+
+ args[0] = data;
+ args[1] = "test123";
+ fuzzer_call_php_func("mb_ereg", 2, args);
+
+ args[0] = data;
+ args[1] = "test123";
+ fuzzer_call_php_func("mb_eregi", 2, args);
+
+ args[0] = data;
+ args[1] = data;
+ fuzzer_call_php_func("mb_ereg", 2, args);
+
+ args[0] = data;
+ args[1] = data;
+ fuzzer_call_php_func("mb_eregi", 2, args);
+
+ fuzzer_request_shutdown();
+
+ free(data);
+#else
+ fprintf(stderr, "\n\nERROR:\nPHP built without mbstring, recompile with --enable-mbstring to use this fuzzer\n");
+ exit(1);
+#endif
+ return 0;
+}
+
+int LLVMFuzzerInitialize(int *argc, char ***argv) {
+ fuzzer_init_php();
+
+ /* The default parse depth limit allows stack overflows under asan. */
+ onig_set_parse_depth_limit(512);
+
+ /* fuzzer_shutdown_php(); */
+ return 0;
+}
diff --git a/sapi/fuzzer/fuzzer-parser.c b/sapi/fuzzer/fuzzer-parser.c
new file mode 100644
index 0000000000..c81a6e1c24
--- /dev/null
+++ b/sapi/fuzzer/fuzzer-parser.c
@@ -0,0 +1,49 @@
+/*
+ +----------------------------------------------------------------------+
+ | Copyright (c) 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: Johannes Schlüter <johanes@php.net> |
+ | Stanislav Malyshev <stas@php.net> |
+ +----------------------------------------------------------------------+
+ */
+
+#include <main/php.h>
+#include <main/php_main.h>
+#include <main/SAPI.h>
+#include <ext/standard/info.h>
+#include <ext/standard/php_var.h>
+#include <main/php_variables.h>
+
+#include "fuzzer.h"
+#include "fuzzer-sapi.h"
+
+int LLVMFuzzerTestOneInput(const uint8_t *Data, size_t Size) {
+ if (Size > 32 * 1024) {
+ /* Large inputs have a large impact on fuzzer performance,
+ * but are unlikely to be necessary to reach new codepaths. */
+ return 0;
+ }
+
+ fuzzer_do_request_from_buffer("fuzzer.php", (const char *) Data, Size, /* execute */ 0);
+
+ return 0;
+}
+
+int LLVMFuzzerInitialize(int *argc, char ***argv) {
+ /* Compilation will often trigger fatal errors.
+ * Use tracked allocation mode to avoid leaks in that case. */
+ putenv("USE_TRACKED_ALLOC=1");
+
+ fuzzer_init_php();
+
+ /* fuzzer_shutdown_php(); */
+ return 0;
+}
diff --git a/sapi/fuzzer/fuzzer-sapi.c b/sapi/fuzzer/fuzzer-sapi.c
new file mode 100644
index 0000000000..fd429f503e
--- /dev/null
+++ b/sapi/fuzzer/fuzzer-sapi.c
@@ -0,0 +1,304 @@
+/*
+ +----------------------------------------------------------------------+
+ | Copyright (c) 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: Johannes Schlüter <johanes@php.net> |
+ | Stanislav Malyshev <stas@php.net> |
+ +----------------------------------------------------------------------+
+ */
+
+#include <main/php.h>
+#include <main/php_main.h>
+#include <main/SAPI.h>
+#include <ext/standard/info.h>
+#include <ext/standard/php_var.h>
+#include <main/php_variables.h>
+#include <zend_exceptions.h>
+
+#ifdef __SANITIZE_ADDRESS__
+# include "sanitizer/lsan_interface.h"
+#endif
+
+#include "fuzzer.h"
+#include "fuzzer-sapi.h"
+
+const char HARDCODED_INI[] =
+ "html_errors=0\n"
+ "implicit_flush=1\n"
+ "output_buffering=0\n"
+ "error_reporting=0\n"
+ /* Let the timeout be enforced by libfuzzer, not PHP. */
+ "max_execution_time=0\n"
+ /* Reduce oniguruma limits to speed up fuzzing */
+ "mbstring.regex_stack_limit=10000\n"
+ "mbstring.regex_retry_limit=10000\n"
+ /* For the "execute" fuzzer disable some functions that are likely to have
+ * undesirable consequences (shell execution, file system writes). */
+ "allow_url_include=0\n"
+ "allow_url_fopen=0\n"
+ "open_basedir=/tmp\n"
+ "disable_functions=dl,mail,mb_send_mail"
+ ",shell_exec,exec,system,proc_open,popen,passthru,pcntl_exec"
+ ",chgrp,chmod,chown,copy,file_put_contents,lchgrp,lchown,link,mkdir"
+ ",move_uploaded_file,rename,rmdir,symlink,tempname,touch,unlink,fopen"
+ /* Networking code likes to wait and wait. */
+ ",fsockopen,pfsockopen"
+ ",stream_socket_pair,stream_socket_client,stream_socket_server"
+ /* crypt() can be very slow. */
+ ",crypt"
+ /* openlog() has a known memory-management issue. */
+ ",openlog"
+ /* Can cause long loops that bypass the executor step limit. */
+ "\ndisable_classes=InfiniteIterator"
+;
+
+static int startup(sapi_module_struct *sapi_module)
+{
+ if (php_module_startup(sapi_module, NULL, 0)==FAILURE) {
+ return FAILURE;
+ }
+ return SUCCESS;
+}
+
+static size_t ub_write(const char *str, size_t str_length)
+{
+ /* quiet */
+ return str_length;
+}
+
+static void fuzzer_flush(void *server_context)
+{
+ /* quiet */
+}
+
+static void send_header(sapi_header_struct *sapi_header, void *server_context)
+{
+}
+
+static char* read_cookies()
+{
+ /* TODO: fuzz these! */
+ return NULL;
+}
+
+static void register_variables(zval *track_vars_array)
+{
+ php_import_environment_variables(track_vars_array);
+}
+
+static void log_message(const char *message, int level)
+{
+}
+
+
+static sapi_module_struct fuzzer_module = {
+ "fuzzer", /* name */
+ "clang fuzzer", /* pretty name */
+
+ startup, /* startup */
+ php_module_shutdown_wrapper, /* shutdown */
+
+ NULL, /* activate */
+ NULL, /* deactivate */
+
+ ub_write, /* unbuffered write */
+ fuzzer_flush, /* flush */
+ NULL, /* get uid */
+ NULL, /* getenv */
+
+ php_error, /* error handler */
+
+ NULL, /* header handler */
+ NULL, /* send headers handler */
+ send_header, /* send header handler */
+
+ NULL, /* read POST data */
+ read_cookies, /* read Cookies */
+
+ register_variables, /* register server variables */
+ log_message, /* Log message */
+ NULL, /* Get request time */
+ NULL, /* Child terminate */
+
+ STANDARD_SAPI_MODULE_PROPERTIES
+};
+
+int fuzzer_init_php()
+{
+#ifdef __SANITIZE_ADDRESS__
+ /* We're going to leak all the memory allocated during startup,
+ * so disable lsan temporarily. */
+ __lsan_disable();
+#endif
+
+ sapi_startup(&fuzzer_module);
+ fuzzer_module.phpinfo_as_text = 1;
+
+ fuzzer_module.ini_entries = malloc(sizeof(HARDCODED_INI));
+ memcpy(fuzzer_module.ini_entries, HARDCODED_INI, sizeof(HARDCODED_INI));
+
+ /*
+ * TODO: we might want to test both Zend and malloc MM, but testing with malloc
+ * is more likely to find bugs, so use that for now.
+ */
+ putenv("USE_ZEND_ALLOC=0");
+
+ if (fuzzer_module.startup(&fuzzer_module)==FAILURE) {
+ return FAILURE;
+ }
+
+#ifdef __SANITIZE_ADDRESS__
+ __lsan_enable();
+#endif
+
+ return SUCCESS;
+}
+
+int fuzzer_request_startup()
+{
+ if (php_request_startup() == FAILURE) {
+ php_module_shutdown();
+ return FAILURE;
+ }
+
+#ifdef ZEND_SIGNALS
+ /* Some signal handlers will be overridden,
+ * don't complain about them during shutdown. */
+ SIGG(check) = 0;
+#endif
+
+ return SUCCESS;
+}
+
+void fuzzer_request_shutdown()
+{
+ zend_try {
+ /* Destroy thrown exceptions. This does not happen as part of request shutdown. */
+ if (EG(exception)) {
+ zend_object_release(EG(exception));
+ EG(exception) = NULL;
+ }
+
+ /* Some fuzzers (like unserialize) may create circular structures. Make sure we free them.
+ * Two calls are performed to handle objects with destructors. */
+ zend_gc_collect_cycles();
+ zend_gc_collect_cycles();
+ } zend_end_try();
+
+ php_request_shutdown(NULL);
+}
+
+/* Set up a dummy stack frame so that exceptions may be thrown. */
+void fuzzer_setup_dummy_frame()
+{
+ static zend_execute_data execute_data;
+ static zend_function func;
+
+ memset(&execute_data, 0, sizeof(zend_execute_data));
+ memset(&func, 0, sizeof(zend_function));
+
+ func.type = ZEND_INTERNAL_FUNCTION;
+ func.common.function_name = ZSTR_EMPTY_ALLOC();
+ execute_data.func = &func;
+ EG(current_execute_data) = &execute_data;
+}
+
+void fuzzer_set_ini_file(const char *file)
+{
+ if (fuzzer_module.php_ini_path_override) {
+ free(fuzzer_module.php_ini_path_override);
+ }
+ fuzzer_module.php_ini_path_override = strdup(file);
+}
+
+
+int fuzzer_shutdown_php()
+{
+ php_module_shutdown();
+ sapi_shutdown();
+
+ free(fuzzer_module.ini_entries);
+ return SUCCESS;
+}
+
+int fuzzer_do_request_from_buffer(
+ char *filename, const char *data, size_t data_len, zend_bool execute)
+{
+ int retval = FAILURE; /* failure by default */
+
+ SG(options) |= SAPI_OPTION_NO_CHDIR;
+ SG(request_info).argc=0;
+ SG(request_info).argv=NULL;
+
+ if (fuzzer_request_startup() == FAILURE) {
+ return FAILURE;
+ }
+
+ // Commented out to avoid leaking the header callback.
+ //SG(headers_sent) = 1;
+ //SG(request_info).no_headers = 1;
+ php_register_variable("PHP_SELF", filename, NULL);
+
+ zend_first_try {
+ zend_file_handle file_handle;
+ zend_stream_init_filename(&file_handle, filename);
+ file_handle.buf = estrndup(data, data_len);
+ file_handle.len = data_len;
+
+ zend_op_array *op_array = zend_compile_file(&file_handle, ZEND_REQUIRE);
+ if (op_array) {
+ if (execute) {
+ zend_execute(op_array, NULL);
+ }
+ destroy_op_array(op_array);
+ efree(op_array);
+ }
+ } zend_end_try();
+
+ CG(compiled_filename) = NULL; /* ??? */
+ fuzzer_request_shutdown();
+
+ return (retval == SUCCESS) ? SUCCESS : FAILURE;
+}
+
+// Call named PHP function with N zval arguments
+void fuzzer_call_php_func_zval(const char *func_name, int nargs, zval *args) {
+ zval retval, func;
+
+ ZVAL_STRING(&func, func_name);
+ ZVAL_UNDEF(&retval);
+ call_user_function(CG(function_table), NULL, &func, &retval, nargs, args);
+
+ // TODO: check result?
+ /* to ensure retval is not broken */
+ php_var_dump(&retval, 0);
+
+ /* cleanup */
+ zval_ptr_dtor(&retval);
+ zval_ptr_dtor(&func);
+}
+
+// Call named PHP function with N string arguments
+void fuzzer_call_php_func(const char *func_name, int nargs, char **params) {
+ zval args[nargs];
+ int i;
+
+ for(i=0;i<nargs;i++) {
+ ZVAL_STRING(&args[i], params[i]);
+ }
+
+ fuzzer_call_php_func_zval(func_name, nargs, args);
+
+ for(i=0;i<nargs;i++) {
+ zval_ptr_dtor(&args[i]);
+ ZVAL_UNDEF(&args[i]);
+ }
+}
diff --git a/sapi/fuzzer/fuzzer-sapi.h b/sapi/fuzzer/fuzzer-sapi.h
new file mode 100644
index 0000000000..4eb050e357
--- /dev/null
+++ b/sapi/fuzzer/fuzzer-sapi.h
@@ -0,0 +1,25 @@
+/*
+ +----------------------------------------------------------------------+
+ | Copyright (c) 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: Johannes Schlüter <johanes@php.net> |
+ | Stanislav Malyshev <stas@php.net> |
+ +----------------------------------------------------------------------+
+ */
+
+int fuzzer_init_php(void);
+int fuzzer_request_startup(void);
+void fuzzer_request_shutdown(void);
+void fuzzer_setup_dummy_frame(void);
+void fuzzer_call_php_func(const char *func_name, int nargs, char **params);
+void fuzzer_call_php_func_zval(const char *func_name, int nargs, zval *args);
+int fuzzer_do_request_from_buffer(
+ char *filename, const char *data, size_t data_len, zend_bool execute);
diff --git a/sapi/fuzzer/fuzzer-unserialize.c b/sapi/fuzzer/fuzzer-unserialize.c
new file mode 100644
index 0000000000..ff68ee6e3e
--- /dev/null
+++ b/sapi/fuzzer/fuzzer-unserialize.c
@@ -0,0 +1,67 @@
+/*
+ +----------------------------------------------------------------------+
+ | Copyright (c) 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: Johannes Schlüter <johanes@php.net> |
+ +----------------------------------------------------------------------+
+ */
+
+
+#include "fuzzer.h"
+
+#include "Zend/zend.h"
+#include "main/php_config.h"
+#include "main/php_main.h"
+
+#include <stdio.h>
+#include <stdint.h>
+#include <stdlib.h>
+
+#include "fuzzer-sapi.h"
+
+#include "ext/standard/php_var.h"
+
+int LLVMFuzzerTestOneInput(const uint8_t *Data, size_t Size) {
+ unsigned char *orig_data = malloc(Size+1);
+ memcpy(orig_data, Data, Size);
+ orig_data[Size] = '\0';
+
+ if (fuzzer_request_startup() == FAILURE) {
+ return 0;
+ }
+
+ fuzzer_setup_dummy_frame();
+
+ {
+ const unsigned char *data = orig_data;
+ zval result;
+ ZVAL_UNDEF(&result);
+
+ php_unserialize_data_t var_hash;
+ PHP_VAR_UNSERIALIZE_INIT(var_hash);
+ php_var_unserialize(&result, (const unsigned char **) &data, data + Size, &var_hash);
+ PHP_VAR_UNSERIALIZE_DESTROY(var_hash);
+
+ zval_ptr_dtor(&result);
+ }
+
+ free(orig_data);
+
+ fuzzer_request_shutdown();
+ return 0;
+}
+
+int LLVMFuzzerInitialize(int *argc, char ***argv) {
+ fuzzer_init_php();
+
+ /* fuzzer_shutdown_php(); */
+ return 0;
+}
diff --git a/sapi/fuzzer/fuzzer-unserializehash.c b/sapi/fuzzer/fuzzer-unserializehash.c
new file mode 100644
index 0000000000..c1231c4992
--- /dev/null
+++ b/sapi/fuzzer/fuzzer-unserializehash.c
@@ -0,0 +1,82 @@
+/*
+ +----------------------------------------------------------------------+
+ | Copyright (c) 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. |
+ +----------------------------------------------------------------------+
+ */
+
+
+#include "fuzzer.h"
+
+#include "Zend/zend.h"
+#include "main/php_config.h"
+#include "main/php_main.h"
+
+#include <stdio.h>
+#include <stdint.h>
+#include <stdlib.h>
+
+#include "fuzzer-sapi.h"
+
+#include "ext/standard/php_var.h"
+
+int LLVMFuzzerTestOneInput(const uint8_t *Data, size_t FullSize) {
+ const uint8_t *Start = memchr(Data, '|', FullSize);
+ if (!Start) {
+ return 0;
+ }
+ ++Start;
+
+ size_t Size = (Data + FullSize) - Start;
+ unsigned char *orig_data = malloc(Size+1);
+ memcpy(orig_data, Start, Size);
+ orig_data[Size] = '\0';
+
+ if (fuzzer_request_startup() == FAILURE) {
+ return 0;
+ }
+
+ fuzzer_setup_dummy_frame();
+
+ {
+ const unsigned char *data = orig_data;
+ zval result;
+ ZVAL_UNDEF(&result);
+
+ php_unserialize_data_t var_hash;
+ PHP_VAR_UNSERIALIZE_INIT(var_hash);
+ php_var_unserialize(&result, (const unsigned char **) &data, data + Size, &var_hash);
+ PHP_VAR_UNSERIALIZE_DESTROY(var_hash);
+
+ if (Z_TYPE(result) == IS_OBJECT
+ && zend_string_equals_literal(Z_OBJCE(result)->name, "HashContext")) {
+ zval args[2];
+ ZVAL_COPY_VALUE(&args[0], &result);
+ ZVAL_STRINGL(&args[1], (char *) Data, (Start - Data) - 1);
+ fuzzer_call_php_func_zval("hash_update", 2, args);
+ zval_ptr_dtor(&args[1]);
+ fuzzer_call_php_func_zval("hash_final", 1, args);
+ }
+
+ zval_ptr_dtor(&result);
+ }
+
+ free(orig_data);
+
+ fuzzer_request_shutdown();
+ return 0;
+}
+
+int LLVMFuzzerInitialize(int *argc, char ***argv) {
+ fuzzer_init_php();
+
+ /* fuzzer_shutdown_php(); */
+ return 0;
+}
diff --git a/sapi/fuzzer/fuzzer.h b/sapi/fuzzer/fuzzer.h
new file mode 100644
index 0000000000..644179f309
--- /dev/null
+++ b/sapi/fuzzer/fuzzer.h
@@ -0,0 +1,18 @@
+/*
+ +----------------------------------------------------------------------+
+ | Copyright (c) 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: Johannes Schlüter <johanes@php.net> |
+ +----------------------------------------------------------------------+
+ */
+
+#include "php_version.h"
+#define FUZZER_VERSION PHP_VERSION
diff --git a/sapi/fuzzer/generate_all.php b/sapi/fuzzer/generate_all.php
new file mode 100644
index 0000000000..589781b004
--- /dev/null
+++ b/sapi/fuzzer/generate_all.php
@@ -0,0 +1,5 @@
+<?php
+require __DIR__ . '/generate_unserialize_dict.php';
+require __DIR__ . '/generate_unserializehash_corpus.php';
+require __DIR__ . '/generate_parser_corpus.php';
+require __DIR__ . '/generate_execute_corpus.php';
diff --git a/sapi/fuzzer/generate_execute_corpus.php b/sapi/fuzzer/generate_execute_corpus.php
new file mode 100644
index 0000000000..dd6424127a
--- /dev/null
+++ b/sapi/fuzzer/generate_execute_corpus.php
@@ -0,0 +1,38 @@
+<?php
+
+if ($argc >= 2) {
+ $testsDir = $argv[1];
+} else {
+ $testsDir = __DIR__ . '/../../Zend/tests';
+}
+if ($argc >= 3) {
+ $corpusDir = $argv[2];
+} else {
+ $corpusDir = __DIR__ . '/corpus/execute';
+}
+if ($argc >= 4) {
+ $maxLen = (int) $argv[3];
+} else {
+ $maxLen = 8 * 1024;
+}
+
+$it = new RecursiveIteratorIterator(
+ new RecursiveDirectoryIterator($testsDir),
+ RecursiveIteratorIterator::LEAVES_ONLY
+);
+
+@mkdir($corpusDir);
+
+foreach ($it as $file) {
+ if (!preg_match('/\.phpt$/', $file)) continue;
+ $fullCode = file_get_contents($file);
+ if (!preg_match('/--FILE--\R(.*?)\R--([_A-Z]+)--/s', $fullCode, $matches)) continue;
+ $code = $matches[1];
+ if (strlen($code) > $maxLen) continue;
+
+ $outFile = str_replace($testsDir, '', $file);
+ $outFile = str_replace('/', '_', $outFile);
+ if (!preg_match('/SKIP_SLOW_TESTS|SKIP_PERF_SENSITIVE|USE_ZEND_ALLOC/', $fullCode)) {
+ file_put_contents($corpusDir . '/' . $outFile, $code);
+ }
+}
diff --git a/sapi/fuzzer/generate_parser_corpus.php b/sapi/fuzzer/generate_parser_corpus.php
new file mode 100644
index 0000000000..699c121901
--- /dev/null
+++ b/sapi/fuzzer/generate_parser_corpus.php
@@ -0,0 +1,24 @@
+<?php
+
+$testsDir = __DIR__ . '/../../Zend/tests/';
+$it = new RecursiveIteratorIterator(
+ new RecursiveDirectoryIterator($testsDir),
+ RecursiveIteratorIterator::LEAVES_ONLY
+);
+
+$corpusDir = __DIR__ . '/corpus/parser';
+@mkdir($corpusDir);
+
+$maxLen = 32 * 1024;
+foreach ($it as $file) {
+ if (!preg_match('/\.phpt$/', $file)) continue;
+ $code = file_get_contents($file);
+ if (!preg_match('/--FILE--\R(.*?)\R--([_A-Z]+)--/s', $code, $matches)) continue;
+ $code = $matches[1];
+ if (strlen($code) > $maxLen) continue;
+
+ $outFile = str_replace($testsDir, '', $file);
+ $outFile = str_replace('/', '_', $outFile);
+ $outFile = $corpusDir . '/' . $outFile;
+ file_put_contents($outFile, $code);
+}
diff --git a/sapi/fuzzer/generate_unserialize_dict.php b/sapi/fuzzer/generate_unserialize_dict.php
new file mode 100644
index 0000000000..cf270788d3
--- /dev/null
+++ b/sapi/fuzzer/generate_unserialize_dict.php
@@ -0,0 +1,9 @@
+<?php
+
+$dict = "";
+foreach (get_declared_classes() as $class) {
+ $len = strlen($class);
+ $dict .= "\"$len:\\\"$class\\\"\"\n";
+}
+
+file_put_contents(__DIR__ . "/dict/unserialize", $dict);
diff --git a/sapi/fuzzer/generate_unserializehash_corpus.php b/sapi/fuzzer/generate_unserializehash_corpus.php
new file mode 100644
index 0000000000..04c6ea1428
--- /dev/null
+++ b/sapi/fuzzer/generate_unserializehash_corpus.php
@@ -0,0 +1,10 @@
+<?php
+
+$corpusDir = __DIR__ . '/corpus/unserializehash';
+@mkdir($corpusDir);
+
+foreach (hash_algos() as $algo) {
+ $ctx = hash_init($algo);
+ $algx = preg_replace('/[^-_a-zA-Z0-9]/', '_', $algo);
+ file_put_contents($corpusDir . '/' . $algx, "x|" . serialize($ctx));
+}
diff --git a/sapi/fuzzer/json.dict b/sapi/fuzzer/json.dict
new file mode 100644
index 0000000000..e08245a219
--- /dev/null
+++ b/sapi/fuzzer/json.dict
@@ -0,0 +1,52 @@
+#
+# AFL dictionary for JSON
+# -----------------------
+#
+# Just the very basics.
+#
+# Inspired by a dictionary by Jakub Wilk <jwilk@jwilk.net>
+#
+
+"0"
+",0"
+":0"
+"0:"
+"-1.2e+3"
+
+"true"
+"false"
+"null"
+
+"\"\""
+",\"\""
+":\"\""
+"\"\":"
+
+"{}"
+",{}"
+":{}"
+"{\"\":0}"
+"{{}}"
+
+"[]"
+",[]"
+":[]"
+"[0]"
+"[[]]"
+
+"''"
+"\\"
+"\\b"
+"\\f"
+"\\n"
+"\\r"
+"\\t"
+"\\u0000"
+"\\x00"
+"\\0"
+"\\uD800\\uDC00"
+"\\uDBFF\\uDFFF"
+
+"\"\":0"
+"//"
+"/**/"
diff --git a/sapi/litespeed/config.m4 b/sapi/litespeed/config.m4
index 3a816a19bf..8907405385 100644
--- a/sapi/litespeed/config.m4
+++ b/sapi/litespeed/config.m4
@@ -18,7 +18,7 @@ if test "$PHP_LITESPEED" != "no"; then
BUILD_LITESPEED="\$(LIBTOOL) --mode=link \$(CC) -export-dynamic \$(CFLAGS_CLEAN) \$(EXTRA_CFLAGS) \$(EXTRA_LDFLAGS_PROGRAM) \$(LDFLAGS) \$(PHP_RPATHS) \$(PHP_GLOBAL_OBJS) \$(PHP_BINARY_OBJS) \$(PHP_LITESPEED_OBJS) \$(EXTRA_LIBS) \$(ZEND_EXTRA_LIBS) -o \$(SAPI_LITESPEED_PATH)"
;;
*)
- BUILD_LITESPEED="\$(LIBTOOL) --mode=link \$(CC) -export-dynamic \$(CFLAGS_CLEAN) \$(EXTRA_CFLAGS) \$(EXTRA_LDFLAGS_PROGRAM) \$(LDFLAGS) \$(PHP_RPATHS) \$(PHP_GLOBAL_OBJS) \$(PHP_BINARY_OBJS) \$(PHP_LITESPEED_OBJS) \$(EXTRA_LIBS) \$(ZEND_EXTRA_LIBS) -o \$(SAPI_LITESPEED_PATH)"
+ BUILD_LITESPEED="\$(LIBTOOL) --mode=link \$(CC) -export-dynamic \$(CFLAGS_CLEAN) \$(EXTRA_CFLAGS) \$(EXTRA_LDFLAGS_PROGRAM) \$(LDFLAGS) \$(PHP_RPATHS) \$(PHP_GLOBAL_OBJS:.lo=.o) \$(PHP_BINARY_OBJS:.lo=.o) \$(PHP_LITESPEED_OBJS:.lo=.o) \$(EXTRA_LIBS) \$(ZEND_EXTRA_LIBS) -o \$(SAPI_LITESPEED_PATH)"
;;
esac
diff --git a/sapi/litespeed/lsapi_main.c b/sapi/litespeed/lsapi_main.c
index a84c9b2677..24703ef75c 100644
--- a/sapi/litespeed/lsapi_main.c
+++ b/sapi/litespeed/lsapi_main.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
@@ -25,7 +23,9 @@
#include "zend.h"
#include "ext/standard/basic_functions.h"
#include "ext/standard/info.h"
+#include "ext/standard/head.h"
#include "lsapilib.h"
+#include "lsapi_main_arginfo.h"
#include <stdio.h>
#include <stdlib.h>
@@ -94,8 +94,7 @@ static void init_sapi_from_env(sapi_module_struct *sapi_module)
sapi_module->php_ini_path_override = p;
}
-/* {{{ php_lsapi_startup
- */
+/* {{{ php_lsapi_startup */
static int php_lsapi_startup(sapi_module_struct *sapi_module)
{
if (php_module_startup(sapi_module, NULL, 0)==FAILURE) {
@@ -108,7 +107,7 @@ static int php_lsapi_startup(sapi_module_struct *sapi_module)
/* {{{ sapi_lsapi_ini_defaults */
-/* overwriteable ini defaults must be set in sapi_cli_ini_defaults() */
+/* overwritable ini defaults must be set in sapi_cli_ini_defaults() */
#define INI_DEFAULT(name,value)\
ZVAL_STRING(tmp, value, 0);\
zend_hash_update(configuration_hash, name, sizeof(name), tmp, sizeof(zval), (void**)&entry);\
@@ -132,8 +131,7 @@ static void sapi_lsapi_ini_defaults(HashTable *configuration_hash)
/* }}} */
-/* {{{ sapi_lsapi_ub_write
- */
+/* {{{ sapi_lsapi_ub_write */
static size_t sapi_lsapi_ub_write(const char *str, size_t str_length)
{
int ret;
@@ -161,8 +159,7 @@ static size_t sapi_lsapi_ub_write(const char *str, size_t str_length)
/* }}} */
-/* {{{ sapi_lsapi_flush
- */
+/* {{{ sapi_lsapi_flush */
static void sapi_lsapi_flush(void * server_context)
{
if ( lsapi_mode ) {
@@ -174,8 +171,7 @@ static void sapi_lsapi_flush(void * server_context)
/* }}} */
-/* {{{ sapi_lsapi_deactivate
- */
+/* {{{ sapi_lsapi_deactivate */
static int sapi_lsapi_deactivate(void)
{
if ( SG(request_info).path_translated ) {
@@ -190,9 +186,8 @@ static int sapi_lsapi_deactivate(void)
-/* {{{ sapi_lsapi_getenv
- */
-static char *sapi_lsapi_getenv( char * name, size_t name_len )
+/* {{{ sapi_lsapi_getenv */
+static char *sapi_lsapi_getenv(const char * name, size_t name_len )
{
if ( lsapi_mode ) {
return LSAPI_GetEnv( name );
@@ -261,8 +256,7 @@ static void litespeed_php_import_environment_variables(zval *array_ptr)
}
}
-/* {{{ sapi_lsapi_register_variables
- */
+/* {{{ sapi_lsapi_register_variables */
static void sapi_lsapi_register_variables(zval *track_vars_array)
{
char * php_self = "";
@@ -289,8 +283,7 @@ static void sapi_lsapi_register_variables(zval *track_vars_array)
/* }}} */
-/* {{{ sapi_lsapi_read_post
- */
+/* {{{ sapi_lsapi_read_post */
static size_t sapi_lsapi_read_post(char *buffer, size_t count_bytes)
{
if ( lsapi_mode ) {
@@ -305,8 +298,7 @@ static size_t sapi_lsapi_read_post(char *buffer, size_t count_bytes)
-/* {{{ sapi_lsapi_read_cookies
- */
+/* {{{ sapi_lsapi_read_cookies */
static char *sapi_lsapi_read_cookies(void)
{
if ( lsapi_mode ) {
@@ -464,8 +456,7 @@ static int sapi_lsapi_send_headers_like_cgi(sapi_headers_struct *sapi_headers)
static int mod_lsapi_mode = 0;
-/* {{{ sapi_lsapi_send_headers
- */
+/* {{{ sapi_lsapi_send_headers */
static int sapi_lsapi_send_headers(sapi_headers_struct *sapi_headers)
{
sapi_header_struct *h;
@@ -508,9 +499,8 @@ static int sapi_lsapi_send_headers(sapi_headers_struct *sapi_headers)
/* }}} */
-/* {{{ sapi_lsapi_send_headers
- */
-static void sapi_lsapi_log_message(char *message, int syslog_type_int)
+/* {{{ sapi_lsapi_send_headers */
+static void sapi_lsapi_log_message(const char *message, int syslog_type_int)
{
char buf[8192];
int len = strlen( message );
@@ -522,7 +512,7 @@ static void sapi_lsapi_log_message(char *message, int syslog_type_int)
len = 8191;
++len;
}
- LSAPI_Write_Stderr( message, len);
+ LSAPI_Write_Stderr( message, len );
}
/* }}} */
@@ -598,8 +588,7 @@ static int sapi_lsapi_activate()
}
return SUCCESS;
}
-/* {{{ sapi_module_struct cgi_sapi_module
- */
+/* {{{ sapi_module_struct cgi_sapi_module */
static sapi_module_struct lsapi_sapi_module =
{
"litespeed",
@@ -806,7 +795,7 @@ static int alter_ini( const char * pKey, int keyLen, const char * pValue, int va
Use ACTIVATE stage in legacy mode only.
RUNTIME stage should be used here,
- as with ACTIVATE it's impossible to change the option from script with ini_set
+ as with ACTIVATE it's impossible to change the option from script with ini_set
*/
if(!mod_lsapi_mode)
{
@@ -1230,7 +1219,6 @@ static int cli_main( int argc, char * argv[] )
{
static const char * ini_defaults[] = {
- "report_zend_debug", "0",
"display_errors", "1",
"register_argc_argv", "1",
"html_errors", "0",
@@ -1617,11 +1605,6 @@ int main( int argc, char * argv[] )
/* LiteSpeed PHP module starts here */
-/* {{{ arginfo */
-ZEND_BEGIN_ARG_INFO(arginfo_litespeed__void, 0)
-ZEND_END_ARG_INFO()
-/* }}} */
-
PHP_FUNCTION(litespeed_request_headers);
PHP_FUNCTION(litespeed_response_headers);
PHP_FUNCTION(apache_get_modules);
@@ -1629,17 +1612,6 @@ PHP_FUNCTION(litespeed_finish_request);
PHP_MINFO_FUNCTION(litespeed);
-static const zend_function_entry litespeed_functions[] = {
- PHP_FE(litespeed_request_headers, arginfo_litespeed__void)
- PHP_FE(litespeed_response_headers, arginfo_litespeed__void)
- PHP_FE(apache_get_modules, arginfo_litespeed__void)
- PHP_FE(litespeed_finish_request, arginfo_litespeed__void)
- PHP_FALIAS(getallheaders, litespeed_request_headers, arginfo_litespeed__void)
- PHP_FALIAS(apache_request_headers, litespeed_request_headers, arginfo_litespeed__void)
- PHP_FALIAS(apache_response_headers, litespeed_response_headers, arginfo_litespeed__void)
- {NULL, NULL, NULL}
-};
-
static PHP_MINIT_FUNCTION(litespeed)
{
user_config_cache_init();
@@ -1657,7 +1629,7 @@ static PHP_MINIT_FUNCTION(litespeed)
}
/*
* mod_lsapi always sets this env var,
- * so we can detect mod_lsapi mode with its presense.
+ * so we can detect mod_lsapi mode with its presence.
*/
mod_lsapi_mode = ( getenv("LSAPI_DISABLE_CPAN_BEHAV") != NULL );
@@ -1677,7 +1649,7 @@ static PHP_MSHUTDOWN_FUNCTION(litespeed)
zend_module_entry litespeed_module_entry = {
STANDARD_MODULE_HEADER,
"litespeed",
- litespeed_functions,
+ ext_functions,
PHP_MINIT(litespeed),
PHP_MSHUTDOWN(litespeed),
NULL,
@@ -1695,25 +1667,22 @@ static int add_associate_array( const char * pKey, int keyLen, const char * pVal
}
-/* {{{ proto array litespeed_request_headers(void)
- Fetch all HTTP request headers */
+/* {{{ Fetch all HTTP request headers */
PHP_FUNCTION(litespeed_request_headers)
{
- /* TODO: */
- if (ZEND_NUM_ARGS() > 0) {
- WRONG_PARAM_COUNT;
+ if (zend_parse_parameters_none() == FAILURE) {
+ RETURN_THROWS();
}
+
array_init(return_value);
LSAPI_ForeachOrgHeader( add_associate_array, return_value );
-
}
/* }}} */
-/* {{{ proto array litespeed_response_headers(void)
- Fetch all HTTP response headers */
+/* {{{ Fetch all HTTP response headers */
PHP_FUNCTION(litespeed_response_headers)
{
sapi_header_struct *h;
@@ -1722,9 +1691,9 @@ PHP_FUNCTION(litespeed_response_headers)
int len;
char headerBuf[SAPI_LSAPI_MAX_HEADER_LENGTH];
- if (ZEND_NUM_ARGS() > 0) {
- WRONG_PARAM_COUNT;
- }
+ if (zend_parse_parameters_none() == FAILURE) {
+ RETURN_THROWS();
+ }
if (!&SG(sapi_headers).headers) {
RETURN_FALSE;
@@ -1755,8 +1724,7 @@ PHP_FUNCTION(litespeed_response_headers)
/* }}} */
-/* {{{ proto array apache_get_modules(void)
- Fetch all loaded module names */
+/* {{{ Fetch all loaded module names */
PHP_FUNCTION(apache_get_modules)
{
static const char * mod_names[] =
@@ -1764,10 +1732,11 @@ PHP_FUNCTION(apache_get_modules)
"mod_rewrite", "mod_mime", "mod_headers", "mod_expires", "mod_auth_basic", NULL
};
const char **name = mod_names;
- /* TODO: */
- if (ZEND_NUM_ARGS() > 0) {
- WRONG_PARAM_COUNT;
- }
+
+ if (zend_parse_parameters_none() == FAILURE) {
+ RETURN_THROWS();
+ }
+
array_init(return_value);
while( *name )
{
@@ -1778,13 +1747,12 @@ PHP_FUNCTION(apache_get_modules)
/* }}} */
-/* {{{ proto array litespeed_finish_request(void)
- Flushes all response data to the client */
+/* {{{ Flushes all response data to the client */
PHP_FUNCTION(litespeed_finish_request)
{
- if (ZEND_NUM_ARGS() > 0) {
- WRONG_PARAM_COUNT;
- }
+ if (zend_parse_parameters_none() == FAILURE) {
+ RETURN_THROWS();
+ }
php_output_end_all();
php_header();
diff --git a/sapi/litespeed/lsapi_main.stub.php b/sapi/litespeed/lsapi_main.stub.php
new file mode 100644
index 0000000000..396cb86385
--- /dev/null
+++ b/sapi/litespeed/lsapi_main.stub.php
@@ -0,0 +1,20 @@
+<?php
+
+/** @generate-function-entries */
+
+function litespeed_request_headers(): array {}
+
+/** @alias litespeed_request_headers */
+function getallheaders(): array {}
+
+/** @alias litespeed_request_headers */
+function apache_request_headers(): array {}
+
+function litespeed_response_headers(): array|false {}
+
+/** @alias litespeed_response_headers */
+function apache_response_headers(): array|false {}
+
+function apache_get_modules(): array {}
+
+function litespeed_finish_request(): bool {}
diff --git a/sapi/litespeed/lsapi_main_arginfo.h b/sapi/litespeed/lsapi_main_arginfo.h
new file mode 100644
index 0000000000..2b7e862435
--- /dev/null
+++ b/sapi/litespeed/lsapi_main_arginfo.h
@@ -0,0 +1,37 @@
+/* This is a generated file, edit the .stub.php file instead.
+ * Stub hash: 6b6b8e58c728236218c31addc4d855e87d645178 */
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_litespeed_request_headers, 0, 0, IS_ARRAY, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_getallheaders arginfo_litespeed_request_headers
+
+#define arginfo_apache_request_headers arginfo_litespeed_request_headers
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_litespeed_response_headers, 0, 0, MAY_BE_ARRAY|MAY_BE_FALSE)
+ZEND_END_ARG_INFO()
+
+#define arginfo_apache_response_headers arginfo_litespeed_response_headers
+
+#define arginfo_apache_get_modules arginfo_litespeed_request_headers
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_litespeed_finish_request, 0, 0, _IS_BOOL, 0)
+ZEND_END_ARG_INFO()
+
+
+ZEND_FUNCTION(litespeed_request_headers);
+ZEND_FUNCTION(litespeed_response_headers);
+ZEND_FUNCTION(apache_get_modules);
+ZEND_FUNCTION(litespeed_finish_request);
+
+
+static const zend_function_entry ext_functions[] = {
+ ZEND_FE(litespeed_request_headers, arginfo_litespeed_request_headers)
+ ZEND_FALIAS(getallheaders, litespeed_request_headers, arginfo_getallheaders)
+ ZEND_FALIAS(apache_request_headers, litespeed_request_headers, arginfo_apache_request_headers)
+ ZEND_FE(litespeed_response_headers, arginfo_litespeed_response_headers)
+ ZEND_FALIAS(apache_response_headers, litespeed_response_headers, arginfo_apache_response_headers)
+ ZEND_FE(apache_get_modules, arginfo_apache_get_modules)
+ ZEND_FE(litespeed_finish_request, arginfo_litespeed_finish_request)
+ ZEND_FE_END
+};
diff --git a/sapi/litespeed/lsapidef.h b/sapi/litespeed/lsapidef.h
index c909b5f986..1374db0ab1 100644
--- a/sapi/litespeed/lsapidef.h
+++ b/sapi/litespeed/lsapidef.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/sapi/litespeed/lsapilib.c b/sapi/litespeed/lsapilib.c
index 566b855ce9..46905f917a 100644
--- a/sapi/litespeed/lsapilib.c
+++ b/sapi/litespeed/lsapilib.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
@@ -939,7 +937,7 @@ static int lsapi_enterLVE( LSAPI_Request * pReq, uid_t uid )
ret = (*fp_lve_enter)(s_lve, uid, -1, -1, &cookie);
if ( ret < 0 )
{
- lsapi_log("enter LVE (%d) : ressult: %d !\n", uid, ret );
+ lsapi_log("enter LVE (%d) : result: %d !\n", uid, ret );
LSAPI_perror_r(pReq, "LSAPI: lve_enter() failure, reached resource limit.", NULL );
lsapi_lve_error( pReq );
return -1;
@@ -959,7 +957,7 @@ static int lsapi_jailLVE( LSAPI_Request * pReq, uid_t uid, struct passwd * pw )
ret = (*fp_lve_jail)( pw, error_msg );
if ( ret < 0 )
{
- lsapi_log("LSAPI: LVE jail(%d) ressult: %d, error: %s !\n",
+ lsapi_log("LSAPI: LVE jail(%d) result: %d, error: %s !\n",
uid, ret, error_msg );
LSAPI_perror_r( pReq, "LSAPI: jail() failure.", NULL );
return -1;
diff --git a/sapi/litespeed/lsapilib.h b/sapi/litespeed/lsapilib.h
index 3e32c4a4e8..c2562484ee 100644
--- a/sapi/litespeed/lsapilib.h
+++ b/sapi/litespeed/lsapilib.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/sapi/litespeed/lscriu.c b/sapi/litespeed/lscriu.c
index 7c5bda7e88..ba6e5b44cd 100644
--- a/sapi/litespeed/lscriu.c
+++ b/sapi/litespeed/lscriu.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
@@ -405,8 +403,8 @@ static void LSCRIU_Restored_Error(int iFatal, char *format, ...) {
}
}
#else // no debugging
-static void inline LSCRIU_Debugging(void) {}
-static void inline LSCRIU_Restored_Error(int iFatal, char *format, ...) {}
+static inline void LSCRIU_Debugging(void) {}
+static inline void LSCRIU_Restored_Error(int iFatal, char *format, ...) {}
#endif
@@ -628,12 +626,14 @@ static int LSCRIU_Init_Env_Parameters(void)
gc_type == CRIU_GCOUNTER_SIG ? "signals" : "pipe");
lsapi_criu_signal(SIGUSR2, lsapi_siguser2);
}
- else
+ else {
lscriu_dbg("LSCRIU (%d): Use shared memory\n", getpid());
- LSCRIU_Set_Global_Counter_Type(gc_type);
+ }
+ LSCRIU_Set_Global_Counter_Type(gc_type);
}
- else
+ else {
lscriu_dbg("LSCRIU (%d): NOT Listening\n", getpid());
+ }
char *criu_mode = NULL;
criu_mode = getenv("LSAPI_CRIU");
diff --git a/sapi/litespeed/lscriu.h b/sapi/litespeed/lscriu.h
index e7618114cc..0b631aeaa7 100644
--- a/sapi/litespeed/lscriu.h
+++ b/sapi/litespeed/lscriu.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/sapi/phpdbg/Makefile.frag b/sapi/phpdbg/Makefile.frag
index 65377e608a..1572bfd9f0 100644
--- a/sapi/phpdbg/Makefile.frag
+++ b/sapi/phpdbg/Makefile.frag
@@ -18,7 +18,7 @@ $(srcdir)/phpdbg_lexer.c: $(srcdir)/phpdbg_lexer.l
$(srcdir)/phpdbg_parser.h: $(srcdir)/phpdbg_parser.c
$(srcdir)/phpdbg_parser.c: $(srcdir)/phpdbg_parser.y
- @$(YACC) -p phpdbg_ -v -d $(srcdir)/phpdbg_parser.y -o $@
+ @$(YACC) $(YFLAGS) -v -d $(srcdir)/phpdbg_parser.y -o $@
install-phpdbg: $(BUILD_BINARY)
@echo "Installing phpdbg binary: $(INSTALL_ROOT)$(bindir)/"
diff --git a/sapi/phpdbg/README.md b/sapi/phpdbg/README.md
deleted file mode 100644
index 68d9766f0a..0000000000
--- a/sapi/phpdbg/README.md
+++ /dev/null
@@ -1,78 +0,0 @@
-# The interactive PHP debugger
-
-Implemented as a SAPI module, phpdbg can exert complete control over the
-environment without impacting the functionality or performance of your code.
-
-phpdbg aims to be a lightweight, powerful, easy to use debugging platform for
-PHP 5.4+.
-
-## Features
-
-* Stepthrough Debugging
-* Flexible Breakpoints (Class Method, Function, File:Line, Address, Opcode)
-* Easy Access to PHP with built-in eval()
-* Easy Access to Currently Executing Code
-* Userland API
-* SAPI Agnostic - Easily Integrated
-* PHP Configuration File Support
-* JIT Super Globals - Set Your Own!!
-* Optional readline Support - Comfortable Terminal Operation
-* Remote Debugging Support - Bundled Java GUI
-* Easy Operation - See Help
-
-## Planned
-
-* Improve Everything :)
-
-## Installation
-
-To install **phpdbg**, you must compile the source against your PHP installation
-sources, and enable the SAPI with the configure command. It is enabled by
-default:
-
-```bash
-cd /path/to/php-src
-./buildconf --force
-./configure
-make -j8
-./sapi/phpdbg/phpdbg --version
-```
-
-Where the source directory has been used previously to build PHP, there exists a
-file named `config.nice` which can be used to invoke configure with the same
-parameters as were used by the last execution of `configure`.
-
-**Note:** PHP must be configured with the switch `--with-readline` for phpdbg to
-support history, autocompletion, tab-listing etc.
-
-## Command line options
-
-The following switches are implemented (just like cli SAPI):
-
-* `-n` ignore php ini
-* `-c` search for php ini in path
-* `-z` load zend extension
-* `-d` define php ini entry
-
-The following switches change the default behaviour of phpdbg:
-
-* `-v` disables quietness
-* `-s` enabled stepping
-* `-e` sets execution context
-* `-b` boring - disables use of colour on the console
-* `-I` ignore .phpdbginit (default init file)
-* `-i` override .phpgdbinit location (implies -I)
-* `-O` set oplog output file
-* `-q` do not print banner on startup
-* `-r` jump straight to run
-* `-E` enable step through eval()
-* `-l` listen ports for remote mode
-* `-a` listen address for remote mode
-* `-S` override SAPI name
-
-**Note:** Passing `-rr` will cause phpdbg to quit after execution, rather than
-returning to the console.
-
-## Getting started
-
-See the [website](https://phpdbg.room11.org) for tutorials/documentation.
diff --git a/sapi/phpdbg/config.m4 b/sapi/phpdbg/config.m4
index d4bceed4f7..e78c012e88 100644
--- a/sapi/phpdbg/config.m4
+++ b/sapi/phpdbg/config.m4
@@ -63,9 +63,9 @@ if test "$BUILD_PHPDBG" = "" && test "$PHP_PHPDBG" != "no"; then
BUILD_PHPDBG="\$(LIBTOOL) --mode=link \
\$(CC) -export-dynamic \$(CFLAGS_CLEAN) \$(EXTRA_CFLAGS) \$(EXTRA_LDFLAGS_PROGRAM) \$(LDFLAGS) \$(PHP_RPATHS) \
- \$(PHP_GLOBAL_OBJS) \
- \$(PHP_BINARY_OBJS) \
- \$(PHP_PHPDBG_OBJS) \
+ \$(PHP_GLOBAL_OBJS:.lo=.o) \
+ \$(PHP_BINARY_OBJS:.lo=.o) \
+ \$(PHP_PHPDBG_OBJS:.lo=.o) \
\$(EXTRA_LIBS) \
\$(PHPDBG_EXTRA_LIBS) \
\$(ZEND_EXTRA_LIBS) \
diff --git a/sapi/phpdbg/create-test.php b/sapi/phpdbg/create-test.php
index 3e2c8f0437..06fb7e1632 100755
--- a/sapi/phpdbg/create-test.php
+++ b/sapi/phpdbg/create-test.php
@@ -3,8 +3,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/sapi/phpdbg/phpdbg.c b/sapi/phpdbg/phpdbg.c
index 0f1f03625c..efd2270601 100644
--- a/sapi/phpdbg/phpdbg.c
+++ b/sapi/phpdbg/phpdbg.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
@@ -30,6 +28,8 @@
#include "phpdbg_eol.h"
#include "phpdbg_print.h"
#include "phpdbg_help.h"
+#include "phpdbg_arginfo.h"
+#include "zend_vm.h"
#include "ext/standard/basic_functions.h"
@@ -57,7 +57,7 @@
ZEND_TSRMLS_CACHE_DEFINE()
#endif
-ZEND_DECLARE_MODULE_GLOBALS(phpdbg);
+ZEND_DECLARE_MODULE_GLOBALS(phpdbg)
int phpdbg_startup_run = 0;
static PHP_INI_MH(OnUpdateEol)
@@ -274,6 +274,17 @@ static PHP_RINIT_FUNCTION(phpdbg) /* {{{ */
/* deactivate symbol table caching to have these properly destroyed upon stack leaving (especially important for watchpoints) */
EG(symtable_cache_limit) = EG(symtable_cache);
+ if (zend_vm_kind() != ZEND_VM_KIND_HYBRID) {
+ /* phpdbg cannot work JIT-ed code */
+ zend_string *key = zend_string_init(ZEND_STRL("opcache.jit"), 1);
+ zend_string *value = zend_string_init(ZEND_STRL("off"), 1);
+
+ zend_alter_ini_entry(key, value, ZEND_INI_SYSTEM, ZEND_INI_STAGE_STARTUP);
+
+ zend_string_release(key);
+ zend_string_release(value);
+ }
+
return SUCCESS;
} /* }}} */
@@ -287,17 +298,16 @@ static PHP_RSHUTDOWN_FUNCTION(phpdbg) /* {{{ */
return SUCCESS;
} /* }}} */
-/* {{{ proto mixed phpdbg_exec(string context)
- Attempt to set the execution context for phpdbg
+/* {{{ Attempt to set the execution context for phpdbg
If the execution context was set previously it is returned
If the execution context was not set previously boolean true is returned
If the request to set the context fails, boolean false is returned, and an E_WARNING raised */
-static PHP_FUNCTION(phpdbg_exec)
+PHP_FUNCTION(phpdbg_exec)
{
zend_string *exec;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "S", &exec) == FAILURE) {
- return;
+ RETURN_THROWS();
}
{
@@ -330,67 +340,74 @@ static PHP_FUNCTION(phpdbg_exec)
}
} /* }}} */
-/* {{{ proto void phpdbg_break()
- instructs phpdbg to insert a breakpoint at the next opcode */
-static PHP_FUNCTION(phpdbg_break_next)
+/* {{{ instructs phpdbg to insert a breakpoint at the next opcode */
+PHP_FUNCTION(phpdbg_break_next)
{
- zend_execute_data *ex = EG(current_execute_data);
+ zend_execute_data *ex;
+
+ if (zend_parse_parameters_none() == FAILURE) {
+ RETURN_THROWS();
+ }
+ ex = EG(current_execute_data);
while (ex && ex->func && !ZEND_USER_CODE(ex->func->type)) {
ex = ex->prev_execute_data;
}
- if (zend_parse_parameters_none() == FAILURE || !ex) {
+ if (!ex) {
return;
}
phpdbg_set_breakpoint_opline_ex((phpdbg_opline_ptr_t) ex->opline + 1);
} /* }}} */
-/* {{{ proto void phpdbg_break_file(string file, int line) */
-static PHP_FUNCTION(phpdbg_break_file)
+/* {{{ */
+PHP_FUNCTION(phpdbg_break_file)
{
char *file;
size_t flen;
zend_long line;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "sl", &file, &flen, &line) == FAILURE) {
- return;
+ RETURN_THROWS();
}
phpdbg_set_breakpoint_file(file, 0, line);
} /* }}} */
-/* {{{ proto void phpdbg_break_method(string class, string method) */
-static PHP_FUNCTION(phpdbg_break_method)
+/* {{{ */
+PHP_FUNCTION(phpdbg_break_method)
{
- char *class = NULL, *method = NULL;
- size_t clen = 0, mlen = 0;
+ char *class, *method;
+ size_t clen, mlen;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "ss", &class, &clen, &method, &mlen) == FAILURE) {
- return;
+ RETURN_THROWS();
}
phpdbg_set_breakpoint_method(class, method);
} /* }}} */
-/* {{{ proto void phpdbg_break_function(string function) */
-static PHP_FUNCTION(phpdbg_break_function)
+/* {{{ */
+PHP_FUNCTION(phpdbg_break_function)
{
- char *function = NULL;
+ char *function;
size_t function_len;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "s", &function, &function_len) == FAILURE) {
- return;
+ RETURN_THROWS();
}
phpdbg_set_breakpoint_symbol(function, function_len);
} /* }}} */
-/* {{{ proto void phpdbg_clear(void)
- instructs phpdbg to clear breakpoints */
-static PHP_FUNCTION(phpdbg_clear)
+/* {{{ instructs phpdbg to clear breakpoints */
+PHP_FUNCTION(phpdbg_clear)
{
+ if (zend_parse_parameters_none() == FAILURE) {
+ RETURN_THROWS();
+ }
+
zend_hash_clean(&PHPDBG_G(bp)[PHPDBG_BREAK_FILE]);
zend_hash_clean(&PHPDBG_G(bp)[PHPDBG_BREAK_FILE_PENDING]);
zend_hash_clean(&PHPDBG_G(bp)[PHPDBG_BREAK_SYM]);
@@ -402,15 +419,15 @@ static PHP_FUNCTION(phpdbg_clear)
zend_hash_clean(&PHPDBG_G(bp)[PHPDBG_BREAK_COND]);
} /* }}} */
-/* {{{ proto void phpdbg_color(int element, string color) */
-static PHP_FUNCTION(phpdbg_color)
+/* {{{ */
+PHP_FUNCTION(phpdbg_color)
{
zend_long element;
char *color;
size_t color_len;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "ls", &element, &color, &color_len) == FAILURE) {
- return;
+ RETURN_THROWS();
}
switch (element) {
@@ -420,30 +437,31 @@ static PHP_FUNCTION(phpdbg_color)
phpdbg_set_color_ex(element, color, color_len);
break;
- default: zend_error(E_ERROR, "phpdbg detected an incorrect color constant");
+ default:
+ zend_argument_value_error(1, "must be one of PHPDBG_COLOR_PROMPT, PHPDBG_COLOR_NOTICE, or PHPDBG_COLOR_ERROR");
}
} /* }}} */
-/* {{{ proto void phpdbg_prompt(string prompt) */
-static PHP_FUNCTION(phpdbg_prompt)
+/* {{{ */
+PHP_FUNCTION(phpdbg_prompt)
{
char *prompt = NULL;
size_t prompt_len = 0;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "s", &prompt, &prompt_len) == FAILURE) {
- return;
+ RETURN_THROWS();
}
phpdbg_set_prompt(prompt);
} /* }}} */
-/* {{{ proto void phpdbg_start_oplog() */
-static PHP_FUNCTION(phpdbg_start_oplog)
+/* {{{ */
+PHP_FUNCTION(phpdbg_start_oplog)
{
phpdbg_oplog_list *prev;
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
prev = PHPDBG_G(oplog_list);
@@ -464,7 +482,8 @@ static zend_always_inline zend_bool phpdbg_is_ignored_opcode(zend_uchar opcode)
|| opcode == ZEND_DECLARE_CONST || opcode == ZEND_DECLARE_CLASS || opcode == ZEND_DECLARE_FUNCTION
|| opcode == ZEND_DECLARE_CLASS_DELAYED
|| opcode == ZEND_DECLARE_ANON_CLASS || opcode == ZEND_FAST_RET || opcode == ZEND_TICKS
- || opcode == ZEND_EXT_STMT || opcode == ZEND_EXT_FCALL_BEGIN || opcode == ZEND_EXT_FCALL_END || opcode == ZEND_EXT_NOP || opcode == ZEND_BIND_GLOBAL
+ || opcode == ZEND_EXT_STMT || opcode == ZEND_EXT_FCALL_BEGIN || opcode == ZEND_EXT_FCALL_END
+ || opcode == ZEND_BIND_GLOBAL
;
}
@@ -514,8 +533,8 @@ static inline HashTable* phpdbg_add_empty_array(HashTable *ht, zend_string *name
return Z_ARR_P(ht_zv);
}
-/* {{{ proto void phpdbg_get_executable() */
-static PHP_FUNCTION(phpdbg_get_executable)
+/* {{{ */
+PHP_FUNCTION(phpdbg_get_executable)
{
HashTable *options = NULL;
zval *option_buffer;
@@ -530,7 +549,7 @@ static PHP_FUNCTION(phpdbg_get_executable)
HashTable files_tmp;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "|H", &options) == FAILURE) {
- return;
+ RETURN_THROWS();
}
if (options && (option_buffer = zend_hash_str_find(options, ZEND_STRL("functions")))) {
@@ -612,8 +631,8 @@ static PHP_FUNCTION(phpdbg_get_executable)
}
}
-/* {{{ proto void phpdbg_end_oplog() */
-static PHP_FUNCTION(phpdbg_end_oplog)
+/* {{{ */
+PHP_FUNCTION(phpdbg_end_oplog)
{
phpdbg_oplog_entry *cur;
phpdbg_oplog_list *prev;
@@ -624,7 +643,7 @@ static PHP_FUNCTION(phpdbg_end_oplog)
zend_bool by_opcode = 0;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "|H", &options) == FAILURE) {
- return;
+ RETURN_THROWS();
}
if (!PHPDBG_G(oplog_list)) {
@@ -715,73 +734,10 @@ static PHP_FUNCTION(phpdbg_end_oplog)
}
}
-ZEND_BEGIN_ARG_INFO_EX(phpdbg_break_next_arginfo, 0, 0, 0)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(phpdbg_break_file_arginfo, 0, 0, 2)
- ZEND_ARG_INFO(0, file)
- ZEND_ARG_INFO(0, line)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(phpdbg_break_method_arginfo, 0, 0, 2)
- ZEND_ARG_INFO(0, class)
- ZEND_ARG_INFO(0, method)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(phpdbg_break_function_arginfo, 0, 0, 1)
- ZEND_ARG_INFO(0, function)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(phpdbg_color_arginfo, 0, 0, 2)
- ZEND_ARG_INFO(0, element)
- ZEND_ARG_INFO(0, color)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(phpdbg_prompt_arginfo, 0, 0, 1)
- ZEND_ARG_INFO(0, string)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(phpdbg_exec_arginfo, 0, 0, 1)
- ZEND_ARG_INFO(0, context)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(phpdbg_clear_arginfo, 0, 0, 0)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(phpdbg_start_oplog_arginfo, 0, 0, 0)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(phpdbg_end_oplog_arginfo, 0, 0, 0)
- ZEND_ARG_INFO(0, options)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(phpdbg_get_executable_arginfo, 0, 0, 0)
- ZEND_ARG_INFO(0, options)
-ZEND_END_ARG_INFO()
-
-static const zend_function_entry phpdbg_user_functions[] = {
- PHP_FE(phpdbg_clear, phpdbg_clear_arginfo)
- PHP_FE(phpdbg_break_next, phpdbg_break_next_arginfo)
- PHP_FE(phpdbg_break_file, phpdbg_break_file_arginfo)
- PHP_FE(phpdbg_break_method, phpdbg_break_method_arginfo)
- PHP_FE(phpdbg_break_function, phpdbg_break_function_arginfo)
- PHP_FE(phpdbg_exec, phpdbg_exec_arginfo)
- PHP_FE(phpdbg_color, phpdbg_color_arginfo)
- PHP_FE(phpdbg_prompt, phpdbg_prompt_arginfo)
- PHP_FE(phpdbg_start_oplog, phpdbg_start_oplog_arginfo)
- PHP_FE(phpdbg_end_oplog, phpdbg_end_oplog_arginfo)
- PHP_FE(phpdbg_get_executable, phpdbg_get_executable_arginfo)
-#ifdef PHP_FE_END
- PHP_FE_END
-#else
- {NULL,NULL,NULL}
-#endif
-};
-
static zend_module_entry sapi_phpdbg_module_entry = {
STANDARD_MODULE_HEADER,
PHPDBG_NAME,
- phpdbg_user_functions,
+ ext_functions,
PHP_MINIT(phpdbg),
PHP_MSHUTDOWN(phpdbg),
PHP_RINIT(phpdbg),
@@ -826,7 +782,7 @@ static void php_sapi_phpdbg_send_header(sapi_header_struct *sapi_header, void *s
}
/* }}} */
-static void php_sapi_phpdbg_log_message(char *message, int syslog_type_int) /* {{{ */
+static void php_sapi_phpdbg_log_message(const char *message, int syslog_type_int) /* {{{ */
{
/*
* We must not request TSRM before being booted
@@ -843,32 +799,25 @@ static void php_sapi_phpdbg_log_message(char *message, int syslog_type_int) /* {
return;
}
- switch (PG(last_error_type)) {
- case E_ERROR:
- case E_CORE_ERROR:
- case E_COMPILE_ERROR:
- case E_USER_ERROR:
- case E_PARSE:
- case E_RECOVERABLE_ERROR: {
- const char *file_char = zend_get_executed_filename();
- zend_string *file = zend_string_init(file_char, strlen(file_char), 0);
- phpdbg_list_file(file, 3, zend_get_executed_lineno() - 1, zend_get_executed_lineno());
- zend_string_release(file);
-
- if (!phpdbg_fully_started) {
- return;
- }
+ if (PG(last_error_type) & E_FATAL_ERRORS) {
+ const char *file_char = zend_get_executed_filename();
+ zend_string *file = zend_string_init(file_char, strlen(file_char), 0);
+ phpdbg_list_file(file, 3, zend_get_executed_lineno() - 1, zend_get_executed_lineno());
+ zend_string_release(file);
- do {
- switch (phpdbg_interactive(1, NULL)) {
- case PHPDBG_LEAVE:
- case PHPDBG_FINISH:
- case PHPDBG_UNTIL:
- case PHPDBG_NEXT:
- return;
- }
- } while (!(PHPDBG_G(flags) & PHPDBG_IS_STOPPING));
+ if (!phpdbg_fully_started) {
+ return;
}
+
+ do {
+ switch (phpdbg_interactive(1, NULL)) {
+ case PHPDBG_LEAVE:
+ case PHPDBG_FINISH:
+ case PHPDBG_UNTIL:
+ case PHPDBG_NEXT:
+ return;
+ }
+ } while (!(PHPDBG_G(flags) & PHPDBG_IS_STOPPING));
}
} else {
fprintf(stdout, "%s\n", message);
@@ -1035,8 +984,7 @@ void phpdbg_register_file_handles(void) /* {{{ */
}
/* }}} */
-/* {{{ sapi_module_struct phpdbg_sapi_module
-*/
+/* {{{ sapi_module_struct phpdbg_sapi_module */
static sapi_module_struct phpdbg_sapi_module = {
"phpdbg", /* name */
"phpdbg", /* pretty name */
@@ -1108,17 +1056,6 @@ const char phpdbg_ini_hardcoded[] =
"error_log=\n"
"output_buffering=off\n\0";
-/* overwriteable ini defaults must be set in phpdbg_ini_defaults() */
-#define INI_DEFAULT(name, value) \
- ZVAL_NEW_STR(&tmp, zend_string_init(value, sizeof(value) - 1, 1)); \
- zend_hash_str_update(configuration_hash, name, sizeof(name) - 1, &tmp);
-
-void phpdbg_ini_defaults(HashTable *configuration_hash) /* {{{ */
-{
- zval tmp;
- INI_DEFAULT("report_zend_debug", "0");
-} /* }}} */
-
static void phpdbg_welcome(zend_bool cleaning) /* {{{ */
{
/* print blurb */
@@ -1613,7 +1550,7 @@ phpdbg_main:
phpdbg->name = sapi_name;
}
- phpdbg->ini_defaults = phpdbg_ini_defaults;
+ phpdbg->ini_defaults = NULL;
phpdbg->phpinfo_as_text = 1;
phpdbg->php_ini_ignore_cwd = 1;
@@ -1737,6 +1674,9 @@ phpdbg_main:
}
#ifndef _WIN32
+# ifndef SIGIO
+# define SIGIO SIGPOLL
+# endif
zend_sigaction(SIGIO, &sigio_struct, NULL);
#endif
@@ -2025,7 +1965,7 @@ phpdbg_interact:
if ((PHPDBG_G(flags) & PHPDBG_IS_DISCONNECTED)) {
if (PHPDBG_G(flags) & PHPDBG_IS_REMOTE) {
- /* renegociate connections */
+ /* renegotiate connections */
phpdbg_remote_init(address, listen, server, &socket, &stream);
/* set streams */
@@ -2125,7 +2065,7 @@ phpdbg_out:
settings->oplog = PHPDBG_G(oplog);
settings->prompt[0] = PHPDBG_G(prompt)[0];
settings->prompt[1] = PHPDBG_G(prompt)[1];
- memcpy(settings->colors, PHPDBG_G(colors), sizeof(settings->colors));
+ memcpy(ZEND_VOIDP(settings->colors), PHPDBG_G(colors), sizeof(settings->colors));
settings->eol = PHPDBG_G(eol);
settings->input_buflen = PHPDBG_G(input_buflen);
memcpy(settings->input_buffer, PHPDBG_G(input_buffer), settings->input_buflen);
diff --git a/sapi/phpdbg/phpdbg.h b/sapi/phpdbg/phpdbg.h
index d0e316c78b..e5db725336 100644
--- a/sapi/phpdbg/phpdbg.h
+++ b/sapi/phpdbg/phpdbg.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
@@ -111,7 +109,7 @@
#define PHPDBG_DEFAULT_PROMPT "prompt>"
/* }}} */
-/* Hey, apple. One shouldn't define *functions* from the standard C library as marcos. */
+/* Hey, apple. One shouldn't define *functions* from the standard C library as macros. */
#ifdef memcpy
#define memcpy_tmp(...) memcpy(__VA_ARGS__)
#undef memcpy
@@ -277,7 +275,7 @@ ZEND_BEGIN_MODULE_GLOBALS(phpdbg)
zend_op_array *(*compile_file)(zend_file_handle *file_handle, int type);
zend_op_array *(*init_compile_file)(zend_file_handle *file_handle, int type);
- zend_op_array *(*compile_string)(zval *source_string, char *filename);
+ zend_op_array *(*compile_string)(zend_string *source_string, const char *filename);
HashTable file_sources;
FILE *oplog; /* opline log */
@@ -316,7 +314,7 @@ ZEND_BEGIN_MODULE_GLOBALS(phpdbg)
int input_buflen; /* length of stdin input buffer */
phpdbg_signal_safe_mem sigsafe_mem; /* memory to use in async safe environment (only once!) */
- JMP_BUF *sigsegv_bailout; /* bailout address for accesibility probing */
+ JMP_BUF *sigsegv_bailout; /* bailout address for accessibility probing */
uint64_t flags; /* phpdbg flags */
diff --git a/sapi/phpdbg/phpdbg.stub.php b/sapi/phpdbg/phpdbg.stub.php
new file mode 100644
index 0000000000..4d733ccaf6
--- /dev/null
+++ b/sapi/phpdbg/phpdbg.stub.php
@@ -0,0 +1,25 @@
+<?php
+
+/** @generate-function-entries */
+
+function phpdbg_break_next(): void {}
+
+function phpdbg_break_file(string $file, int $line): void {}
+
+function phpdbg_break_method(string $class, string $method): void {}
+
+function phpdbg_break_function(string $function): void {}
+
+function phpdbg_color(int $element, string $color): void {}
+
+function phpdbg_prompt(string $string): void {}
+
+function phpdbg_exec(string $context): string|bool {}
+
+function phpdbg_clear(): void {}
+
+function phpdbg_start_oplog(): void {}
+
+function phpdbg_end_oplog(array $options = []): ?array {}
+
+function phpdbg_get_executable(array $options = []): array {}
diff --git a/sapi/phpdbg/phpdbg_arginfo.h b/sapi/phpdbg/phpdbg_arginfo.h
new file mode 100644
index 0000000000..a4ee52d814
--- /dev/null
+++ b/sapi/phpdbg/phpdbg_arginfo.h
@@ -0,0 +1,73 @@
+/* This is a generated file, edit the .stub.php file instead.
+ * Stub hash: 3fd1a8c30695df2089655b1785905381734ac1c1 */
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_phpdbg_break_next, 0, 0, IS_VOID, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_phpdbg_break_file, 0, 2, IS_VOID, 0)
+ ZEND_ARG_TYPE_INFO(0, file, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, line, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_phpdbg_break_method, 0, 2, IS_VOID, 0)
+ ZEND_ARG_TYPE_INFO(0, class, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, method, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_phpdbg_break_function, 0, 1, IS_VOID, 0)
+ ZEND_ARG_TYPE_INFO(0, function, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_phpdbg_color, 0, 2, IS_VOID, 0)
+ ZEND_ARG_TYPE_INFO(0, element, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, color, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_phpdbg_prompt, 0, 1, IS_VOID, 0)
+ ZEND_ARG_TYPE_INFO(0, string, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_phpdbg_exec, 0, 1, MAY_BE_STRING|MAY_BE_BOOL)
+ ZEND_ARG_TYPE_INFO(0, context, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_phpdbg_clear arginfo_phpdbg_break_next
+
+#define arginfo_phpdbg_start_oplog arginfo_phpdbg_break_next
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_phpdbg_end_oplog, 0, 0, IS_ARRAY, 1)
+ ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, options, IS_ARRAY, 0, "[]")
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_phpdbg_get_executable, 0, 0, IS_ARRAY, 0)
+ ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, options, IS_ARRAY, 0, "[]")
+ZEND_END_ARG_INFO()
+
+
+ZEND_FUNCTION(phpdbg_break_next);
+ZEND_FUNCTION(phpdbg_break_file);
+ZEND_FUNCTION(phpdbg_break_method);
+ZEND_FUNCTION(phpdbg_break_function);
+ZEND_FUNCTION(phpdbg_color);
+ZEND_FUNCTION(phpdbg_prompt);
+ZEND_FUNCTION(phpdbg_exec);
+ZEND_FUNCTION(phpdbg_clear);
+ZEND_FUNCTION(phpdbg_start_oplog);
+ZEND_FUNCTION(phpdbg_end_oplog);
+ZEND_FUNCTION(phpdbg_get_executable);
+
+
+static const zend_function_entry ext_functions[] = {
+ ZEND_FE(phpdbg_break_next, arginfo_phpdbg_break_next)
+ ZEND_FE(phpdbg_break_file, arginfo_phpdbg_break_file)
+ ZEND_FE(phpdbg_break_method, arginfo_phpdbg_break_method)
+ ZEND_FE(phpdbg_break_function, arginfo_phpdbg_break_function)
+ ZEND_FE(phpdbg_color, arginfo_phpdbg_color)
+ ZEND_FE(phpdbg_prompt, arginfo_phpdbg_prompt)
+ ZEND_FE(phpdbg_exec, arginfo_phpdbg_exec)
+ ZEND_FE(phpdbg_clear, arginfo_phpdbg_clear)
+ ZEND_FE(phpdbg_start_oplog, arginfo_phpdbg_start_oplog)
+ ZEND_FE(phpdbg_end_oplog, arginfo_phpdbg_end_oplog)
+ ZEND_FE(phpdbg_get_executable, arginfo_phpdbg_get_executable)
+ ZEND_FE_END
+};
diff --git a/sapi/phpdbg/phpdbg_bp.c b/sapi/phpdbg/phpdbg_bp.c
index 738967f907..db3d1cf0c4 100644
--- a/sapi/phpdbg/phpdbg_bp.c
+++ b/sapi/phpdbg/phpdbg_bp.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
@@ -830,7 +828,7 @@ static inline void phpdbg_create_conditional_break(phpdbg_breakcond_t *brake, co
{
phpdbg_breakcond_t new_break;
uint32_t cops = CG(compiler_options);
- zval pv;
+ zend_string *bp_code;
switch (param->type) {
case STR_PARAM:
@@ -879,16 +877,10 @@ static inline void phpdbg_create_conditional_break(phpdbg_breakcond_t *brake, co
new_break.code = estrndup(expr, expr_len);
new_break.code_len = expr_len;
- Z_STR(pv) = zend_string_alloc(expr_len + sizeof("return ;") - 1, 0);
- memcpy(Z_STRVAL(pv), "return ", sizeof("return ") - 1);
- memcpy(Z_STRVAL(pv) + sizeof("return ") - 1, expr, expr_len);
- Z_STRVAL(pv)[Z_STRLEN(pv) - 1] = ';';
- Z_STRVAL(pv)[Z_STRLEN(pv)] = '\0';
- Z_TYPE_INFO(pv) = IS_STRING;
-
- new_break.ops = zend_compile_string(&pv, "Conditional Breakpoint Code");
-
- zval_ptr_dtor_str(&pv);
+ bp_code = zend_string_concat3(
+ "return ", sizeof("return ")-1, expr, expr_len, ";", sizeof(";")-1);
+ new_break.ops = zend_compile_string(bp_code, "Conditional Breakpoint Code");
+ zend_string_release(bp_code);
if (new_break.ops) {
brake = zend_hash_index_update_mem(&PHPDBG_G(bp)[PHPDBG_BREAK_COND], hash, &new_break, sizeof(phpdbg_breakcond_t));
@@ -908,7 +900,7 @@ static inline void phpdbg_create_conditional_break(phpdbg_breakcond_t *brake, co
PHPDBG_API void phpdbg_set_breakpoint_expression(const char *expr, size_t expr_len) /* {{{ */
{
- zend_ulong expr_hash = zend_inline_hash_func(expr, expr_len);
+ zend_ulong expr_hash = zend_hash_func(expr, expr_len);
phpdbg_breakcond_t new_break;
if (!zend_hash_index_exists(&PHPDBG_G(bp)[PHPDBG_BREAK_COND], expr_hash)) {
@@ -927,7 +919,7 @@ PHPDBG_API void phpdbg_set_breakpoint_at(const phpdbg_param_t *param) /* {{{ */
if (param->next) {
condition = param->next;
- hash = zend_inline_hash_func(condition->str, condition->len);
+ hash = zend_hash_func(condition->str, condition->len);
if (!zend_hash_index_exists(&PHPDBG_G(bp)[PHPDBG_BREAK_COND], hash)) {
phpdbg_create_conditional_break(&new_break, param, condition->str, condition->len, hash);
diff --git a/sapi/phpdbg/phpdbg_bp.h b/sapi/phpdbg/phpdbg_bp.h
index 7e038bb10e..87c5388c94 100644
--- a/sapi/phpdbg/phpdbg_bp.h
+++ b/sapi/phpdbg/phpdbg_bp.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/sapi/phpdbg/phpdbg_break.c b/sapi/phpdbg/phpdbg_break.c
index 719d93d166..dd24a7994d 100644
--- a/sapi/phpdbg/phpdbg_break.c
+++ b/sapi/phpdbg/phpdbg_break.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/sapi/phpdbg/phpdbg_break.h b/sapi/phpdbg/phpdbg_break.h
index 0aafa592e9..de367a17c8 100644
--- a/sapi/phpdbg/phpdbg_break.h
+++ b/sapi/phpdbg/phpdbg_break.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/sapi/phpdbg/phpdbg_btree.c b/sapi/phpdbg/phpdbg_btree.c
index c174920836..4bd9787556 100644
--- a/sapi/phpdbg/phpdbg_btree.c
+++ b/sapi/phpdbg/phpdbg_btree.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/sapi/phpdbg/phpdbg_btree.h b/sapi/phpdbg/phpdbg_btree.h
index 4ffb72697a..bb0a4ef3fb 100644
--- a/sapi/phpdbg/phpdbg_btree.h
+++ b/sapi/phpdbg/phpdbg_btree.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/sapi/phpdbg/phpdbg_cmd.c b/sapi/phpdbg/phpdbg_cmd.c
index 4845acca9a..757d48e739 100644
--- a/sapi/phpdbg/phpdbg_cmd.c
+++ b/sapi/phpdbg/phpdbg_cmd.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
@@ -201,16 +199,16 @@ PHPDBG_API zend_ulong phpdbg_hash_param(const phpdbg_param_t *param) /* {{{ */
break;
case STR_PARAM:
- hash += zend_inline_hash_func(param->str, param->len);
+ hash += zend_hash_func(param->str, param->len);
break;
case METHOD_PARAM:
- hash += zend_inline_hash_func(param->method.class, strlen(param->method.class));
- hash += zend_inline_hash_func(param->method.name, strlen(param->method.name));
+ hash += zend_hash_func(param->method.class, strlen(param->method.class));
+ hash += zend_hash_func(param->method.name, strlen(param->method.name));
break;
case FILE_PARAM:
- hash += zend_inline_hash_func(param->file.name, strlen(param->file.name));
+ hash += zend_hash_func(param->file.name, strlen(param->file.name));
hash += param->file.line;
if (param->num)
hash += param->num;
@@ -225,13 +223,13 @@ PHPDBG_API zend_ulong phpdbg_hash_param(const phpdbg_param_t *param) /* {{{ */
break;
case NUMERIC_FUNCTION_PARAM:
- hash += zend_inline_hash_func(param->str, param->len);
+ hash += zend_hash_func(param->str, param->len);
hash += param->num;
break;
case NUMERIC_METHOD_PARAM:
- hash += zend_inline_hash_func(param->method.class, strlen(param->method.class));
- hash += zend_inline_hash_func(param->method.name, strlen(param->method.name));
+ hash += zend_hash_func(param->method.class, strlen(param->method.class));
+ hash += zend_hash_func(param->method.name, strlen(param->method.name));
if (param->num)
hash+= param->num;
break;
@@ -739,10 +737,9 @@ PHPDBG_API int phpdbg_stack_execute(phpdbg_param_t *stack, zend_bool allow_async
return SUCCESS;
} /* }}} */
-PHPDBG_API char *phpdbg_read_input(char *buffered) /* {{{ */
+PHPDBG_API char *phpdbg_read_input(const char *buffered) /* {{{ */
{
char buf[PHPDBG_MAX_CMD];
- char *cmd = NULL;
char *buffer = NULL;
if ((PHPDBG_G(flags) & (PHPDBG_IS_STOPPING | PHPDBG_IS_RUNNING)) != PHPDBG_IS_STOPPING) {
@@ -757,11 +754,12 @@ PHPDBG_API char *phpdbg_read_input(char *buffered) /* {{{ */
#endif
{
phpdbg_write("prompt", "", "%s", phpdbg_get_prompt());
- phpdbg_consume_stdin_line(cmd = buf);
+ phpdbg_consume_stdin_line(buf);
+ buffer = estrdup(buf);
}
#ifdef HAVE_PHPDBG_READLINE
else {
- cmd = readline(phpdbg_get_prompt());
+ char *cmd = readline(phpdbg_get_prompt());
PHPDBG_G(last_was_newline) = 1;
if (!cmd) {
@@ -770,19 +768,13 @@ PHPDBG_API char *phpdbg_read_input(char *buffered) /* {{{ */
}
add_history(cmd);
+ buffer = estrdup(cmd);
+ free(cmd);
}
#endif
} else {
- cmd = buffered;
- }
-
- buffer = estrdup(cmd);
-
-#ifdef HAVE_PHPDBG_READLINE
- if (!buffered && cmd && !(PHPDBG_G(flags) & PHPDBG_IS_REMOTE) && isatty(PHPDBG_G(io)[PHPDBG_STDIN].fd)) {
- free(cmd);
+ buffer = estrdup(buffered);
}
-#endif
}
if (buffer && isspace(*buffer)) {
diff --git a/sapi/phpdbg/phpdbg_cmd.h b/sapi/phpdbg/phpdbg_cmd.h
index b82ed9aceb..3cc07d1a70 100644
--- a/sapi/phpdbg/phpdbg_cmd.h
+++ b/sapi/phpdbg/phpdbg_cmd.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
@@ -83,10 +81,6 @@ struct _phpdbg_param {
(v)->top = NULL; \
} while(0)
-#ifndef YYSTYPE
-#define YYSTYPE phpdbg_param_t
-#endif
-
#define PHPDBG_ASYNC_SAFE 1
typedef int (*phpdbg_command_handler_t)(const phpdbg_param_t*);
@@ -131,8 +125,8 @@ typedef struct {
/*
* Input Management
*/
-PHPDBG_API char* phpdbg_read_input(char *buffered);
-PHPDBG_API void phpdbg_destroy_input(char**);
+PHPDBG_API char *phpdbg_read_input(const char *buffered);
+PHPDBG_API void phpdbg_destroy_input(char **input);
PHPDBG_API int phpdbg_ask_user_permission(const char *question);
/**
diff --git a/sapi/phpdbg/phpdbg_eol.c b/sapi/phpdbg/phpdbg_eol.c
index 4115ea449b..51c58b0ad1 100644
--- a/sapi/phpdbg/phpdbg_eol.c
+++ b/sapi/phpdbg/phpdbg_eol.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/sapi/phpdbg/phpdbg_eol.h b/sapi/phpdbg/phpdbg_eol.h
index 46141c62cd..b59f0cd74e 100644
--- a/sapi/phpdbg/phpdbg_eol.h
+++ b/sapi/phpdbg/phpdbg_eol.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/sapi/phpdbg/phpdbg_frame.c b/sapi/phpdbg/phpdbg_frame.c
index 912089ea23..453a0d74ba 100644
--- a/sapi/phpdbg/phpdbg_frame.c
+++ b/sapi/phpdbg/phpdbg_frame.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
@@ -231,7 +229,7 @@ static void phpdbg_dump_prototype(zval *tmp) /* {{{ */
}
if (!is_variadic) {
- is_variadic = arginfo ? arginfo[j].is_variadic : 0;
+ is_variadic = arginfo ? ZEND_ARG_IS_VARIADIC(&arginfo[j]) : 0;
}
phpdbg_xml(" variadic=\"%s\" name=\"%s\">", is_variadic ? "variadic" : "", arg_name ? arg_name : "");
diff --git a/sapi/phpdbg/phpdbg_frame.h b/sapi/phpdbg/phpdbg_frame.h
index d7d9534b1f..6a5c25b53e 100644
--- a/sapi/phpdbg/phpdbg_frame.h
+++ b/sapi/phpdbg/phpdbg_frame.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/sapi/phpdbg/phpdbg_help.c b/sapi/phpdbg/phpdbg_help.c
index 32d2485ff9..e8a02de444 100644
--- a/sapi/phpdbg/phpdbg_help.c
+++ b/sapi/phpdbg/phpdbg_help.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
@@ -29,7 +27,7 @@ ZEND_EXTERN_MODULE_GLOBALS(phpdbg)
/* {{{ Commands Table */
#define PHPDBG_COMMAND_HELP_D(name, tip, alias, action) \
- {PHPDBG_STRL(#name), tip, sizeof(tip)-1, alias, action, &phpdbg_prompt_commands[16], 0}
+ {PHPDBG_STRL(#name), tip, sizeof(tip)-1, alias, action, &phpdbg_prompt_commands[16], 0, NULL, (zend_bool) 0}
const phpdbg_command_t phpdbg_help_commands[] = {
PHPDBG_COMMAND_HELP_D(aliases, "show alias list", 'a', phpdbg_do_help_aliases),
@@ -430,7 +428,7 @@ phpdbg_help_text_t phpdbg_help_text[] = {
"This mode is enabled by specifying the **-a** option. Phpdbg will bind only to the loopback "
"interface by default, and this can only be overridden by explicitly setting the remote console "
-"bind address using the **-a** option. If **-a** is specied without an argument, then phpdbg "
+"bind address using the **-a** option. If **-a** is specified without an argument, then phpdbg "
"will bind to all available interfaces. You should be aware of the security implications of "
"doing this, so measures should be taken to secure this service if bound to a publicly accessible "
"interface/port." CR CR
diff --git a/sapi/phpdbg/phpdbg_help.h b/sapi/phpdbg/phpdbg_help.h
index 420e6fb014..1e531cc91c 100644
--- a/sapi/phpdbg/phpdbg_help.h
+++ b/sapi/phpdbg/phpdbg_help.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/sapi/phpdbg/phpdbg_info.c b/sapi/phpdbg/phpdbg_info.c
index bcec3361fc..783681009e 100644
--- a/sapi/phpdbg/phpdbg_info.c
+++ b/sapi/phpdbg/phpdbg_info.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
@@ -125,7 +123,7 @@ PHPDBG_INFO(constants) /* {{{ */
"address=\"%p\" refcount=\"%d\" type=\"%s\" name=\"%.*s\" " attrs, \
"%-18p %-7d %-9s %.*s" msg, &data->value, \
Z_REFCOUNTED(data->value) ? Z_REFCOUNT(data->value) : 1, \
- zend_zval_type_name(&data->value), \
+ zend_get_type_by_const(Z_TYPE(data->value)), \
(int) ZSTR_LEN(data->name), ZSTR_VAL(data->name), ##__VA_ARGS__)
switch (Z_TYPE(data->value)) {
@@ -233,7 +231,7 @@ static int phpdbg_print_symbols(zend_bool show_globals) {
#define VARIABLEINFO(attrs, msg, ...) \
phpdbg_writeln("variable", \
"address=\"%p\" refcount=\"%d\" type=\"%s\" refstatus=\"%s\" name=\"%.*s\" " attrs, \
- "%-18p %-7d %-9s %s$%.*s" msg, data, Z_REFCOUNTED_P(data) ? Z_REFCOUNT_P(data) : 1, zend_zval_type_name(data), isref, (int) ZSTR_LEN(var), ZSTR_VAL(var), ##__VA_ARGS__)
+ "%-18p %-7d %-9s %s$%.*s" msg, data, Z_REFCOUNTED_P(data) ? Z_REFCOUNT_P(data) : 1, zend_get_type_by_const(Z_TYPE_P(data)), isref, (int) ZSTR_LEN(var), ZSTR_VAL(var), ##__VA_ARGS__)
retry_switch:
switch (Z_TYPE_P(data)) {
case IS_RESOURCE:
diff --git a/sapi/phpdbg/phpdbg_info.h b/sapi/phpdbg/phpdbg_info.h
index faf0090bd3..16a814d097 100644
--- a/sapi/phpdbg/phpdbg_info.h
+++ b/sapi/phpdbg/phpdbg_info.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/sapi/phpdbg/phpdbg_io.c b/sapi/phpdbg/phpdbg_io.c
index 6917daa9d9..30857ac945 100644
--- a/sapi/phpdbg/phpdbg_io.c
+++ b/sapi/phpdbg/phpdbg_io.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/sapi/phpdbg/phpdbg_io.h b/sapi/phpdbg/phpdbg_io.h
index d875d276cb..4ae98dc289 100644
--- a/sapi/phpdbg/phpdbg_io.h
+++ b/sapi/phpdbg/phpdbg_io.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/sapi/phpdbg/phpdbg_lexer.h b/sapi/phpdbg/phpdbg_lexer.h
index e1cc55ccf3..5e87157cd7 100644
--- a/sapi/phpdbg/phpdbg_lexer.h
+++ b/sapi/phpdbg/phpdbg_lexer.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/sapi/phpdbg/phpdbg_list.c b/sapi/phpdbg/phpdbg_list.c
index 03b4c3526e..0967e22f65 100644
--- a/sapi/phpdbg/phpdbg_list.c
+++ b/sapi/phpdbg/phpdbg_list.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
@@ -244,7 +242,6 @@ zend_op_array *phpdbg_compile_file(zend_file_handle *file, int type) {
if (zend_stream_fixup(file, &bufptr, &len) == FAILURE) {
if (type == ZEND_REQUIRE) {
zend_message_dispatcher(ZMSG_FAILED_REQUIRE_FOPEN, file->filename);
- zend_bailout();
} else {
zend_message_dispatcher(ZMSG_FAILED_INCLUDE_FOPEN, file->filename);
}
@@ -319,7 +316,7 @@ zend_op_array *phpdbg_init_compile_file(zend_file_handle *file, int type) {
return op_array;
}
-zend_op_array *phpdbg_compile_string(zval *source_string, char *filename) {
+zend_op_array *phpdbg_compile_string(zend_string *source_string, const char *filename) {
zend_string *fake_name;
zend_op_array *op_array;
phpdbg_file_source *dataptr;
@@ -330,9 +327,9 @@ zend_op_array *phpdbg_compile_string(zval *source_string, char *filename) {
return PHPDBG_G(compile_string)(source_string, filename);
}
- dataptr = emalloc(sizeof(phpdbg_file_source) + sizeof(uint32_t) * Z_STRLEN_P(source_string));
- dataptr->buf = estrndup(Z_STRVAL_P(source_string), Z_STRLEN_P(source_string));
- dataptr->len = Z_STRLEN_P(source_string);
+ dataptr = emalloc(sizeof(phpdbg_file_source) + sizeof(uint32_t) * ZSTR_LEN(source_string));
+ dataptr->buf = estrndup(ZSTR_VAL(source_string), ZSTR_LEN(source_string));
+ dataptr->len = ZSTR_LEN(source_string);
dataptr->line[0] = 0;
for (line = 0, bufptr = dataptr->buf - 1, endptr = dataptr->buf + dataptr->len; ++bufptr < endptr;) {
if (*bufptr == '\n') {
diff --git a/sapi/phpdbg/phpdbg_list.h b/sapi/phpdbg/phpdbg_list.h
index 68cbee8c16..38b4f6bbb6 100644
--- a/sapi/phpdbg/phpdbg_list.h
+++ b/sapi/phpdbg/phpdbg_list.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/sapi/phpdbg/phpdbg_opcode.c b/sapi/phpdbg/phpdbg_opcode.c
index 2d6bcd4f78..4c0c2fbf7a 100644
--- a/sapi/phpdbg/phpdbg_opcode.c
+++ b/sapi/phpdbg/phpdbg_opcode.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/sapi/phpdbg/phpdbg_opcode.h b/sapi/phpdbg/phpdbg_opcode.h
index b9e2fa506c..68bdddf0b1 100644
--- a/sapi/phpdbg/phpdbg_opcode.h
+++ b/sapi/phpdbg/phpdbg_opcode.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/sapi/phpdbg/phpdbg_out.c b/sapi/phpdbg/phpdbg_out.c
index 665df6d08b..30dadfc11c 100644
--- a/sapi/phpdbg/phpdbg_out.c
+++ b/sapi/phpdbg/phpdbg_out.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/sapi/phpdbg/phpdbg_out.h b/sapi/phpdbg/phpdbg_out.h
index 09f4815d85..19e2b3766d 100644
--- a/sapi/phpdbg/phpdbg_out.h
+++ b/sapi/phpdbg/phpdbg_out.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/sapi/phpdbg/phpdbg_parser.y b/sapi/phpdbg/phpdbg_parser.y
index 4c4a339c0a..cdfe92570e 100644
--- a/sapi/phpdbg/phpdbg_parser.y
+++ b/sapi/phpdbg/phpdbg_parser.y
@@ -1,18 +1,24 @@
-%{
-
+%require "3.0"
/*
* phpdbg_parser.y
* (from php-src root)
*/
+%code requires {
#include "phpdbg.h"
+#ifndef YY_TYPEDEF_YY_SCANNER_T
+#define YY_TYPEDEF_YY_SCANNER_T
+typedef void* yyscan_t;
+#endif
+}
+
+%code {
+
#include "phpdbg_cmd.h"
#include "phpdbg_utils.h"
#include "phpdbg_cmd.h"
#include "phpdbg_prompt.h"
-#define YYSTYPE phpdbg_param_t
-
#include "phpdbg_parser.h"
#include "phpdbg_lexer.h"
@@ -26,19 +32,13 @@ ZEND_EXTERN_MODULE_GLOBALS(phpdbg)
#define YYFREE free
#endif
-%}
+}
+%define api.prefix {phpdbg_}
%define api.pure full
+%define api.value.type {phpdbg_param_t}
%define parse.error verbose
-%code requires {
-#include "phpdbg.h"
-#ifndef YY_TYPEDEF_YY_SCANNER_T
-#define YY_TYPEDEF_YY_SCANNER_T
-typedef void* yyscan_t;
-#endif
-}
-
%token T_EVAL "eval"
%token T_RUN "run"
%token T_SHELL "shell"
@@ -64,7 +64,7 @@ typedef void* yyscan_t;
input
: non_empty_input { $$ = $1; }
- | /* empty */
+ | %empty
;
non_empty_input
@@ -147,7 +147,7 @@ parameter
req_id
: T_REQ_ID { PHPDBG_G(req_id) = $1.num; }
- | /* empty */
+ | %empty
;
full_expression
diff --git a/sapi/phpdbg/phpdbg_print.c b/sapi/phpdbg/phpdbg_print.c
index 5f48bd6a59..df925b6402 100644
--- a/sapi/phpdbg/phpdbg_print.c
+++ b/sapi/phpdbg/phpdbg_print.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
@@ -377,7 +375,7 @@ void phpdbg_print_opcodes_class(const char *class) {
phpdbg_print_opcodes_ce(ce);
}
-PHPDBG_API void phpdbg_print_opcodes(char *function)
+PHPDBG_API void phpdbg_print_opcodes(const char *function)
{
if (function == NULL) {
phpdbg_print_opcodes_main();
@@ -403,12 +401,12 @@ PHPDBG_API void phpdbg_print_opcodes(char *function)
}
} ZEND_HASH_FOREACH_END();
} else {
- function = zend_str_tolower_dup(function, strlen(function));
+ char *function_lowercase = zend_str_tolower_dup(function, strlen(function));
- if (strstr(function, "::") == NULL) {
- phpdbg_print_opcodes_function(function, strlen(function));
+ if (strstr(function_lowercase, "::") == NULL) {
+ phpdbg_print_opcodes_function(function_lowercase, strlen(function_lowercase));
} else {
- char *method_name, *class_name = strtok(function, "::");
+ char *method_name, *class_name = strtok(function_lowercase, "::");
if ((method_name = strtok(NULL, "::")) == NULL) {
phpdbg_print_opcodes_class(class_name);
} else {
@@ -416,6 +414,6 @@ PHPDBG_API void phpdbg_print_opcodes(char *function)
}
}
- efree(function);
+ efree(function_lowercase);
}
}
diff --git a/sapi/phpdbg/phpdbg_print.h b/sapi/phpdbg/phpdbg_print.h
index 66eae7bceb..14f5bf6939 100644
--- a/sapi/phpdbg/phpdbg_print.h
+++ b/sapi/phpdbg/phpdbg_print.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
@@ -35,7 +33,7 @@ PHPDBG_PRINT(method);
PHPDBG_PRINT(func);
PHPDBG_PRINT(stack);
-PHPDBG_API void phpdbg_print_opcodes(char *function);
+PHPDBG_API void phpdbg_print_opcodes(const char *function);
extern const phpdbg_command_t phpdbg_print_commands[];
diff --git a/sapi/phpdbg/phpdbg_prompt.c b/sapi/phpdbg/phpdbg_prompt.c
index 24155a7860..39ef7d8768 100644
--- a/sapi/phpdbg/phpdbg_prompt.c
+++ b/sapi/phpdbg/phpdbg_prompt.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
@@ -124,7 +122,6 @@ static inline int phpdbg_call_register(phpdbg_param_t *stack) /* {{{ */
//???fci.symbol_table = zend_rebuild_symbol_table();
fci.object = NULL;
fci.retval = &fretval;
- fci.no_separation = 1;
if (name->next) {
zval params;
@@ -522,12 +519,7 @@ exec_code:
} /* }}} */
int phpdbg_compile_stdin(zend_string *code) {
- zval zv;
-
- ZVAL_STR(&zv, code);
-
- PHPDBG_G(ops) = zend_compile_string(&zv, "Standard input code");
-
+ PHPDBG_G(ops) = zend_compile_string(code, "Standard input code");
zend_string_release(code);
if (EG(exception)) {
@@ -723,22 +715,21 @@ static inline void phpdbg_handle_exception(void) /* {{{ */
zend_object *ex = EG(exception);
zend_string *msg, *file;
zend_long line;
- zval zv, rv, tmp;
+ zval rv, tmp;
EG(exception) = NULL;
- ZVAL_OBJ(&zv, ex);
- zend_call_method_with_0_params(&zv, ex->ce, &ex->ce->__tostring, "__tostring", &tmp);
- file = zval_get_string(zend_read_property(zend_get_exception_base(&zv), &zv, ZEND_STRL("file"), 1, &rv));
- line = zval_get_long(zend_read_property(zend_get_exception_base(&zv), &zv, ZEND_STRL("line"), 1, &rv));
+ zend_call_known_instance_method_with_0_params(ex->ce->__tostring, ex, &tmp);
+ file = zval_get_string(zend_read_property(zend_get_exception_base(ex), ex, ZEND_STRL("file"), 1, &rv));
+ line = zval_get_long(zend_read_property(zend_get_exception_base(ex), ex, ZEND_STRL("line"), 1, &rv));
if (EG(exception)) {
EG(exception) = NULL;
msg = ZSTR_EMPTY_ALLOC();
} else {
- zend_update_property_string(zend_get_exception_base(&zv), &zv, ZEND_STRL("string"), Z_STRVAL(tmp));
+ zend_update_property_string(zend_get_exception_base(ex), ex, ZEND_STRL("string"), Z_STRVAL(tmp));
zval_ptr_dtor(&tmp);
- msg = zval_get_string(zend_read_property(zend_get_exception_base(&zv), &zv, ZEND_STRL("string"), 1, &rv));
+ msg = zval_get_string(zend_read_property(zend_get_exception_base(ex), ex, ZEND_STRL("string"), 1, &rv));
}
phpdbg_error("exception", "name=\"%s\" file=\"%s\" line=\"" ZEND_LONG_FMT "\"", "Uncaught %s in %s on line " ZEND_LONG_FMT, ZSTR_VAL(ex->ce->name), ZSTR_VAL(file), line);
@@ -1230,9 +1221,8 @@ static int add_module_info(zend_module_entry *module) /* {{{ */ {
}
/* }}} */
-static int add_zendext_info(zend_extension *ext) /* {{{ */ {
+static void add_zendext_info(zend_extension *ext) /* {{{ */ {
phpdbg_write("extension", "name=\"%s\"", "%s\n", ext->name);
- return 0;
}
/* }}} */
@@ -1668,7 +1658,6 @@ static inline void list_code() {
zend_clear_exception(); \
list_code(); \
switch (phpdbg_interactive(allow_async_unsafe, NULL)) { \
- zval zv; \
case PHPDBG_LEAVE: \
case PHPDBG_FINISH: \
case PHPDBG_UNTIL: \
@@ -1678,8 +1667,7 @@ static inline void list_code() {
EG(current_execute_data)->opline = backup_opline; \
EG(exception) = exception; \
} else { \
- Z_OBJ(zv) = exception; \
- zend_throw_exception_internal(&zv); \
+ zend_throw_exception_internal(exception); \
} \
EG(opline_before_exception) = before_ex; \
} \
@@ -1710,10 +1698,15 @@ void phpdbg_execute_ex(zend_execute_data *execute_data) /* {{{ */
#ifdef ZEND_WIN32
if (EG(timed_out)) {
- zend_timeout(0);
+ zend_timeout();
}
#endif
+ if (exception && zend_is_unwind_exit(exception)) {
+ /* Restore bailout based exit. */
+ zend_bailout();
+ }
+
if (PHPDBG_G(flags) & PHPDBG_PREVENT_INTERACTIVE) {
phpdbg_print_opline_ex(execute_data, 0);
goto next;
@@ -1722,9 +1715,6 @@ void phpdbg_execute_ex(zend_execute_data *execute_data) /* {{{ */
/* check for uncaught exceptions */
if (exception && PHPDBG_G(handled_exception) != exception && !(PHPDBG_G(flags) & PHPDBG_IN_EVAL)) {
zend_execute_data *prev_ex = execute_data;
- zval zv, rv;
- zend_string *file, *msg;
- zend_long line;
do {
prev_ex = zend_generator_check_placeholder_frame(prev_ex);
@@ -1740,10 +1730,10 @@ void phpdbg_execute_ex(zend_execute_data *execute_data) /* {{{ */
PHPDBG_G(handled_exception) = exception;
- ZVAL_OBJ(&zv, exception);
- file = zval_get_string(zend_read_property(zend_get_exception_base(&zv), &zv, ZEND_STRL("file"), 1, &rv));
- line = zval_get_long(zend_read_property(zend_get_exception_base(&zv), &zv, ZEND_STRL("line"), 1, &rv));
- msg = zval_get_string(zend_read_property(zend_get_exception_base(&zv), &zv, ZEND_STRL("message"), 1, &rv));
+ zval rv;
+ zend_string *file = zval_get_string(zend_read_property(zend_get_exception_base(exception), exception, ZEND_STRL("file"), 1, &rv));
+ zend_long line = zval_get_long(zend_read_property(zend_get_exception_base(exception), exception, ZEND_STRL("line"), 1, &rv));
+ zend_string *msg = zval_get_string(zend_read_property(zend_get_exception_base(exception), exception, ZEND_STRL("message"), 1, &rv));
phpdbg_error("exception",
"name=\"%s\" file=\"%s\" line=\"" ZEND_LONG_FMT "\"",
diff --git a/sapi/phpdbg/phpdbg_prompt.h b/sapi/phpdbg/phpdbg_prompt.h
index 142581783a..2c2c3d2047 100644
--- a/sapi/phpdbg/phpdbg_prompt.h
+++ b/sapi/phpdbg/phpdbg_prompt.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/sapi/phpdbg/phpdbg_rinit_hook.c b/sapi/phpdbg/phpdbg_rinit_hook.c
index 2bc1c59b90..ddbc433669 100644
--- a/sapi/phpdbg/phpdbg_rinit_hook.c
+++ b/sapi/phpdbg/phpdbg_rinit_hook.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
@@ -20,7 +18,7 @@
#include "php_ini.h"
#include <errno.h>
-ZEND_DECLARE_MODULE_GLOBALS(phpdbg_webhelper);
+ZEND_DECLARE_MODULE_GLOBALS(phpdbg_webhelper)
PHP_INI_BEGIN()
STD_PHP_INI_ENTRY("phpdbg.auth", "", PHP_INI_SYSTEM | PHP_INI_PERDIR, OnUpdateString, auth, zend_phpdbg_webhelper_globals, phpdbg_webhelper_globals)
diff --git a/sapi/phpdbg/phpdbg_rinit_hook.h b/sapi/phpdbg/phpdbg_rinit_hook.h
index a350ddec54..58b59d1947 100644
--- a/sapi/phpdbg/phpdbg_rinit_hook.h
+++ b/sapi/phpdbg/phpdbg_rinit_hook.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/sapi/phpdbg/phpdbg_set.c b/sapi/phpdbg/phpdbg_set.c
index da3ec4cf19..e994ee3fa4 100644
--- a/sapi/phpdbg/phpdbg_set.c
+++ b/sapi/phpdbg/phpdbg_set.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/sapi/phpdbg/phpdbg_set.h b/sapi/phpdbg/phpdbg_set.h
index 7f89d9182d..ffc55142ed 100644
--- a/sapi/phpdbg/phpdbg_set.h
+++ b/sapi/phpdbg/phpdbg_set.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/sapi/phpdbg/phpdbg_sigio_win32.c b/sapi/phpdbg/phpdbg_sigio_win32.c
index f3221d09cb..fb3254ac4b 100644
--- a/sapi/phpdbg/phpdbg_sigio_win32.c
+++ b/sapi/phpdbg/phpdbg_sigio_win32.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/sapi/phpdbg/phpdbg_sigio_win32.h b/sapi/phpdbg/phpdbg_sigio_win32.h
index af7b9f10cb..62c7dd606e 100644
--- a/sapi/phpdbg/phpdbg_sigio_win32.h
+++ b/sapi/phpdbg/phpdbg_sigio_win32.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/sapi/phpdbg/phpdbg_utils.c b/sapi/phpdbg/phpdbg_utils.c
index d32f2fb7f8..56fb654909 100644
--- a/sapi/phpdbg/phpdbg_utils.c
+++ b/sapi/phpdbg/phpdbg_utils.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
@@ -41,7 +39,7 @@
ZEND_EXTERN_MODULE_GLOBALS(phpdbg)
/* {{{ color structures */
-const static phpdbg_color_t colors[] = {
+static const phpdbg_color_t colors[] = {
PHPDBG_COLOR_D("none", "0;0"),
PHPDBG_COLOR_D("white", "0;64"),
@@ -72,7 +70,7 @@ const static phpdbg_color_t colors[] = {
}; /* }}} */
/* {{{ */
-const static phpdbg_element_t elements[] = {
+static const phpdbg_element_t elements[] = {
PHPDBG_ELEMENT_D("prompt", PHPDBG_COLOR_PROMPT),
PHPDBG_ELEMENT_D("error", PHPDBG_COLOR_ERROR),
PHPDBG_ELEMENT_D("notice", PHPDBG_COLOR_NOTICE),
@@ -711,7 +709,6 @@ head_done:
ZEND_HASH_FOREACH_KEY_VAL_IND(myht, num, key, val) {
element_dump_func(val, key, num);
} ZEND_HASH_FOREACH_END();
- zend_hash_apply_with_arguments(myht, (apply_func_args_t) element_dump_func, 0);
GC_UNPROTECT_RECURSION(myht);
if (Z_TYPE_P(zv) == IS_OBJECT) {
zend_release_properties(myht);
diff --git a/sapi/phpdbg/phpdbg_utils.h b/sapi/phpdbg/phpdbg_utils.h
index c212056670..508bb89c80 100644
--- a/sapi/phpdbg/phpdbg_utils.h
+++ b/sapi/phpdbg/phpdbg_utils.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/sapi/phpdbg/phpdbg_wait.c b/sapi/phpdbg/phpdbg_wait.c
index 69be24a953..ec78f18db7 100644
--- a/sapi/phpdbg/phpdbg_wait.c
+++ b/sapi/phpdbg/phpdbg_wait.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
@@ -36,7 +34,7 @@ static void phpdbg_rebuild_http_globals_array(int type, const char *name) {
static int phpdbg_dearm_autoglobals(zend_auto_global *auto_global) {
- if (ZSTR_LEN(auto_global->name) != sizeof("GLOBALS") - 1 || memcmp(ZSTR_VAL(auto_global->name), "GLOBALS", sizeof("GLOBALS") - 1)) {
+ if (zend_string_equals_literal(auto_global->name, "GLOBALS")) {
auto_global->armed = 0;
}
@@ -48,14 +46,10 @@ typedef struct {
HashPosition pos[2];
} phpdbg_intersect_ptr;
-static int phpdbg_array_data_compare(const void *a, const void *b) {
- Bucket *f, *s;
+static int phpdbg_array_data_compare(Bucket *f, Bucket *s) {
int result;
zval *first, *second;
- f = *((Bucket **) a);
- s = *((Bucket **) b);
-
first = &f->val;
second = &s->val;
@@ -74,8 +68,8 @@ static void phpdbg_array_intersect_init(phpdbg_intersect_ptr *info, HashTable *h
info->ht[0] = ht1;
info->ht[1] = ht2;
- zend_hash_sort(info->ht[0], (compare_func_t) phpdbg_array_data_compare, 0);
- zend_hash_sort(info->ht[1], (compare_func_t) phpdbg_array_data_compare, 0);
+ zend_hash_sort(info->ht[0], phpdbg_array_data_compare, 0);
+ zend_hash_sort(info->ht[1], phpdbg_array_data_compare, 0);
zend_hash_internal_pointer_reset_ex(info->ht[0], &info->pos[0]);
zend_hash_internal_pointer_reset_ex(info->ht[1], &info->pos[1]);
diff --git a/sapi/phpdbg/phpdbg_wait.h b/sapi/phpdbg/phpdbg_wait.h
index b748e162bb..5d5ea0450c 100644
--- a/sapi/phpdbg/phpdbg_wait.h
+++ b/sapi/phpdbg/phpdbg_wait.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/sapi/phpdbg/phpdbg_watch.c b/sapi/phpdbg/phpdbg_watch.c
index 1dab755171..af8de17096 100644
--- a/sapi/phpdbg/phpdbg_watch.c
+++ b/sapi/phpdbg/phpdbg_watch.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
@@ -144,7 +142,7 @@ zend_bool phpdbg_check_watch_diff(phpdbg_watchtype type, void *oldPtr, void *new
case WATCH_ON_STR:
return memcmp(oldPtr, newPtr, *(size_t *) oldPtr + XtOffsetOf(zend_string, val) - XtOffsetOf(zend_string, len)) != 0;
case WATCH_ON_HASHDATA:
- ZEND_ASSERT(0);
+ ZEND_UNREACHABLE();
}
return 0;
}
@@ -212,7 +210,7 @@ void phpdbg_print_watch_diff(phpdbg_watchtype type, zend_string *name, void *old
break;
case WATCH_ON_HASHDATA:
- ZEND_ASSERT(0);
+ ZEND_UNREACHABLE();
}
phpdbg_xml("</watchdata>");
@@ -1074,7 +1072,7 @@ void phpdbg_reenable_memory_watches(void) {
phpdbg_watchpoint_t *watch;
ZEND_HASH_FOREACH_NUM_KEY(PHPDBG_G(watchlist_mem), page) {
- /* Disble writing again if there are any watchers on that page */
+ /* Disable writing again if there are any watchers on that page */
res = phpdbg_btree_find_closest(&PHPDBG_G(watchpoint_tree), page + phpdbg_pagesize - 1);
if (res) {
watch = res->ptr;
@@ -1251,10 +1249,12 @@ static int phpdbg_watchpoint_parse_wrapper(char *name, size_t namelen, char *key
if (element->child) {
element = element->child;
}
- element->id = PHPDBG_G(watch_elements).nNextFreeElement;
- zend_hash_index_add_ptr(&PHPDBG_G(watch_elements), element->id, element);
- phpdbg_notice("watchadd", "index=\"%d\" variable=\"%.*s\"", "Added%s watchpoint #%d for %.*s", (element->flags & PHPDBG_WATCH_RECURSIVE_ROOT) ? " recursive" : "", element->id, (int) ZSTR_LEN(element->str), ZSTR_VAL(element->str));
+ /* work around missing API for extending an array with a new element, and getting its index */
+ zend_hash_next_index_insert_ptr(&PHPDBG_G(watch_elements), element);
+ element->id = PHPDBG_G(watch_elements).nNextFreeElement - 1;
+
+ phpdbg_notice("watchadd", "index=\"%d\" variable=\"%.*s\"", "Added%s watchpoint #%u for %.*s", (element->flags & PHPDBG_WATCH_RECURSIVE_ROOT) ? " recursive" : "", element->id, (int) ZSTR_LEN(element->str), ZSTR_VAL(element->str));
}
PHPDBG_G(watch_tmp) = NULL;
@@ -1385,11 +1385,11 @@ PHPDBG_WATCH(array) /* {{{ */
void phpdbg_setup_watchpoints(void) {
-#if _SC_PAGE_SIZE
+#if defined(_SC_PAGE_SIZE)
phpdbg_pagesize = sysconf(_SC_PAGE_SIZE);
-#elif _SC_PAGESIZE
+#elif defined(_SC_PAGESIZE)
phpdbg_pagesize = sysconf(_SC_PAGESIZE);
-#elif _SC_NUTC_OS_PAGESIZE
+#elif defined(_SC_NUTC_OS_PAGESIZE)
phpdbg_pagesize = sysconf(_SC_NUTC_OS_PAGESIZE);
#else
phpdbg_pagesize = 4096; /* common pagesize */
diff --git a/sapi/phpdbg/phpdbg_watch.h b/sapi/phpdbg/phpdbg_watch.h
index 9814d78e2e..6782c38d54 100644
--- a/sapi/phpdbg/phpdbg_watch.h
+++ b/sapi/phpdbg/phpdbg_watch.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/sapi/phpdbg/phpdbg_webdata_transfer.c b/sapi/phpdbg/phpdbg_webdata_transfer.c
index 36d327f56f..81f747d69f 100644
--- a/sapi/phpdbg/phpdbg_webdata_transfer.c
+++ b/sapi/phpdbg/phpdbg_webdata_transfer.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
@@ -30,7 +28,7 @@ static int phpdbg_is_auto_global(char *name, int len) {
PHPDBG_API void phpdbg_webdata_compress(char **msg, size_t *len) {
zval array;
HashTable *ht;
- zval zv[9] = {{{0}}};
+ zval zv[9];
array_init(&array);
ht = Z_ARRVAL(array);
diff --git a/sapi/phpdbg/phpdbg_webdata_transfer.h b/sapi/phpdbg/phpdbg_webdata_transfer.h
index c08c6e8f93..e840030eac 100644
--- a/sapi/phpdbg/phpdbg_webdata_transfer.h
+++ b/sapi/phpdbg/phpdbg_webdata_transfer.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/sapi/phpdbg/phpdbg_win.c b/sapi/phpdbg/phpdbg_win.c
index 6bf79981e0..1b1787526f 100644
--- a/sapi/phpdbg/phpdbg_win.c
+++ b/sapi/phpdbg/phpdbg_win.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/sapi/phpdbg/phpdbg_win.h b/sapi/phpdbg/phpdbg_win.h
index ba83062301..44874a50a5 100644
--- a/sapi/phpdbg/phpdbg_win.h
+++ b/sapi/phpdbg/phpdbg_win.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/sapi/phpdbg/tests/bug78297.phpt b/sapi/phpdbg/tests/bug78297.phpt
index 47b13ad605..7fa904b03a 100644
--- a/sapi/phpdbg/tests/bug78297.phpt
+++ b/sapi/phpdbg/tests/bug78297.phpt
@@ -9,8 +9,8 @@ include "does_not_exist.php";
--EXPECTF--
[Successful compilation of %s]
prompt>
-Warning: include(%s): failed to open stream: No such file or directory in %s on line %d
+Warning: include(%s): Failed to open stream: No such file or directory in %s on line %d
Warning: include(): Failed opening 'does_not_exist.php' for inclusion (include_path=%s) in %s on line %d
[Script ended normally]
-prompt>
+prompt>
diff --git a/sapi/phpdbg/tests/exceptions_003.phpt b/sapi/phpdbg/tests/exceptions_003.phpt
index 16920870c3..ee68490df1 100644
--- a/sapi/phpdbg/tests/exceptions_003.phpt
+++ b/sapi/phpdbg/tests/exceptions_003.phpt
@@ -26,7 +26,7 @@ prompt> [L7 %s ECHO<1> "ok\n"
00009: } catch (Error $e) {
prompt> ok
[L7 %s FAST_RET ~%d try-catch(0) %s]
-[L9 %s CATCH<%d> "Error" $e %s]
+[L9 %s CATCH<%d> %s "Error" $e %s]
>00005: x();
00006: } finally {
00007: print "ok\n";
diff --git a/sapi/phpdbg/tests/info_001.phpt b/sapi/phpdbg/tests/info_001.phpt
index 2f38fd36af..2807855709 100644
--- a/sapi/phpdbg/tests/info_001.phpt
+++ b/sapi/phpdbg/tests/info_001.phpt
@@ -48,7 +48,7 @@ prompt> ------------------------------------------------
Function Breakpoints:
#0 foo
prompt> [User-defined constants (0)]
-prompt> [Included files: 0]
+prompt> [Included files: %d]%A
prompt> [No error found!]
prompt> [Literal Constants in foo() (2)]
|-------- C0 -------> [var_dump]
diff --git a/sapi/phpdbg/tests/match_breakpoints_001.phpt b/sapi/phpdbg/tests/match_breakpoints_001.phpt
new file mode 100644
index 0000000000..9ef74179c1
--- /dev/null
+++ b/sapi/phpdbg/tests/match_breakpoints_001.phpt
@@ -0,0 +1,30 @@
+--TEST--
+Test match default breakpoint with variable assignment
+--INI--
+opcache.enable_cli=0
+--PHPDBG--
+b 5
+b 10
+r
+q
+--EXPECTF--
+[Successful compilation of %s.php]
+prompt> [Breakpoint #0 added at %s.php:5]
+prompt> [Breakpoint #1 added at %s.php:10]
+prompt> [Breakpoint #1 at %s.php:10, hits: 1]
+>00010: default => 'bar', // breakpoint #1
+ 00011: };
+ 00012:
+prompt>
+--FILE--
+<?php
+
+$foo = match (0) {
+ 0 => 'foo',
+ default => 'bar', // breakpoint #0
+};
+
+$foo = match (1) {
+ 0 => 'foo',
+ default => 'bar', // breakpoint #1
+};
diff --git a/sapi/phpdbg/tests/match_breakpoints_002.phpt b/sapi/phpdbg/tests/match_breakpoints_002.phpt
new file mode 100644
index 0000000000..21b0b4ef3a
--- /dev/null
+++ b/sapi/phpdbg/tests/match_breakpoints_002.phpt
@@ -0,0 +1,32 @@
+--TEST--
+Test match default breakpoint with property assignment
+--INI--
+opcache.enable_cli=0
+--PHPDBG--
+b 7
+b 12
+r
+q
+--EXPECTF--
+[Successful compilation of %s.php]
+prompt> [Breakpoint #0 added at %s.php:7]
+prompt> [Breakpoint #1 added at %s.php:12]
+prompt> [Breakpoint #1 at %s.php:12, hits: 1]
+>00012: default => 'bar', // breakpoint #1
+ 00013: };
+ 00014:
+prompt>
+--FILE--
+<?php
+
+$foo = new stdClass();
+
+$foo->bar = match (0) {
+ 0 => 'foo',
+ default => 'bar', // breakpoint #0
+};
+
+$foo->bar = match (1) {
+ 0 => 'foo',
+ default => 'bar', // breakpoint #1
+};
diff --git a/sapi/phpdbg/tests/match_breakpoints_003.phpt b/sapi/phpdbg/tests/match_breakpoints_003.phpt
new file mode 100644
index 0000000000..dbd7eb70ab
--- /dev/null
+++ b/sapi/phpdbg/tests/match_breakpoints_003.phpt
@@ -0,0 +1,32 @@
+--TEST--
+Test match default breakpoint with dim assignment
+--INI--
+opcache.enable_cli=0
+--PHPDBG--
+b 7
+b 12
+r
+q
+--EXPECTF--
+[Successful compilation of %s.php]
+prompt> [Breakpoint #0 added at %s.php:7]
+prompt> [Breakpoint #1 added at %s.php:12]
+prompt> [Breakpoint #1 at %s.php:12, hits: 1]
+>00012: default => 'bar', // breakpoint #1
+ 00013: };
+ 00014:
+prompt>
+--FILE--
+<?php
+
+$foo = [];
+
+$foo['foo'] = match (0) {
+ 0 => 'foo',
+ default => 'bar', // breakpoint #0
+};
+
+$foo->bar = match (1) {
+ 0 => 'foo',
+ default => 'bar', // breakpoint #1
+};
diff --git a/sapi/phpdbg/tests/match_breakpoints_004.phpt b/sapi/phpdbg/tests/match_breakpoints_004.phpt
new file mode 100644
index 0000000000..d59555e692
--- /dev/null
+++ b/sapi/phpdbg/tests/match_breakpoints_004.phpt
@@ -0,0 +1,34 @@
+--TEST--
+Test match default breakpoint with static variable assignment
+--INI--
+opcache.enable_cli=0
+--PHPDBG--
+b 9
+b 14
+r
+q
+--EXPECTF--
+[Successful compilation of %s.php]
+prompt> [Breakpoint #0 added at %s.php:9]
+prompt> [Breakpoint #1 added at %s.php:14]
+prompt> [Breakpoint #1 at %s.php:14, hits: 1]
+>00014: default => 'bar', // breakpoint #1
+ 00015: };
+ 00016:
+prompt>
+--FILE--
+<?php
+
+class Foo {
+ public static $bar;
+}
+
+Foo::$bar = match (0) {
+ 0 => 'foo',
+ default => 'bar', // breakpoint #0
+};
+
+Foo::$bar = match (1) {
+ 0 => 'foo',
+ default => 'bar', // breakpoint #1
+};