tags:

views:

60

answers:

2

I've stared at this for two hours, and I'm sure there's a decent reason this is happening, but I can't figure it out.

<?php
error_reporting(7); //warning & parse

include($_SERVER['DOCUMENT_ROOT'].'/echo/EchoApplication.php');


$db_credentials = array(
    'host'          => 'localhost',
    'user'          => 'db_user',
    'password'      => 'db_pass',
    'database'      => 'db_name'
);

EchoApplication::testMethod();

$app = new EchoApplicaton(); //line 16
$app->db_credentials = $db_credentials;
$app->run();
----and this happens----
Fatal error: Class 'EchoApplicaton' not found in /var/www/html_echo/page.php on line 16

How is that possible?

EDIT: posted the whole page's code.

A: 

Are you sure your class has a constructor? I think the new statement doesn't work if you are missing one.

According to the manual:

For backwards compatibility, if PHP 5 cannot find a __construct() function for a given class, it will search for the old-style constructor function, by the name of the class. Effectively, it means that the only case that would have compatibility issues is if the class had a method named __construct() which was used for different semantics.

Basically, you better either have a __construct() or a EchoApplicaton() method in your class that is publicly accessible, or an error will be thrown.

SimpleCoder
I do, but it's empty. Does that matter? `public function __construct() {}`
UltimateBrent
Then that's not the problem... What is the scope of the class itself?
SimpleCoder
posted the full code. It's just included before that.
UltimateBrent
Thanks for trying :)
UltimateBrent
classes do not need to declare a constructor. It's there as a utility if you need it, but you don't need to declare one for `new` to work...
ircmaxell
+3  A: 
EchoApplicaton

You've missed one letter - EchoApplicat >>i<< on

zerkms
Wow, it's always something retarded. Thanks!
UltimateBrent