PHP 8.3 requirement — what does it actually break?
Categories:
Magento Upgrade Cost Calculator
Magento 2.4.8+ requires PHP 8.3. The most common breakages I see when teams bump from 8.1/8.2 → 8.3:
- Dynamic property deprecation (PHP 8.2+, error in 8.3). Custom modules that set
$this->something = $fooon a class without declaring the property break. Fix: declare every property explicitly, or use#[\AllowDynamicProperties]as a band-aid. - Implicit nullable parameter types deprecated.
function foo(string $bar = null)now needs?string $bar = null. Common in older custom modules and 2.3-era extensions. - Untyped properties / methods. Several Magento core classes added strict types in 2.4.8; any vendor module overriding them needs matching signatures.
- Removed functions.
utf8_encode()andutf8_decode()are gone (deprecated in 8.2). Usemb_convert_encoding()instead. Old extensions use them everywhere. - Random number generator changes.
mt_srand()behaviour changed. Anything using PHP RNG for security tokens needs review (you should be usingrandom_bytesanyway). - SimpleXML quirks. A few SimpleXML edge cases changed in 8.3. Layout-XML loaders sometimes need patches.
Pre-flight script before upgrade: run vendor/bin/phpcs --standard=PHPCompatibility --runtime-set testVersion 8.3 app/code/ over your custom code and audit every warning.
Was this helpful?