diff --git a/NEWS b/NEWS index 3d5888b89622..b906ec51c6fc 100644 --- a/NEWS +++ b/NEWS @@ -13,6 +13,9 @@ PHP NEWS . Fixed bug GH-11222 (foreach by-ref may jump over keys during a rehash). (Bob) +- CLI: + . Fixed bug GH-11246 (cli/get_set_process_title fails on MacOS). (James Lucas) + - Exif: . Fixed bug GH-10834 (exif_read_data() cannot read smaller stream wrapper chunk sizes). (nielsdos) diff --git a/sapi/cli/ps_title.c b/sapi/cli/ps_title.c index 8ff7ef719e17..11ee5919c165 100644 --- a/sapi/cli/ps_title.c +++ b/sapi/cli/ps_title.c @@ -169,19 +169,18 @@ char** save_ps_args(int argc, char** argv) end_of_area = argv[i] + strlen(argv[i]); } + if (!is_contiguous_area) { + goto clobber_error; + } + /* * check for contiguous environ strings following argv */ - for (i = 0; is_contiguous_area && (environ[i] != NULL); i++) + for (i = 0; environ[i] != NULL; i++) { - if (end_of_area + 1 != environ[i]) { - is_contiguous_area = false; + if (end_of_area + 1 == environ[i]) { + end_of_area = environ[i] + strlen(environ[i]); } - end_of_area = environ[i] + strlen(environ[i]); - } - - if (!is_contiguous_area) { - goto clobber_error; } ps_buffer = argv[0];