PHP 8.5 — Rebel house guide¶
The Rebel stack runs PHP 8.5 only. This guide covers 8.5 and nothing older.
The full official change list is in upgrading-8.5.md (php/php-src, branch PHP-8.5).
When a newer PHP becomes the stack, STACK.env changes and this guide is rewritten for it.
Before anything runs on a vhost
- The Plesk handler of the domain is PHP 8.5 — set it before an update, never during.
- In SSH,
phpis the system PHP, not Plesk's. Use the newest Plesk binary:ls -d /opt/plesk/php/*/bin/php | sort -V | tail -1 composer why-not php 8.5in the project lists the blocking packages.php -mwith that binary: a missing extension is a fatal error.
What 8.5 brings (usable now)¶
- Pipe operator
|>:$result = $input |> trim(...) |> strtoupper(...); array_first()/array_last().#[\NoDiscard]: warns when a return value is ignored.clonewith property reassignment (clone($obj, ['prop' => $value])), useful with readonly objects.#[\Deprecated]on constants, and#[\DelayedTargetValidation].
What 8.5 deprecates (fix it in our code)¶
- Non-canonical casts
(boolean),(integer),(double),(binary)→ use(bool),(int),(float),(string). - Ending a
casewith;instead of:. - The backtick operator as an alias of
shell_exec(). nullas an array offset, or inarray_key_exists().curl_close()(no effect anymore — remove the call).__sleep()/__wakeup()are soft-deprecated → use__serialize()/__unserialize().
What 8.5 removes¶
- The
disable_classesINI setting.
The complete and authoritative list is upgrading-8.5.md. If something is not there, it is not a fact.
Porting older code to 8.5¶
Old addons and scripts written for an earlier PHP must be brought to 8.5, not kept on an older handler. Quick greps on an addon before porting (rough, but they catch the usual traps):
grep -rnE '\((boolean|integer|double|binary)\)' src/ # casts deprecated in 8.5
grep -rn 'curl_close' src/ # deprecated in 8.5
grep -rn '`' src/ --include=*.php # backtick shell_exec
grep -rnE 'function .*[a-z] \$[a-zA-Z_]+ = null' src/ # implicit nullable parameter (deprecated since 8.4)
grep -rn '\${[a-zA-Z_]' src/ # ${var} interpolation (deprecated since 8.2)
Dynamic properties ($obj->undeclared = ...) have been deprecated since 8.2: declare the property.
utf8_encode() / utf8_decode() are deprecated since 8.2: use mb_convert_encoding().