I have just upgraded from CakePHP 1.3
to cakePHP 2.4.5
.
I am getting the following error:
Fatal Error
Error: Call to a member function parseAccept() on a non-object
File: /myapp/lib/Cake/Controller/Component/RequestHandlerComponent.php
Line: 157
I'm not calling the function parseAccept()
anywhere within my controller, and so don't understand why I am getting this error.
From the Cake Manual
The Fix:
Change your constructor signature..
From:
To:
This should resolve your
Error: Call to a member function parseAccept() on a non-object
.The official
Cake 2.x
docs for this issue can be found here:http://book.cakephp.org/2.0/en/appendices/2-0-migration-guide.html#controller
If you have just upgraded from
1.x
to2.x
, I would highly recommend you read through the detailed migration guides provided bycakePHP
.Migration Guides
2.0 Migration Guide
2.1 Migration Guide
2.2 Migration Guide
2.3 Migration Guide
2.4 Migration Guide
In Cakephp 2.x The AppController's __contruct() has two objects. CakeRequest and Cake Response. You need to pass to the parent contruct