Skip to content

Commit 0bf8ecf

Browse files
committed
Merge branch 'PHP-8.1' into PHP-8.2
* PHP-8.1: Fix bug GH-11246 cli/get_set_process_title
2 parents c33589e + c6ae7a5 commit 0bf8ecf

File tree

2 files changed

+11
-8
lines changed

2 files changed

+11
-8
lines changed

NEWS

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@ PHP NEWS
22
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
33
?? ??? ????, PHP 8.2.8
44

5+
- CLI:
6+
. Fixed bug GH-11246 (cli/get_set_process_title fails on MacOS).
7+
(James Lucas)
8+
59
- Core:
610
. Fixed build for the riscv64 architecture/GCC 12. (Daniil Gentili)
711

sapi/cli/ps_title.c

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -169,19 +169,18 @@ 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
*/
175-
for (i = 0; is_contiguous_area && (environ[i] != NULL); i++)
179+
for (i = 0; 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]);
179183
}
180-
end_of_area = environ[i] + strlen(environ[i]);
181-
}
182-
183-
if (!is_contiguous_area) {
184-
goto clobber_error;
185184
}
186185

187186
ps_buffer = argv[0];

0 commit comments

Comments
 (0)