8000 Fix bug GH-11246 cli/get_set_process_title initialisation failure on … · lucasnetau/php-src@45a8651 · GitHub
[go: up one dir, main page]

Skip to content

Commit 45a8651

Browse files
committed
Fix bug phpGH-11246 cli/get_set_process_title initialisation failure on MacOS
Patch for PHP >= 8.2 due to commit b468d6f
1 parent 69d41cc commit 45a8651

File tree

2 files changed

+11
-7
lines changed

2 files changed

+11
-7
lines changed

NEWS

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,9 @@ PHP NEWS
1313
. Fixed bug GH-11222 (foreach by-ref may jump over keys during a rehash).
1414
(Bob)
1515

16+
- CLI:
17+
. Fixed bug GH-11246 (cli/get_set_process_title fails on MacOS). (James Lucas)
18+
1619
- Exif:
1720
. Fixed bug GH-10834 (exif_read_data() cannot read smaller stream wrapper
1821
chunk sizes). (nielsdos)

sapi/cli/ps_title.c

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -169,19 +169,20 @@ char** save_ps_args(int argc, char** argv)
169169
end_of_area = argv[i] + strlen(argv[i]);
170170
}
171171

172+
if (!is_contiguous_area) {
173+
goto clobber_error;
174+
}
175+
172176
/*
173177
* check for contiguous environ strings following argv
174178
*/
175179
for (i = 0; is_contiguous_area && (environ[i] != NULL); i++)
176180
{
177-
if (end_of_area + 1 != environ[i]) {
178-
is_contiguous_area = false;
181+
if (end_of_area + 1 == environ[i]) {
182+
end_of_area = environ[i] + strlen(environ[i]);
183+
} else {
184+
is_contiguous_area = false;
179185
}
180-
end_of_area = environ[i] + strlen(environ[i]);
181-
}
182-
183-
if (!is_contiguous_area) {
184-
goto clobber_error;
185186
}
186187

187188
ps_buffer = argv[0];

0 commit comments

Comments
 (0)
0