Welcome to PHP Changed Behaviors’s documentation!¶
- Per PHP version
- PHP Changed Behavior
- Accessing Trait Resources Directly Is Not Allowed
- Anonymous Class Name Includes Extends
- array_key_exists() doesn’t work on objects
- Negative Automatic Index From Empty Array
- Automatic Index In Non Empty Array
- Array Usage With String Initialisation
- array_product() New Checks
- array_sum() Checks Operands More Thoroughly
- assert() Throws Exception
- Backed Enum Values Needed To Compile
- Bitshift And Concat Precedence
- Boolean Used As Array
- Calling Non-Static Method Statically
- Accessing Directly Properties In Trait
- Cannot Call Traits Methods Directly
- Catch Without Variable
- ceil() Strict Mode
- class_alias() Works On Internal Classes
- ::class On Object
- Can Clone Readonly Properties
- compact() Throws Notice On Missing Variable
- Interface Imported Constant Visibility Is Checked
- Constants In Trait
- Parameter Contravariance
- count() Must Count Countable
- Returntype Covariance
- cUrl Moved Away From Resource
- Array Syntax With Curly Braces Are No More
- datetime With Multiple Signs
- Die And Exit As Functions
- Dot And Bitshift Priority
- Dot And Minus Changed Precedence
- Dot And Plus Changed Precedence
- Duplicate Static Definition
- Dynamic Class Constant
- No Dynamic Properties By Default
- E_STRICT Is Deprecated
- Enforcing Native PHP ReturnType
- explode() Forbids Empty Strings
- Cannot Explode() Null
- file_get_contents() Needs A Real Path
- FilessytemIterator Skips Dot Files
- Final Class Constants
- Final Method In Trait
- Finfo Moved Away From Resource
- Float Used As Array
- get_called_class() Cannot Be Called Outside A Class
- get_class() Needs An Argument
- $GLOBALS Assignement
- Heredoc Syntax In An Array
- Default Values With htmlspecialchars()
- Implicit Array Key Conversion
- Implicit Nullable
- implode() Arguments Order
- in_array() String Int Comparisons
- in_array() Doesn’t Confuse 0 And Empty String
- Increment On Boolean Is Deprecated
- Inegality Comparisons
- Init Readonly Properties In Child
- instanceof Expect Objects
- Integer Used As Array
- Interface Constant Visibility Checks
- Interpolated String Dereferencing
- Calling Static Methods On Strings
- Integer Non-silent Conversion
- Base Conversion Reports Invalid Characters
- iterator_count() Also Count Arrays
- jsonSerialize Must Have Return Type
- Keywords In Namespace
- krsort() Places Integers Before Strings In Keys
- ksort() now uses regular sorting
- ksort() Now Places Integers Before Strings
- Duplicate Enum Cases Are Not Linted Anymore
- Covariance And Contravariance Are Fatal
- match Is Now A Keyword
- No Max() On Empty Array
- max() Must Contain At Least One Element
- max() On String And Integer
- No min() On Empty Array
- min() Doesn’t Accept Empty Arrays
- mixed Is Now A Keyword
- Nested Attributes
- newver Is Now A Keyword
- New Cases In Switch
- Call Method On New
- __sleep() Method Enforces Return Type
- Non Static Method Called Statically
- No Reference To $GLOBALS Variable
- Null Used As Array
- Old Style Constructors
- Orphaned Parent
- $php_errormsg has been removed
- Plus And Concat Precedence
- range() Lists Everything Between Strings
- range() With Int And String
- (real) Is Replaced By (float)
- Relative Callable In Strings
- Relaxed Naming With Class Constant
- Return Reference On Void
- PHP native return types are now enforced
- round() Mode Validation
- __set_state() Method Must Be Static
- setlocale() Does Not Affect Echo Anymore
- sort() Places Integers Before Strings
- Sorting Closure Must Return Integers
- Spaces In Namespaces
- spaceship Operator Results
- SplFixedArray Is Now An IteratorAggregate
- static Cannot Be Used Anymore In Callable Arrays
- Static Variables Are Linked To Their Method
- Storage Of Static Properties Trait
- Static Variable Accepts Functioncalls As Default
- str_pos() Requires Only Strings
- str_replace() Checks For Arguments
- str_replace() On Arrays Of Objects
- str_replace() Enforces Strings In Array Argument
- String To Integer Comparison
- Strings Are Bigger Than Integer
- strpos() With Out-Of-Range Offset Is A Fatal Error
- strpos() Emits TypeError
- strpos() Emits ValueError
- strpos() Does Not Accept False
- strpos() With Integer Argument
- strpos() Does Not Accept Null As Second Parameter
- strpos() With Null Haystack
- strsplit() With Empty String
- str_split() Throws ValueError With Negative Lengths
- substr() Returns Empty String On Out Of Bond Offset
- switch() Changed Comparison Style
- Tentative Static Returntype With Datetime
- Ternary Associativity
- throw Is An Expression
- Trailing Comma In Arguments
- Trailing Comma In Calls
- Constants In Traits
- Typed Class Constant
- Undefined Constants
- Unpack Arrays In Arrays
- Unpack Array With String Keys
- unserialize() Checks The End Of The String
- unserialize() max_depth Option
- unserialize() Error Report
- (unset) Was Removed
- var_export() Format
- var_export() With Stdclass
- version_compare() Stricter Operators
- vsprint() Requires An Array
- vsprintf() Returns Empty String On Error
- Yield Must Use Integer Or String Keys
- Cannot Raise Zero To Negative Powers
- PHP Error Messages