symfony/polyfill-php85
Symfony Polyfill for PHP 8.5 features on older runtimes. Adds get_error_handler/get_exception_handler, NoDiscard attribute, array_first/array_last, DelayedTargetValidation, Filter exceptions, and locale_is_right_to_left. MIT licensed.
array_first, NoDiscard) remain unchanged.array_first/array_last or validation logic. Test with:
$emojiArray = ['😊', '🚀', '🌍'];
$first = array_first($emojiArray); // Verify grapheme handling
php -r "echo PCRE_VERSION;") to ensure compatibility across environments.array_first on emoji strings).bootstrap/app.php:
if (version_compare(PCRE_VERSION, '10.44') < 0) {
Log::warning('PCRE version too old; grapheme handling may be unreliable.');
}
composer post-update script to warn if PCRE <10.44 is detected:
# composer.json
"scripts": {
"post-update": "php -r \"if (version_compare(PCRE_VERSION, '10.44') < 0) echo 'WARNING: PCRE too old for grapheme fixes\\n';\""
}
UPGRADE.md for teams on shared hosting?array_first/array_last.str_* functions in Illuminate\Support\Str for grapheme reliance.)Illuminate\Support\Collection integration. The fix is irrelevant to Laravel’s core collections.Illuminate\Validation\Validator or filters.Str::of() with non-ASCII strings.# .github/workflows/test.yml
- name: Check PCRE version
run: php -r "echo 'PCRE_VERSION='.PCRE_VERSION;"
php -r "echo PCRE_VERSION;" in staging/production to identify at-risk environments.array_first on emoji arrays) before/after upgrade.POLYFILL_MIGRATION.md with:
array_first/array_last).public function testGraphemeHandling() {
$this->assertEquals('😊', array_first(['😊', '🚀']));
}
preg_split('/\X/u')), replace with polyfilled array_first.| Step | Action | Risk Level | Rollback Plan |
|---|---|---|---|
| 1 | Update symfony/polyfill-php85 to v1.38.0 |
Low | Revert to v1.37.0 |
| 2 | Add PCRE version check script | None | Remove script |
| 3 | Test grapheme functions in staging | Medium | Revert polyfill |
| 4 | Deploy to production | Low | Rollback polyfill + restore workarounds |
Route::get('/health/pcre', function() {
return ['version' => PCRE_VERSION];
});
composer why symfony/polyfill-php85 to monitor usage post-PHP 8.5 upgrade.array_first behaves unexpectedly on emoji, verify PCRE version.README with:
## PCRE Requirements
For correct grapheme handling (e.g., emoji), PCRE ≥10.44 is required.
Check your version with: `php -r "echo PCRE_VERSION;"`
|
How can I help you explore Laravel packages today?