2

I just upgraded my PHP version from v5.3.1 to v5.3.9. Suddenly class constructors started not working. Any ideas?

1 Answer 1

2

You are probably using constructors with Class name instead of __construct() keyword. See the behaviour change in v5.3.3 here:

http://www.php.net/archive/2010.php#id2010-07-22-2

Use __construct() and you should be fine.

http://www.php.net/manual/en/language.oop5.decon.php

Sign up to request clarification or add additional context in comments.

3 Comments

Note that this behaviour only changed back for namespaced classes.
Yes, that's it! I was using namespaces and constructor names equal to class names. I tried to accept the answer but it says i need to wait a few more minutes. I'm new to this site. Sorry if i'm missing something.
@Henry Adams: Nice to hear that your problem is solved. You need to wait for a while before accepting an answer at the beginning stages. That's normal.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.