Fix #76954 Use while loop in func add_response_header#3566
Fix #76954 Use while loop in func add_response_header#3566stodorovic wants to merge 3 commits intophp:masterfrom
Conversation
|
Could you add a unit test? |
|
Indeed, the refactoring in 4cba2f9 looks fishy. If Regarding the unit test: I'm not sure if we can use the |
|
Regarding to do ... while, possible solution is: if (NULL != p) {
len = p - h->header + 1;
}
if (len > 0) {
do {
len--;
} while (len != 0 && (h->header[len-1] == ' ' || h->header[len-1] == '\t'));It works fine even if @cmb69 If we use if (NULL != p) {
len = p - h->header;
}
if (len > 0) {
do {
len--;
} while (len != 0 && (h->header[len] == ' ' || h->header[len] == '\t'));
if (len) {
len++; // Include last character.If I've added test and we don't need |
|
@stodorovic Thanks, that sounds plausible. (And yes, I've confused |
|
|
||
| passthru("$php -n -q $filename"); | ||
|
|
||
| @unlink($filename); |
There was a problem hiding this comment.
This should be in a --CLEAN-- section for consistency
|
|
||
| file_put_contents($filename, $code); | ||
|
|
||
| passthru("$php -n -q $filename"); |
There was a problem hiding this comment.
Since this is a full path (from the $filename variable), the $filename should be quoted for escapes in case the full path contains a space
|
Comment on behalf of cmb at php.net: Thanks! Applied via 47b89bc. |
Related issues:
https://bugs.php.net/bug.php?id=76954
https://github.com/Automattic/wp-super-cache/issues/539
PHP 5.6 uses while loop, but PHP 7.x uses do ... while which decreases
lenbefore condition. Parameterlenin functionmemcpyhas decreased length and last character isn't copied.