Error map
scalar value as an array PHP Fatal error: Uncaught Error: Cannot use a scalar value as an array
PHP · layer 4, Application & API
Centre: this error. First ring: errors it is linked with (11). Outer ring: what those are linked with. Colours show the layer of a request each error belongs to. Click any dot to re-centre the map on it; hover to follow its connections. The centre dot opens the error page.
Directly related (11)
Warning: Undefined array key / Undefined index
Your code reads an array key that doesn’t exist — common with `$_GET`, `$_POST` and decoded JSON.
Deprecated: Implicit conversion from float 2.5 to int loses precision
PHP 8.1+ warns when a float with a fractional part is silently converted to int (array keys, % operator, int parameters).
Fatal error: Uncaught TypeError: foo(): Argument #1 ($x) must be of type int, string given
A function received a value of the wrong type for a typed parameter.
Warning: Undefined variable $x
PHP read a variable that was never assigned in the current scope.
Fatal error: Uncaught TypeError: Unsupported operand types: string + int
An arithmetic or array operator was used with incompatible types (PHP 8 is stricter than PHP 7).
Warning: Array to string conversion
An array was used where a string is expected — echoing it, concatenating it, or passing it to a string function.
Fatal error: Uncaught Error: Cannot use object of type stdClass as array
Code used array syntax (`$x['key']`) on an object.
Warning: Trying to access array offset on value of type null
Code used `$x['key']` where `$x` is null — usually a lookup or function that returned nothing.
Laravel/PHP: TypeError: App\Services\Mailer::send(): Argument #1 ($user) must be of type App\Models\User, null given
A function received a value of the wrong type — often `null` where an object was required.
Laravel/PHP 8: ErrorException: Undefined array key "name" (PHP 8) / Undefined index: name (PHP 7)
Code read an array element whose key isn't present.
PHP Warning: Illegal string offset 'x' / TypeError: Cannot access offset of type string on string
A string was accessed like an array with a non-numeric key.
Two steps away (30)
TypeError: Cannot read properties of undefined (reading 'x')
You tried to access a property on a value that is `undefined` (or `null`) — usually data that hasn’t loaded yet or a wrong proper…
Warning: Cannot modify header information - headers already sent
You called `header()`, `setcookie()` or `session_start()` after output had already been sent to the browser.
KeyError: 'x'
You accessed a dictionary key that doesn’t exist.
java.lang.ClassCastException: class A cannot be cast to class B
An object was cast to a type it isn’t.
DeprecationWarning: Buffer() is deprecated due to security and usability issues (DEP0005)
Code (yours or a dependency) uses the deprecated new Buffer() constructor.
Deprecated: strlen(): Passing null to parameter #1 ($string) of type string is deprecated
PHP 8.1+ warns when null is passed to a built-in function that expects a string/int.
PHP Fatal error: Allowed memory size of X bytes exhausted
The script tried to use more memory than PHP’s `memory_limit` allows.
PHP Fatal error: Uncaught Error: Call to undefined function
PHP can’t find the function you called — usually a missing extension, missing include, or namespace issue.
Fatal error: Cannot redeclare function foo() (previously declared in …)
The same function (or class) was defined twice — usually a file included more than once.
TypeError: Cannot set properties of undefined (setting 'x')
Code assigned a property on a value that is undefined (or null).
TypeError: Cannot convert undefined or null to object
Object.keys/entries/assign was called with undefined or null.
TypeError: Cannot read properties of undefined (reading 'length')
Code checked .length on something that is undefined — typically an array or string that hasn’t loaded.
Deprecated: Creation of dynamic property Foo::$bar is deprecated
PHP 8.2+ deprecates creating properties that aren’t declared in the class.
System.InvalidCastException: Unable to cast object of type 'X' to type 'Y'
An explicit cast failed because the object’s runtime type isn’t the target type.
Swift: Cannot convert value of type 'X' to expected argument type 'Y'
The value’s type doesn’t match what the function or property expects.
TypeError [ERR_INVALID_ARG_TYPE]: The "path" argument must be of type string. Received undefined
A Node API got an argument of the wrong type — usually undefined because an env var or config value is missing.
Composer: PHP Fatal error: Allowed memory size of 1610612736 bytes exhausted
Composer ran out of memory while resolving or installing dependencies.
FastCGI sent in stderr: "Primary script unknown"
Nginx passed a script path to PHP-FPM that PHP-FPM couldn’t find — usually a wrong SCRIPT_FILENAME or root.
Fatal error: Uncaught Error: Call to a member function x() on null
Code called a method on a variable that is null instead of an object.
Fatal error: Uncaught ArgumentCountError: Too few arguments to function foo(), 1 passed and exactly 2 expected
A function was called with fewer arguments than it requires.
Fatal error: Uncaught DivisionByZeroError: Division by zero
Code divided by zero (or used modulo by zero) — PHP 8 throws instead of warning.
java.lang.ArrayIndexOutOfBoundsException: Index 5 out of bounds for length 5
Code accessed an array index outside 0 … length-1.
TypeError: x is not iterable
for…of, spread or destructuring was used on something that isn’t an array/iterable.
TypeError: Reduce of empty array with no initial value
Array.reduce() ran on an empty array without an initial value.
Laravel: Error: Class "App\Models\Post" not found
PHP can't find the class you referenced — a missing import, wrong namespace or file name, or a stale autoloader.
Laravel/PHP 8: ErrorException: Attempt to read property "name" on null
You accessed a property on a value that is `null`, typically an empty relationship or a query that found nothing.
Laravel/PHP: Allowed memory size of 134217728 bytes exhausted (tried to allocate 20480 bytes) in vendor/laravel/framework
A request (or artisan job) used more memory than PHP's `memory_limit` allows.
Laravel: ErrorException: Undefined variable $posts (View: /resources/views/posts/index.blade.php)
A Blade template uses a variable the controller didn't pass to the view.
Laravel: InvalidArgumentException: Unable to locate a class or view for component [alert].
A `` Blade tag has no matching class or anonymous component view.
Laravel: Illuminate\Auth\Access\AuthorizationException: This action is unauthorized.
A policy or gate denied the action for the current user, so Laravel returned HTTP 403.