Reputation: 2437
I am using PHP5.3 namespaced classes. A common mistake is not getting the namespaces right (Absolute vs relative eg. \App\Models\Something vs Models\Something vs \Something). I commonly use PDO in my classes so that PHP tries to look in \App\PDO
for example
I already have
ini_set('display_errors', 'ON');
ini_set('error_reporting', 'E_ALL | E_STRICT');
I notice sometimes when I am doing
$user = new User(); // when User should be located \App\User or App\User as I am in the root namespace, PHP does not trigger errors ... just give me a blank screen ...
Upvotes: 0
Views: 71
Reputation: 45589
Your code should be like this:
ini_set('display_errors', 1);
ini_set('error_reporting', E_ALL | E_STRICT);
Furthermore, confirm that you are allowed to change php settings via ini_set()
, or not, because you might think you are changing display_errors
and error_reporting
, but you might not be allowed to. That is, although your code executes, the parser does not take into account your settings.
Upvotes: 0
Reputation: 24989
Both your lines are wrong:
ini_set('display_errors', true);
ini_set('error_reporting', E_ALL | E_STRICT);
The values shouldn't be in quotes.
Upvotes: 1
Reputation: 48304
The single quotes in the second argument are wrong. It is being evaluated as 0.
ini_set('error_reporting', 'E_ALL | E_STRICT');
// same as:
ini_set('error_reporting', 0);
See this page for some valid examples of what you could pass as the second argument.
Once you fix that you will get:
PHP Fatal error: Class 'Foo' not found
Upvotes: 0