I'm getting the following error:
Fatal error: Uncaught Error: Call to undefined function var_dumb()
What does this mean?
Blue
22.2k7 gold badges56 silver badges87 bronze badges
asked Jul 30, 2016 at 5:34
6
What is mean by fatal error
It's an error that caused the script to abort and exit immediately. All statements after the fatal error are never executed.
<?php echo 'line 1'; $a = new FakeClass(); // fatal error. Class doesn't exist so PHP aborts echo 'line 2'; // <- never executedNon-fatal errors don't abort the script
<?php echo 'line 1'; $a = 7/0; // 'Non-fatal error: Division by zero' echo 'line 2'; // <- executed and printed to the screenIn your case, since you used a function that PHP doesn't know var_dumb() a fatal error occurred. The function you're looking for is var_dump()
I strongly recommend you use an editor that will alert you to errors as you code. It will safe you a lot of time.
answered Jul 30, 2016 at 5:48
BeetleJuiceBeetleJuice
37.6k18 gold badges96 silver badges156 bronze badges
You have a typo in your code. var_dumb should be var_dump. Because PHP doesn't know a function by the name of var_dumb, it doesn't know what to do. A fatal exception is thrown, and execution of the script halts.
You can read more about PHP exceptions here.
answered Jul 30, 2016 at 5:41
BlueBlue
22.2k7 gold badges56 silver badges87 bronze badges
PHP doesn't have var_dumb method, correct method name is var_dump.
Fatal errors are critical errors - for example, instantiating an object of a non-existent class, or calling a non-existent function. These errors cause the immediate termination of the script, and PHP's default behavior is to display them to the user when they take place.
So in your case you're calling non-existent function and it throws fatal error.
answered Jul 30, 2016 at 5:47
Alok PatelAlok Patel
7,6425 gold badges27 silver badges47 bronze badges
"Fatal Error", as it's name indicates, is Fatal : it stop the execution of the script / program.
There is a hack using output buffering that will let you log certain fatal errors, but there's no way to continue a script after a fatal error occurs - that's what makes it fatal!
If your script is timing out you can use set_time_limit() to give it more time to execute.
If you are using PHP to generate web pages and get a Fatal error related to max_execution_time which, by defaults, equals 30 seconds, you are certainly doing something that really takes too mych time : users won't probably wait for so long to get the page.
answered Jul 30, 2016 at 7:00
Educative Answers Team
Fatal errors crash the program. There are three types of fatal errors in PHP:
Startup fatal error: This error occurs when a system can’t run the code during installation.
Compile time fatal error: This error occurs if a call is made to a non-existent code or variable.
Runtime fatal error: This error occurs while the program is running, and will cause the program to quit.
The following code tried to call a function name without declaring the function. This gives a fatal error:
<?php
name("John", "Smith");
echo 'Success!';
?>
Notice how the print statement is not executed. This is because, as soon as a fatal error is thrown, the code stops compiling.
Solution
- Look for the undeclared variables as given in the error.
- If you are using inbuilt functions, ensure that there is no typo and the correct function is called.
- Check if the spellings are correct.
Copyright ©2022 Educative, Inc. All rights reserved