Skip to content


Subversion checkout URL

You can clone with
Download ZIP


'Cannot redeclare class AppModel in app_model.php' #5

sime opened this Issue · 4 comments

2 participants


I've inherited a CakePHP application and it uses the LazyModel plugin.

Though I'm attempting to upgrade from 1.3.10 to 1.3.11 and I get the following error:

Fatal error: Cannot redeclare class AppModel in app_model.php

Same issue in 1.3.12 and 1.3.13

Also in app_model.php is the Sanitize library is being imported, right under the LazyModel App::import().

I believe the core change in question is evident in the below commit[1]. When removing App::import('Model', 'ConnectionManager'); from cake/libs/santize.php I don't have a problem.

Do you have any suggestion why this is, and if possible a best practice around this problem?

[1] cakephp/cakephp@5ffab8c



Ah i see how that might be a problem. I'd say change it to: App::import('Core', 'ConnectionManager'); and make a pull request for the cakephp core. That should fix it. I think it is a bug in the CakePHP core.


I don't really understand the issue, so I've logged a ticket (rather then a pull request):


Cheers, this has being fixed in CakePHP core: cakephp/cakephp@2ac00f0

@sime sime closed this

Ah good news and fast too. Good job :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.