Problem
PHP PR php/php-src#21679 (merged into php-src master = PHP 8.6) fixes 5 SplFileObject iterator desync bugs (GH-8561 through GH-8564, GH-8851) that existed since PHP 8.0.1. Our AbstractFileObject class has version-specific workarounds for these bugs. When the fix ships, the workarounds will actively break things.
Solution
Add a runtime behavior probe that detects whether the current PHP has the fix, instead of version checks (the fix could be backported to any patch release). When fixed PHP is detected, all methods delegate to parent SplFileObject. Existing workarounds for PHP 7.0-8.5 stay untouched.
References
Problem
PHP PR php/php-src#21679 (merged into php-src master = PHP 8.6) fixes 5 SplFileObject iterator desync bugs (GH-8561 through GH-8564, GH-8851) that existed since PHP 8.0.1. Our
AbstractFileObjectclass has version-specific workarounds for these bugs. When the fix ships, the workarounds will actively break things.Solution
Add a runtime behavior probe that detects whether the current PHP has the fix, instead of version checks (the fix could be backported to any patch release). When fixed PHP is detected, all methods delegate to parent SplFileObject. Existing workarounds for PHP 7.0-8.5 stay untouched.
References