backport PHP bugfix #55504

We didn't look for the end of the boundary correctly.

See:
- https://github.com/php/php-src/commit/994df9f1d1bfd5f6e6b81f32161acc2812d260a7#diff-eb2caada78cc7ed9dbeabe07d25eecf4
- https://bugs.php.net/bug.php?id=55504