summaryrefslogtreecommitdiff
path: root/sapi
diff options
context:
space:
mode:
Diffstat (limited to 'sapi')
-rw-r--r--sapi/apache2handler/apache_config.c2
-rw-r--r--sapi/apache2handler/config.m412
-rw-r--r--sapi/apache2handler/config.w326
-rw-r--r--sapi/apache2handler/mod_php.c (renamed from sapi/apache2handler/mod_php7.c)4
-rw-r--r--sapi/apache2handler/php.sym2
-rw-r--r--sapi/apache2handler/php_apache.h6
-rw-r--r--sapi/apache2handler/php_functions.c75
-rw-r--r--sapi/apache2handler/php_functions.stub.php21
-rw-r--r--sapi/apache2handler/php_functions_arginfo.h37
-rw-r--r--sapi/apache2handler/sapi_apache2.c8
-rw-r--r--sapi/cgi/cgi_main.c22
-rw-r--r--sapi/cgi/config9.m42
-rw-r--r--sapi/cgi/tests/003.phpt10
-rw-r--r--sapi/cgi/tests/004.phpt6
-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/bug75574_utf8.phpt2
-rw-r--r--sapi/cgi/tests/include.inc96
-rw-r--r--sapi/cgi/tests/skipif.inc4
-rw-r--r--sapi/cli/cli.h2
-rw-r--r--sapi/cli/config.m42
-rwxr-xr-xsapi/cli/generate_mime_type_map.php2
-rw-r--r--sapi/cli/mime_type_map.h2
-rw-r--r--sapi/cli/php_cli.c13
-rw-r--r--sapi/cli/php_cli_process_title.c6
-rw-r--r--sapi/cli/php_cli_process_title.h2
-rw-r--r--sapi/cli/php_cli_server.c10
-rw-r--r--sapi/cli/php_cli_server.h2
-rw-r--r--sapi/cli/php_http_parser.h2
-rw-r--r--sapi/cli/ps_title.h2
-rw-r--r--sapi/cli/tests/003-2.phpt2
-rw-r--r--sapi/cli/tests/004.phpt5
-rw-r--r--sapi/cli/tests/005.phpt41
-rw-r--r--sapi/cli/tests/006.phpt64
-rw-r--r--sapi/cli/tests/007.phpt10
-rw-r--r--sapi/cli/tests/008.phpt2
-rw-r--r--sapi/cli/tests/010.phpt2
-rw-r--r--sapi/cli/tests/011.phpt6
-rw-r--r--sapi/cli/tests/014.phpt10
-rw-r--r--sapi/cli/tests/016.phpt6
-rw-r--r--sapi/cli/tests/017.phpt6
-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.phpt2
-rw-r--r--sapi/cli/tests/bug43177.phpt54
-rw-r--r--sapi/cli/tests/bug64529.phpt4
-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/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.phpt4
-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/emptyheader.phpt4
-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.phpt80
-rw-r--r--sapi/cli/tests/skipif.inc2
-rw-r--r--sapi/cli/tests/upload_2G.phpt6
-rw-r--r--sapi/embed/php_embed.c2
-rw-r--r--sapi/embed/php_embed.h2
-rw-r--r--sapi/fpm/config.m42
-rw-r--r--sapi/fpm/fpm/events/devpoll.c2
-rw-r--r--sapi/fpm/fpm/events/devpoll.h2
-rw-r--r--sapi/fpm/fpm/events/epoll.c2
-rw-r--r--sapi/fpm/fpm/events/epoll.h2
-rw-r--r--sapi/fpm/fpm/events/kqueue.c2
-rw-r--r--sapi/fpm/fpm/events/kqueue.h2
-rw-r--r--sapi/fpm/fpm/events/poll.c4
-rw-r--r--sapi/fpm/fpm/events/poll.h2
-rw-r--r--sapi/fpm/fpm/events/port.c2
-rw-r--r--sapi/fpm/fpm/events/port.h2
-rw-r--r--sapi/fpm/fpm/events/select.c2
-rw-r--r--sapi/fpm/fpm/events/select.h2
-rw-r--r--sapi/fpm/fpm/fpm_conf.c4
-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.c24
-rw-r--r--sapi/fpm/fpm/fpm_signals.c2
-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/www.conf.in10
-rw-r--r--sapi/fuzzer/Makefile.frag18
-rw-r--r--sapi/fuzzer/README.md66
-rw-r--r--sapi/fuzzer/config.m494
-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/splobjectstorage_negative_count1
-rw-r--r--sapi/fuzzer/dict/parser85
-rw-r--r--sapi/fuzzer/fuzzer-exif.c72
-rw-r--r--sapi/fuzzer/fuzzer-json.c70
-rw-r--r--sapi/fuzzer/fuzzer-mbstring.c76
-rw-r--r--sapi/fuzzer/fuzzer-parser.c55
-rw-r--r--sapi/fuzzer/fuzzer-sapi.c273
-rw-r--r--sapi/fuzzer/fuzzer-sapi.h22
-rw-r--r--sapi/fuzzer/fuzzer-unserialize.c90
-rw-r--r--sapi/fuzzer/fuzzer.h18
-rw-r--r--sapi/fuzzer/generate_parser_corpus.php24
-rw-r--r--sapi/fuzzer/generate_unserialize_dict.php9
-rw-r--r--sapi/fuzzer/json.dict52
-rw-r--r--sapi/litespeed/config.m42
-rw-r--r--sapi/litespeed/lsapi_main.c8
-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.c2
-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.c113
-rw-r--r--sapi/phpdbg/phpdbg.h8
-rw-r--r--sapi/phpdbg/phpdbg.stub.php23
-rw-r--r--sapi/phpdbg/phpdbg_arginfo.h43
-rw-r--r--sapi/phpdbg/phpdbg_bp.c2
-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.c2
-rw-r--r--sapi/phpdbg/phpdbg_cmd.h6
-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.c2
-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.c4
-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.c2
-rw-r--r--sapi/phpdbg/phpdbg_print.h2
-rw-r--r--sapi/phpdbg/phpdbg_prompt.c4
-rw-r--r--sapi/phpdbg/phpdbg_prompt.h2
-rw-r--r--sapi/phpdbg/phpdbg_rinit_hook.c2
-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.c6
-rw-r--r--sapi/phpdbg/phpdbg_utils.h2
-rw-r--r--sapi/phpdbg/phpdbg_wait.c12
-rw-r--r--sapi/phpdbg/phpdbg_wait.h2
-rw-r--r--sapi/phpdbg/phpdbg_watch.c4
-rw-r--r--sapi/phpdbg/phpdbg_watch.h2
-rw-r--r--sapi/phpdbg/phpdbg_webdata_transfer.c2
-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
314 files changed, 1875 insertions, 859 deletions
diff --git a/sapi/apache2handler/apache_config.c b/sapi/apache2handler/apache_config.c
index d0913c250e..b7e0077d2d 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, |
diff --git a/sapi/apache2handler/config.m4 b/sapi/apache2handler/config.m4
index 55c16179b8..67c6d9beea 100644
--- a/sapi/apache2handler/config.m4
+++ b/sapi/apache2handler/config.m4
@@ -67,20 +67,20 @@ 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
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 +95,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..835c5f5c90 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, |
@@ -23,7 +21,7 @@
#include "php.h"
#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..d1aa2d587c 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, |
@@ -45,6 +43,7 @@
#endif
#include "php_apache.h"
+#include "php_functions_arginfo.h"
#ifdef ZTS
int php_apache2_info_id;
@@ -74,7 +73,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 +119,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))) {
@@ -175,7 +174,7 @@ PHP_FUNCTION(apache_request_headers)
char *key, *val;
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
array_init(return_value);
@@ -199,7 +198,7 @@ PHP_FUNCTION(apache_response_headers)
char *key, *val;
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
array_init(return_value);
@@ -224,7 +223,7 @@ PHP_FUNCTION(apache_note)
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;
+ RETURN_THROWS();
}
ctx = SG(server_context);
@@ -258,7 +257,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);
@@ -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);
@@ -477,55 +476,17 @@ 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)
+ PHP_FE(apache_lookup_uri, arginfo_apache_lookup_uri)
+ PHP_FE(virtual, arginfo_virtual)
+ PHP_FE(apache_request_headers, arginfo_apache_request_headers)
+ PHP_FE(apache_response_headers, arginfo_apache_response_headers)
+ PHP_FE(apache_setenv, arginfo_apache_setenv)
+ PHP_FE(apache_getenv, arginfo_apache_getenv)
+ PHP_FE(apache_note, arginfo_apache_note)
+ PHP_FE(apache_get_version, arginfo_apache_get_version)
+ PHP_FE(apache_get_modules, arginfo_apache_get_modules)
+ PHP_FALIAS(getallheaders, apache_request_headers, arginfo_getallheaders)
{NULL, NULL, NULL}
};
diff --git a/sapi/apache2handler/php_functions.stub.php b/sapi/apache2handler/php_functions.stub.php
new file mode 100644
index 0000000000..5b2835ac3a
--- /dev/null
+++ b/sapi/apache2handler/php_functions.stub.php
@@ -0,0 +1,21 @@
+<?php
+
+function apache_lookup_uri(string $filename): object|false {}
+
+function virtual(string $uri): bool {}
+
+function apache_request_headers(): array {}
+
+function getallheaders(): array {}
+
+function apache_response_headers(): array {}
+
+function apache_note(string $note_name, string $note_value = UNKNOWN): 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..f5ac0e4c28
--- /dev/null
+++ b/sapi/apache2handler/php_functions_arginfo.h
@@ -0,0 +1,37 @@
+/* This is a generated file, edit the .stub.php file instead. */
+
+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(0, note_value, IS_STRING, 0)
+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(0, walk_to_top, _IS_BOOL, 0)
+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(0, walk_to_top, _IS_BOOL, 0)
+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
diff --git a/sapi/apache2handler/sapi_apache2.c b/sapi/apache2handler/sapi_apache2.c
index 1cc5670eaa..b2f32ce49a 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, |
@@ -55,7 +53,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;
@@ -551,7 +549,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 +580,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 29c61e9a18..723bffc865 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, |
@@ -240,11 +238,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);
}
@@ -915,9 +910,12 @@ static int sapi_cgi_activate(void)
if (fcgi_is_fastcgi()) {
fcgi_request *request = (fcgi_request*) SG(server_context);
- doc_root = FCGI_GETENV(request, "DOCUMENT_ROOT");
+ /* Prefer CONTEXT_DOCUMENT_ROOT if set */
+ doc_root = FCGI_GETENV(request, "CONTEXT_DOCUMENT_ROOT");
+ doc_root = doc_root ? doc_root : FCGI_GETENV(request, "DOCUMENT_ROOT");
} else {
- doc_root = getenv("DOCUMENT_ROOT");
+ doc_root = getenv("CONTEXT_DOCUMENT_ROOT");
+ doc_root = doc_root ? doc_root : getenv("DOCUMENT_ROOT");
}
/* DOCUMENT_ROOT should also be defined at this stage..but better check it anyway */
if (doc_root) {
@@ -1103,7 +1101,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
@@ -1577,7 +1575,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();
@@ -1589,7 +1587,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()) {
@@ -1702,7 +1700,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);
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..00c59c7278 100644
--- a/sapi/cgi/tests/003.phpt
+++ b/sapi/cgi/tests/003.phpt
@@ -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/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/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..cd9236f116 100644
--- a/sapi/cgi/tests/include.inc
+++ b/sapi/cgi/tests/include.inc
@@ -2,64 +2,64 @@
function get_cgi_path() /* {{{ */
{
- $php = getenv("TEST_PHP_EXECUTABLE");
+ $php = getenv("TEST_PHP_EXECUTABLE");
- $cli = false;
- $cgi = false;
+ $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 (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 ($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 (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;
+ 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;
}
/* }}} */
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..694de0d9e9 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, |
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/generate_mime_type_map.php b/sapi/cli/generate_mime_type_map.php
index 40f546ef83..c4c83679c2 100755
--- a/sapi/cli/generate_mime_type_map.php
+++ b/sapi/cli/generate_mime_type_map.php
@@ -43,8 +43,6 @@ foreach($additional_mime_maps as $ext => $mime) {
?>
/*
+----------------------------------------------------------------------+
- | 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/mime_type_map.h b/sapi/cli/mime_type_map.h
index 0c559d635f..66d62dfa2b 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, |
diff --git a/sapi/cli/php_cli.c b/sapi/cli/php_cli.c
index 1b14b7586b..a5aafcd231 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, |
@@ -175,11 +173,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);
}
@@ -413,7 +408,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);\
@@ -908,7 +903,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");
}
@@ -1073,7 +1068,7 @@ 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_method_with_1_params(Z_OBJ(ref), pce, &pce->constructor, "__construct", NULL, &arg);
if (EG(exception)) {
zval tmp, *msg, rv;
diff --git a/sapi/cli/php_cli_process_title.c b/sapi/cli/php_cli_process_title.c
index 1b82104ca6..4437fdd46b 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, |
@@ -33,7 +31,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);
@@ -55,7 +53,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..74766491d7 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, |
diff --git a/sapi/cli/php_cli_server.c b/sapi/cli/php_cli_server.c
index bd48afb1f7..dd26b5c971 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, |
@@ -263,7 +261,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;
@@ -384,7 +382,7 @@ PHP_FUNCTION(apache_request_headers) /* {{{ */
zval tmp;
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
client = SG(server_context);
@@ -430,7 +428,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);
@@ -2204,8 +2202,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();
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_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/003-2.phpt b/sapi/cli/tests/003-2.phpt
index 6b8957e644..71ef7163be 100644
--- a/sapi/cli/tests/003-2.phpt
+++ b/sapi/cli/tests/003-2.phpt
@@ -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/004.phpt b/sapi/cli/tests/004.phpt
index 78158ba70a..f00f7b4fd9 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(143) "Function [ <internal:standard> function phpinfo ] {
- Parameters [1] {
- Parameter #0 [ <optional> $what ]
+ Parameter #0 [ <optional> int $what ]
}
+ - Return [ bool ]
}
"
diff --git a/sapi/cli/tests/005.phpt b/sapi/cli/tests/005.phpt
index 0a366b6975..ad0ea37c29 100644
--- a/sapi/cli/tests/005.phpt
+++ b/sapi/cli/tests/005.phpt
@@ -37,7 +37,7 @@ string(183) "Class [ <internal:Core> class stdClass ] {
}
"
-string(1607) "Class [ <internal:Core> class Exception implements Throwable ] {
+string(2008) "Class [ <internal:Core> class Exception implements Throwable, Stringable ] {
- Constants [0] {
}
@@ -60,42 +60,73 @@ string(1607) "Class [ <internal:Core> class Exception implements Throwable ] {
- Methods [11] {
Method [ <internal:Core> final private method __clone ] {
+
+ - Parameters [0] {
+ }
}
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 ]
+ Parameter #2 [ <optional> ?Throwable $previous ]
}
}
Method [ <internal:Core> public method __wakeup ] {
+
+ - Parameters [0] {
+ }
}
Method [ <internal:Core, prototype Throwable> final public method getMessage ] {
+
+ - Parameters [0] {
+ }
}
Method [ <internal:Core, prototype Throwable> final public method getCode ] {
+
+ - Parameters [0] {
+ }
}
Method [ <internal:Core, prototype Throwable> final public method getFile ] {
+
+ - Parameters [0] {
+ }
}
Method [ <internal:Core, prototype Throwable> final public method getLine ] {
+
+ - Parameters [0] {
+ }
}
Method [ <internal:Core, prototype Throwable> final public method getTrace ] {
+
+ - Parameters [0] {
+ }
}
Method [ <internal:Core, prototype Throwable> final public method getPrevious ] {
+
+ - Parameters [0] {
+ }
}
Method [ <internal:Core, prototype Throwable> final public method getTraceAsString ] {
+
+ - Parameters [0] {
+ }
}
- 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..f1e3a0a33d 100644
--- a/sapi/cli/tests/006.phpt
+++ b/sapi/cli/tests/006.phpt
@@ -68,22 +68,24 @@ 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 #0 [ <required> string $pattern ]
+ Parameter #1 [ <required> string $subject ]
Parameter #2 [ <optional> &$subpatterns ]
- Parameter #3 [ <optional> $flags ]
- Parameter #4 [ <optional> $offset ]
+ Parameter #3 [ <optional> int $flags ]
+ Parameter #4 [ <optional> int $offset ]
}
+ - Return [ int|false ]
}
Function [ <internal:pcre> function preg_match_all ] {
- Parameters [5] {
- Parameter #0 [ <required> $pattern ]
- Parameter #1 [ <required> $subject ]
+ Parameter #0 [ <required> string $pattern ]
+ Parameter #1 [ <required> string $subject ]
Parameter #2 [ <optional> &$subpatterns ]
- Parameter #3 [ <optional> $flags ]
- Parameter #4 [ <optional> $offset ]
+ Parameter #3 [ <optional> int $flags ]
+ Parameter #4 [ <optional> int $offset ]
}
+ - Return [ int|false|null ]
}
Function [ <internal:pcre> function preg_replace ] {
@@ -91,9 +93,10 @@ string(%d) "Extension [ <persistent> extension #%d pcre version %s ] {
Parameter #0 [ <required> $regex ]
Parameter #1 [ <required> $replace ]
Parameter #2 [ <required> $subject ]
- Parameter #3 [ <optional> $limit ]
+ Parameter #3 [ <optional> int $limit ]
Parameter #4 [ <optional> &$count ]
}
+ - Return [ array|string|null ]
}
Function [ <internal:pcre> function preg_replace_callback ] {
@@ -101,20 +104,22 @@ string(%d) "Extension [ <persistent> extension #%d pcre version %s ] {
Parameter #0 [ <required> $regex ]
Parameter #1 [ <required> $callback ]
Parameter #2 [ <required> $subject ]
- Parameter #3 [ <optional> $limit ]
+ Parameter #3 [ <optional> int $limit ]
Parameter #4 [ <optional> &$count ]
- Parameter #5 [ <optional> $flags ]
+ Parameter #5 [ <optional> int $flags ]
}
+ - Return [ array|string|null ]
}
Function [ <internal:pcre> function preg_replace_callback_array ] {
- Parameters [5] {
- Parameter #0 [ <required> $pattern ]
+ Parameter #0 [ <required> array $pattern ]
Parameter #1 [ <required> $subject ]
- Parameter #2 [ <optional> $limit ]
+ Parameter #2 [ <optional> int $limit ]
Parameter #3 [ <optional> &$count ]
- Parameter #4 [ <optional> $flags ]
+ Parameter #4 [ <optional> int $flags ]
}
+ - Return [ array|string|null ]
}
Function [ <internal:pcre> function preg_filter ] {
@@ -122,38 +127,49 @@ string(%d) "Extension [ <persistent> extension #%d pcre version %s ] {
Parameter #0 [ <required> $regex ]
Parameter #1 [ <required> $replace ]
Parameter #2 [ <required> $subject ]
- Parameter #3 [ <optional> $limit ]
+ Parameter #3 [ <optional> int $limit ]
Parameter #4 [ <optional> &$count ]
}
+ - 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 ]
+ Parameter #3 [ <optional> int $flags ]
}
+ - 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 $delim_char ]
}
+ - 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 $regex ]
+ Parameter #1 [ <required> array $input ]
+ Parameter #2 [ <optional> int $flags ]
}
+ - 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..94ea6fd247 100644
--- a/sapi/cli/tests/007.phpt
+++ b/sapi/cli/tests/007.phpt
@@ -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..c96170d497 100644
--- a/sapi/cli/tests/008.phpt
+++ b/sapi/cli/tests/008.phpt
@@ -17,7 +17,7 @@ $code ='
<?php
class test {
- private $pri;
+ private $pri;
}
var_dump(test::$pri);
diff --git a/sapi/cli/tests/010.phpt b/sapi/cli/tests/010.phpt
index c316e213e3..01b3599136 100644
--- a/sapi/cli/tests/010.phpt
+++ b/sapi/cli/tests/010.phpt
@@ -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/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/016.phpt b/sapi/cli/tests/016.phpt
index ea735d8d6e..bbba579ec2 100644
--- a/sapi/cli/tests/016.phpt
+++ b/sapi/cli/tests/016.phpt
@@ -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..4cc80a4b0a 100644
--- a/sapi/cli/tests/017.phpt
+++ b/sapi/cli/tests/017.phpt
@@ -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/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..986e5f4923 100644
--- a/sapi/cli/tests/argv_mb_bug77111.phpt
+++ b/sapi/cli/tests/argv_mb_bug77111.phpt
@@ -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";
@@ -38,5 +37,4 @@ unlink($out_fl);
?>
--EXPECTF--
string(57) "Ästhetik Æstetik Esthétique Estética ЭÑтетика"
-==DONE==
diff --git a/sapi/cli/tests/bug43177.phpt b/sapi/cli/tests/bug43177.phpt
index 87dc8927ff..f36019ba6b 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,12 +39,12 @@ list($host, $port) = explode(':', PHP_CLI_SERVER_ADDRESS);
$port = intval($port)?:80;
foreach(array("parse", "fatal", "fatal2", "compile") as $url) {
- $fp = fsockopen($host, $port, $errno, $errstr, 0.5);
- if (!$fp) {
- die("connect failed");
- }
+ $fp = fsockopen($host, $port, $errno, $errstr, 0.5);
+ if (!$fp) {
+ die("connect failed");
+ }
- if(fwrite($fp, <<<HEADER
+ if(fwrite($fp, <<<HEADER
GET /$url HTTP/1.1
Host: {$host}
@@ -54,7 +54,7 @@ HEADER
while (!feof($fp)) {
echo fgets($fp);
}
- }
+ }
}
?>
diff --git a/sapi/cli/tests/bug64529.phpt b/sapi/cli/tests/bug64529.phpt
index 7331b8303e..ff3e3029e6 100644
--- a/sapi/cli/tests/bug64529.phpt
+++ b/sapi/cli/tests/bug64529.phpt
@@ -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/bug65066_100.phpt b/sapi/cli/tests/bug65066_100.phpt
index 4203b7444c..0d211c5f83 100644
--- a/sapi/cli/tests/bug65066_100.phpt
+++ b/sapi/cli/tests/bug65066_100.phpt
@@ -26,9 +26,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 e8b497e923..0ecaf6e527 100644
--- a/sapi/cli/tests/bug65066_422.phpt
+++ b/sapi/cli/tests/bug65066_422.phpt
@@ -26,9 +26,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 7e5548aadc..69d4473027 100644
--- a/sapi/cli/tests/bug65066_511.phpt
+++ b/sapi/cli/tests/bug65066_511.phpt
@@ -26,9 +26,9 @@ Host: {$host}
HEADER
)) {
- while (!feof($fp)) {
- echo fgets($fp);
- }
+ while (!feof($fp)) {
+ echo fgets($fp);
+ }
}
?>
--EXPECTF--
diff --git a/sapi/cli/tests/bug66606_2.phpt b/sapi/cli/tests/bug66606_2.phpt
index d8bd6162a4..cba0c76e76 100644
--- a/sapi/cli/tests/bug66606_2.phpt
+++ b/sapi/cli/tests/bug66606_2.phpt
@@ -28,9 +28,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..dbb9a6af40 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.0 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.0 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.0 501 Not Implemented
in %s on line %d
diff --git a/sapi/cli/tests/bug70264.phpt b/sapi/cli/tests/bug70264.phpt
index 877b1194f2..6d4ee15273 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.0 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.0 404 Not Found
in %sbug70264.php on line %d
diff --git a/sapi/cli/tests/bug70470.phpt b/sapi/cli/tests/bug70470.phpt
index 1e05f184b4..0c5fc56591 100644
--- a/sapi/cli/tests/bug70470.phpt
+++ b/sapi/cli/tests/bug70470.phpt
@@ -12,7 +12,7 @@ php_cli_server_start("var_dump(getAllheaders());");
$fp = fsockopen(PHP_CLI_SERVER_HOSTNAME, PHP_CLI_SERVER_PORT, $errno, $errmsg, 0.5);
if (!$fp) {
- die("connect failed: " . $errmsg);
+ die("connect failed: " . $errmsg);
}
fwrite($fp, "GET / HTTP/1.1\r\n");
@@ -26,7 +26,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 6a163d4639..8341f0c94a 100644
--- a/sapi/cli/tests/bug71005.phpt
+++ b/sapi/cli/tests/bug71005.phpt
@@ -30,9 +30,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/emptyheader.phpt b/sapi/cli/tests/emptyheader.phpt
index 9529730e8b..cf6b4cc694 100644
--- a/sapi/cli/tests/emptyheader.phpt
+++ b/sapi/cli/tests/emptyheader.phpt
@@ -12,13 +12,13 @@ php_cli_server_start("var_dump(getAllheaders());");
$fp = fsockopen(PHP_CLI_SERVER_HOSTNAME, PHP_CLI_SERVER_PORT, $errno, $errmsg, 0.5);
if (!$fp) {
- die("connect failed: " . $errmsg);
+ die("connect failed: " . $errmsg);
}
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/php_cli_server.inc b/sapi/cli/tests/php_cli_server.inc
index 679a55eed4..5767e114ca 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 9c93de3f92..0391836829 100644
--- a/sapi/cli/tests/php_cli_server_004.phpt
+++ b/sapi/cli/tests/php_cli_server_004.phpt
@@ -29,9 +29,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 f89245df11..852df3fcb1 100644
--- a/sapi/cli/tests/php_cli_server_005.phpt
+++ b/sapi/cli/tests/php_cli_server_005.phpt
@@ -41,9 +41,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 ee851b0edd..87a6fd85c9 100644
--- a/sapi/cli/tests/php_cli_server_006.phpt
+++ b/sapi/cli/tests/php_cli_server_006.phpt
@@ -25,9 +25,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 3e8fc5f48d..bc32d47845 100644
--- a/sapi/cli/tests/php_cli_server_007.phpt
+++ b/sapi/cli/tests/php_cli_server_007.phpt
@@ -25,9 +25,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 2d9955c031..bd5f4f016a 100644
--- a/sapi/cli/tests/php_cli_server_008.phpt
+++ b/sapi/cli/tests/php_cli_server_008.phpt
@@ -24,9 +24,9 @@ Host: {$host}
HEADER
)) {
- while (!feof($fp)) {
- echo fgets($fp);
- }
+ while (!feof($fp)) {
+ echo fgets($fp);
+ }
}
fclose($fp);
@@ -44,9 +44,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 cb4a14cb08..87a7b2db4a 100644
--- a/sapi/cli/tests/php_cli_server_009.phpt
+++ b/sapi/cli/tests/php_cli_server_009.phpt
@@ -27,9 +27,9 @@ Host: {$host}
HEADER
)) {
- while (!feof($fp)) {
- echo fgets($fp);
- }
+ while (!feof($fp)) {
+ echo fgets($fp);
+ }
}
fclose($fp);
@@ -47,9 +47,9 @@ Host: {$host}
HEADER
)) {
- while (!feof($fp)) {
- echo fgets($fp);
- }
+ while (!feof($fp)) {
+ echo fgets($fp);
+ }
}
fclose($fp);
@@ -67,10 +67,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 22cf3de344..d0cf52a082 100644
--- a/sapi/cli/tests/php_cli_server_010.phpt
+++ b/sapi/cli/tests/php_cli_server_010.phpt
@@ -24,9 +24,9 @@ Host: {$host}
HEADER
)) {
- while (!feof($fp)) {
- echo fgets($fp);
- }
+ while (!feof($fp)) {
+ echo fgets($fp);
+ }
}
fclose($fp);
@@ -44,9 +44,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 d60d71b02a..55ecf38146 100644
--- a/sapi/cli/tests/php_cli_server_012.phpt
+++ b/sapi/cli/tests/php_cli_server_012.phpt
@@ -28,9 +28,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 ec8957c8d1..9587bf0687 100644
--- a/sapi/cli/tests/php_cli_server_013.phpt
+++ b/sapi/cli/tests/php_cli_server_013.phpt
@@ -28,9 +28,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";
@@ -50,9 +50,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";
@@ -71,9 +71,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 11db82ce90..8a244009e1 100644
--- a/sapi/cli/tests/php_cli_server_014.phpt
+++ b/sapi/cli/tests/php_cli_server_014.phpt
@@ -33,9 +33,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);
@@ -52,9 +52,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 990a3db97e..b9e4589f87 100644
--- a/sapi/cli/tests/php_cli_server_015.phpt
+++ b/sapi/cli/tests/php_cli_server_015.phpt
@@ -30,9 +30,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 ae1d3f272a..269eea66d8 100644
--- a/sapi/cli/tests/php_cli_server_016.phpt
+++ b/sapi/cli/tests/php_cli_server_016.phpt
@@ -34,10 +34,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 067d504800..6a36ec62d1 100644
--- a/sapi/cli/tests/php_cli_server_017.phpt
+++ b/sapi/cli/tests/php_cli_server_017.phpt
@@ -27,9 +27,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 23a8bc40e1..ea4f3f9eff 100644
--- a/sapi/cli/tests/php_cli_server_020.phpt
+++ b/sapi/cli/tests/php_cli_server_020.phpt
@@ -24,9 +24,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 9028b6902b..c09e04b5a1 100644
--- a/sapi/cli/tests/sapi_windows_set_ctrl_handler.phpt
+++ b/sapi/cli/tests/sapi_windows_set_ctrl_handler.phpt
@@ -15,63 +15,63 @@ $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";
- } else {
- echo "Child $child_pid exit with status ", $status["exitcode"], " after ${total}us\n";
- }
+ $status = proc_get_status($proc);
+ if ($status["running"]) {
+ echo "Child $child_pid didn't exit after ${max}us\n";
+ } else {
+ echo "Child $child_pid exit with status ", $status["exitcode"], " after ${total}us\n";
+ }
- proc_close($proc);
+ proc_close($proc);
}
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 82bbbca481..5012d05bc4 100644
--- a/sapi/cli/tests/upload_2G.phpt
+++ b/sapi/cli/tests/upload_2G.phpt
@@ -44,7 +44,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"]);
list($host, $port) = explode(':', PHP_CLI_SERVER_ADDRESS);
$port = intval($port)?:80;
@@ -74,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/php_embed.c b/sapi/embed/php_embed.c
index 4c7dec6dd0..1713534a23 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, |
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..f71fa710dd 100644
--- a/sapi/fpm/config.m4
+++ b/sapi/fpm/config.m4
@@ -660,7 +660,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..15afb2beda 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, |
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..b81c7fa59c 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, |
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..42d70ecd6c 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, |
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..ad18d0bdea 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, |
@@ -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..7887c8e61a 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, |
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..23a5bb6d28 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, |
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_conf.c b/sapi/fpm/fpm/fpm_conf.c
index 7a05286309..116b07fdff 100644
--- a/sapi/fpm/fpm/fpm_conf.c
+++ b/sapi/fpm/fpm/fpm_conf.c
@@ -899,7 +899,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 +1538,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;
}
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 b4daa4e4ca..00102e6112 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, |
@@ -186,11 +184,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);
}
@@ -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);
@@ -736,7 +731,10 @@ static int sapi_cgi_activate(void) /* {{{ */
/* Load and activate user ini files in path starting from DOCUMENT_ROOT */
if (PG(user_ini_filename) && *PG(user_ini_filename)) {
- doc_root = FCGI_GETENV(request, "DOCUMENT_ROOT");
+ /* Prefer CONTEXT_DOCUMENT_ROOT if set */
+ doc_root = FCGI_GETENV(request, "CONTEXT_DOCUMENT_ROOT");
+ doc_root = doc_root ? doc_root : FCGI_GETENV(request, "DOCUMENT_ROOT");
+
/* DOCUMENT_ROOT should also be defined at this stage..but better check it anyway */
if (doc_root) {
doc_root_len = strlen(doc_root);
@@ -893,7 +891,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
@@ -1468,7 +1466,7 @@ 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)) {
@@ -1490,7 +1488,7 @@ PHP_FUNCTION(apache_request_headers) /* {{{ */
fcgi_request *request;
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
array_init(return_value);
@@ -1504,7 +1502,7 @@ PHP_FUNCTION(apache_request_headers) /* {{{ */
PHP_FUNCTION(fpm_get_status) /* {{{ */
{
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
if (fpm_status_export_to_zval(return_value)) {
@@ -1912,7 +1910,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_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/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 54f85bcfb6..d6ee6c7afb 100644
--- a/sapi/fpm/tests/response.inc
+++ b/sapi/fpm/tests/response.inc
@@ -174,7 +174,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/www.conf.in b/sapi/fpm/www.conf.in
index 169d19568c..815618c65d 100644
--- a/sapi/fpm/www.conf.in
+++ b/sapi/fpm/www.conf.in
@@ -70,7 +70,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
@@ -139,7 +139,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;
@@ -269,13 +269,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
@@ -374,7 +374,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..57952a8ff4
--- /dev/null
+++ b/sapi/fuzzer/Makefile.frag
@@ -0,0 +1,18 @@
+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-unserialize: $(PHP_GLOBAL_OBJS) $(PHP_SAPI_OBJS) $(PHP_FUZZER_UNSERIALIZE_OBJS)
+ $(FUZZER_BUILD) $(PHP_FUZZER_UNSERIALIZE_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..c753c23c30
--- /dev/null
+++ b/sapi/fuzzer/README.md
@@ -0,0 +1,66 @@
+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
+./configure \
+ --enable-fuzzer \
+ --with-pic \
+ --enable-debug-assertions \
+ --enable-exif \
+ --enable-json \
+ --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-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)
+
+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 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..37945b8e9e
--- /dev/null
+++ b/sapi/fuzzer/config.m4
@@ -0,0 +1,94 @@
+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([unserialize], PHP_FUZZER_UNSERIALIZE_OBJS)
+
+ dnl json extension is enabled by default
+ if (test -n "$enable_json" && test "$enable_json" != "no") || test -z "$PHP_ENABLE_ALL"; then
+ PHP_FUZZER_TARGET([json], PHP_FUZZER_JSON_OBJS)
+ fi
+ 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/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-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..45ec78ae4c
--- /dev/null
+++ b/sapi/fuzzer/fuzzer-json.c
@@ -0,0 +1,70 @@
+/*
+ +----------------------------------------------------------------------+
+ | 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"
+
+#ifdef HAVE_JSON
+#include "ext/json/php_json_parser.h"
+#endif
+
+int LLVMFuzzerTestOneInput(const uint8_t *Data, size_t Size) {
+#ifdef HAVE_JSON
+ 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);
+#else
+ fprintf(stderr, "\n\nERROR:\nPHP built without JSON, recompile with --enable-json to use this fuzzer\n");
+ exit(1);
+#endif
+ 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..9c00761ad0
--- /dev/null
+++ b/sapi/fuzzer/fuzzer-mbstring.c
@@ -0,0 +1,76 @@
+/*
+ +----------------------------------------------------------------------+
+ | 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;
+ }
+
+ 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);
+
+ php_request_shutdown(NULL);
+
+ 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..19f685f967
--- /dev/null
+++ b/sapi/fuzzer/fuzzer-parser.c
@@ -0,0 +1,55 @@
+/*
+ +----------------------------------------------------------------------+
+ | 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) {
+ char *s;
+ 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;
+ }
+
+ s = malloc(Size+1);
+ memcpy(s, Data, Size);
+ s[Size] = '\0';
+
+ fuzzer_do_request_from_buffer("fuzzer.php", s, Size);
+
+ /* Do not free s: fuzzer_do_request_from_buffer() takes ownership of the allocation. */
+ 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..eb452788b1
--- /dev/null
+++ b/sapi/fuzzer/fuzzer-sapi.c
@@ -0,0 +1,273 @@
+/*
+ +----------------------------------------------------------------------+
+ | 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>
+
+#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"
+ /* Reduce oniguruma limits to speed up fuzzing */
+ "mbstring.regex_stack_limit=10000\n"
+ "mbstring.regex_retry_limit=10000";
+
+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(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_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(zend_file_handle *file_handle, char *filename)
+{
+ 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;
+ }
+
+ SG(headers_sent) = 1;
+ SG(request_info).no_headers = 1;
+ php_register_variable("PHP_SELF", filename, NULL);
+
+ zend_first_try {
+ zend_op_array *op_array = zend_compile_file(file_handle, ZEND_REQUIRE);
+ if (op_array) {
+ destroy_op_array(op_array);
+ efree(op_array);
+ }
+ if (EG(exception)) {
+ zend_object_release(EG(exception));
+ EG(exception) = NULL;
+ }
+ /*retval = php_execute_script(file_handle);*/
+ } zend_end_try();
+
+ php_request_shutdown((void *) 0);
+
+ return (retval == SUCCESS) ? SUCCESS : FAILURE;
+}
+
+
+int fuzzer_do_request_f(char *filename)
+{
+ zend_file_handle file_handle;
+ file_handle.type = ZEND_HANDLE_FILENAME;
+ file_handle.filename = filename;
+ file_handle.handle.fp = NULL;
+ file_handle.opened_path = NULL;
+
+ return fuzzer_do_request(&file_handle, filename);
+}
+
+int fuzzer_do_request_from_buffer(char *filename, char *data, size_t data_len)
+{
+ zend_file_handle file_handle;
+ file_handle.filename = filename;
+ file_handle.free_filename = 0;
+ file_handle.opened_path = NULL;
+ file_handle.handle.stream.handle = NULL;
+ file_handle.handle.stream.reader = (zend_stream_reader_t)_php_stream_read;
+ file_handle.handle.stream.fsizer = NULL;
+ file_handle.handle.stream.isatty = 0;
+ file_handle.handle.stream.closer = NULL;
+ file_handle.buf = data;
+ file_handle.len = data_len;
+ file_handle.type = ZEND_HANDLE_STREAM;
+
+ return fuzzer_do_request(&file_handle, filename);
+}
+
+// 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..495ca32c3d
--- /dev/null
+++ b/sapi/fuzzer/fuzzer-sapi.h
@@ -0,0 +1,22 @@
+/*
+ +----------------------------------------------------------------------+
+ | 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();
+int fuzzer_request_startup();
+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, char *data, size_t data_len);
diff --git a/sapi/fuzzer/fuzzer-unserialize.c b/sapi/fuzzer/fuzzer-unserialize.c
new file mode 100644
index 0000000000..4b65197df9
--- /dev/null
+++ b/sapi/fuzzer/fuzzer-unserialize.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: 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);
+ zend_execute_data execute_data;
+ zend_function func;
+
+ memcpy(orig_data, Data, Size);
+ orig_data[Size] = '\0';
+
+ if (fuzzer_request_startup()==FAILURE) {
+ return 0;
+ }
+
+ /* Set up a dummy stack frame so that exceptions may be thrown. */
+ {
+ 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;
+ }
+
+ {
+ 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);
+
+ /* Destroy any thrown exception. */
+ if (EG(exception)) {
+ zend_object_release(EG(exception));
+ EG(exception) = NULL;
+ }
+ }
+
+ /* Unserialize may create circular structure. Make sure we free them.
+ * Two calls are performed to handle objects with destructors. */
+ zend_gc_collect_cycles();
+ zend_gc_collect_cycles();
+ php_request_shutdown(NULL);
+
+ free(orig_data);
+
+ 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_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/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 772b642173..186558a325 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, |
@@ -108,7 +106,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);\
@@ -806,7 +804,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)
{
@@ -1657,7 +1655,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 );
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 c0c486cb15..6cf4cddb9c 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 76f936700d..2542fc8314 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..f9659b332a 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, |
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 8b01acdfe2..9e173d40d8 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,7 @@
#include "phpdbg_eol.h"
#include "phpdbg_print.h"
#include "phpdbg_help.h"
+#include "phpdbg_arginfo.h"
#include "ext/standard/basic_functions.h"
@@ -297,7 +296,7 @@ static PHP_FUNCTION(phpdbg_exec)
zend_string *exec;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "S", &exec) == FAILURE) {
- return;
+ RETURN_THROWS();
}
{
@@ -334,13 +333,18 @@ static PHP_FUNCTION(phpdbg_exec)
instructs phpdbg to insert a breakpoint at the next opcode */
static 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;
}
@@ -355,7 +359,7 @@ static PHP_FUNCTION(phpdbg_break_file)
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);
@@ -364,11 +368,11 @@ static PHP_FUNCTION(phpdbg_break_file)
/* {{{ proto void phpdbg_break_method(string class, string method) */
static 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);
@@ -377,11 +381,11 @@ static PHP_FUNCTION(phpdbg_break_method)
/* {{{ proto void phpdbg_break_function(string function) */
static 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);
@@ -391,6 +395,10 @@ static PHP_FUNCTION(phpdbg_break_function)
instructs phpdbg to clear breakpoints */
static 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]);
@@ -410,7 +418,7 @@ static PHP_FUNCTION(phpdbg_color)
size_t color_len;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "ls", &element, &color, &color_len) == FAILURE) {
- return;
+ RETURN_THROWS();
}
switch (element) {
@@ -420,7 +428,8 @@ 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_value_error("phpdbg detected an incorrect color constant");
}
} /* }}} */
@@ -431,7 +440,7 @@ static PHP_FUNCTION(phpdbg_prompt)
size_t prompt_len = 0;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "s", &prompt, &prompt_len) == FAILURE) {
- return;
+ RETURN_THROWS();
}
phpdbg_set_prompt(prompt);
@@ -443,7 +452,7 @@ static PHP_FUNCTION(phpdbg_start_oplog)
phpdbg_oplog_list *prev;
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
prev = PHPDBG_G(oplog_list);
@@ -530,7 +539,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")))) {
@@ -624,7 +633,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,62 +724,18 @@ 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)
+ PHP_FE(phpdbg_clear, arginfo_phpdbg_clear)
+ PHP_FE(phpdbg_break_next, arginfo_phpdbg_break_next)
+ PHP_FE(phpdbg_break_file, arginfo_phpdbg_break_file)
+ PHP_FE(phpdbg_break_method, arginfo_phpdbg_break_method)
+ PHP_FE(phpdbg_break_function, arginfo_phpdbg_break_function)
+ PHP_FE(phpdbg_exec, arginfo_phpdbg_exec)
+ PHP_FE(phpdbg_color, arginfo_phpdbg_color)
+ PHP_FE(phpdbg_prompt, arginfo_phpdbg_prompt)
+ PHP_FE(phpdbg_start_oplog, arginfo_phpdbg_start_oplog)
+ PHP_FE(phpdbg_end_oplog, arginfo_phpdbg_end_oplog)
+ PHP_FE(phpdbg_get_executable, arginfo_phpdbg_get_executable)
#ifdef PHP_FE_END
PHP_FE_END
#else
@@ -1108,7 +1073,7 @@ const char phpdbg_ini_hardcoded[] =
"error_log=\n"
"output_buffering=off\n\0";
-/* overwriteable ini defaults must be set in phpdbg_ini_defaults() */
+/* overwritable 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);
@@ -2023,7 +1988,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 */
diff --git a/sapi/phpdbg/phpdbg.h b/sapi/phpdbg/phpdbg.h
index d0e316c78b..5405155833 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)(zval *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..bcccc5f9d0
--- /dev/null
+++ b/sapi/phpdbg/phpdbg.stub.php
@@ -0,0 +1,23 @@
+<?php
+
+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..e130ebd33f
--- /dev/null
+++ b/sapi/phpdbg/phpdbg_arginfo.h
@@ -0,0 +1,43 @@
+/* This is a generated file, edit the .stub.php file instead. */
+
+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(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(0, options, IS_ARRAY, 0)
+ZEND_END_ARG_INFO()
diff --git a/sapi/phpdbg/phpdbg_bp.c b/sapi/phpdbg/phpdbg_bp.c
index 738967f907..e6b7c10225 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, |
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 b736481089..b7578e3a86 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, |
diff --git a/sapi/phpdbg/phpdbg_cmd.h b/sapi/phpdbg/phpdbg_cmd.h
index b82ed9aceb..dd80e61db3 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*);
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..b576187c7a 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, |
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..5c1b950bf6 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, |
@@ -319,7 +317,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(zval *source_string, const char *filename) {
zend_string *fake_name;
zend_op_array *op_array;
phpdbg_file_source *dataptr;
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 3031ce5a80..f776586810 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"
@@ -65,7 +65,7 @@ typedef void* yyscan_t;
input
: command { $$ = $1; }
| input T_SEPARATOR command { phpdbg_stack_separate($1.top); $$ = $3; }
- | /* empty */
+ | %empty
;
command
@@ -143,7 +143,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..7cc84b72dc 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, |
diff --git a/sapi/phpdbg/phpdbg_print.h b/sapi/phpdbg/phpdbg_print.h
index 66eae7bceb..79a77ad2a6 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, |
diff --git a/sapi/phpdbg/phpdbg_prompt.c b/sapi/phpdbg/phpdbg_prompt.c
index 24155a7860..a441d4d6ae 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, |
@@ -728,7 +726,7 @@ static inline void phpdbg_handle_exception(void) /* {{{ */
EG(exception) = NULL;
ZVAL_OBJ(&zv, ex);
- zend_call_method_with_0_params(&zv, ex->ce, &ex->ce->__tostring, "__tostring", &tmp);
+ zend_call_method_with_0_params(ex, 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));
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..92013f5499 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, |
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 857b5e3311..1efad03a79 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),
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..db493ccf30 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, |
@@ -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 d9f9f8673f..69dff94eb6 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, |
@@ -1073,7 +1071,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;
diff --git a/sapi/phpdbg/phpdbg_watch.h b/sapi/phpdbg/phpdbg_watch.h
index 313df624ea..f7b3fddcc2 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..85e4c25a61 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, |
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>