I found and fixed a bug in PHP's standard library
miguelxpn.com
I found and fixed a bug in PHP's standard library
1–10 of 33 posts
Re: I found and fixed a bug in PHP's standard library
#2Re: I found and fixed a bug in PHP's standard library
#3Notably, the bugfix made PHP maintainers realize that the header handler had additional behaviors that they did not understand nor had a rationale for, so those behaviors were removed as well: https://github.com/php/php-src/pull/5201
Re: I found and fixed a bug in PHP's standard library
#4Re: I found and fixed a bug in PHP's standard library
#5Re: I found and fixed a bug in PHP's standard library
#6Notably, the bugfix made PHP maintainers realize that the header handler had additional behaviors that they did not understand nor had a rationale for, so those behaviors were removed as well: https://github.com/php/php-src/pull/5201
Feels like this could be a case where DRY could fix a bug in one place
https://github.com/php/php-src/commit/3d9c02364db62a6d8e2794...
They also fixed the whitespace handling that let something like "RandomHeader: hello host:8080" mistakenly set the flag.
https://github.com/php/php-src/commit/56cdbe63c24b86c2f1d60b...
Re: I found and fixed a bug in PHP's standard library
#7Notably, the bugfix made PHP maintainers realize that the header handler had additional behaviors that they did not understand nor had a rationale for, so those behaviors were removed as well: https://github.com/php/php-src/pull/5201
Feels like this could be a case where DRY could fix a bug in one place
Re: I found and fixed a bug in PHP's standard library
#8Otherwise, it looks like it will call strstr() one extra time, even though you may have already determined that the specific header is present.
Re: I found and fixed a bug in PHP's standard library
#9Looking at lines 460-521 in the modified file ( https://github.com/miguelxpn/php-src/blob/f4b2089b642d504be3... ), is there not a benefit to `break` out of the while loop in the nested if statements? Otherwise, it looks like it will call strstr() one extra time, even though you may have already determined that the specific header is present.
[1] https://github.com/php/php-src/commit/3d9c02364db62a6d8e2794...
Re: I found and fixed a bug in PHP's standard library
#10Looking at lines 460-521 in the modified file ( https://github.com/miguelxpn/php-src/blob/f4b2089b642d504be3... ), is there not a benefit to `break` out of the while loop in the nested if statements? Otherwise, it looks like it will call strstr() one extra time, even though you may have already determined that the specific header is present.
Good catch! That's indeed the case. Another commit was made where that piece of code was refactored into a function and it returns 1 in case the header is present so strstr isn't being called an extra time in the current code. [1] https://github.com/php/php-src/commit/3d9c02364db62a6d8e2794...