CodeIgniter Forums
Error after update - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: CodeIgniter 4 (https://forum.codeigniter.com/forumdisplay.php?fid=28)
+--- Forum: CodeIgniter 4 Support (https://forum.codeigniter.com/forumdisplay.php?fid=30)
+--- Thread: Error after update (/showthread.php?tid=75676)



Error after update - saror88 - 03-04-2020

Hi, 
I recently upgraded to CI4 and also updated my WAMP to the latest version.

But my project hasn't worked since. There is MY_Controller class that is inherited from CI_Controller placed in application/core/

It gives me this error:

Code:
An uncaught Exception was encountered
Type: Error

Message: The "Generator" class is reserved for internal use and cannot be manually instantiated

Filename: C:\wamp64\www\alnoor\system\core\Loader.php

Line Number: 1285

Backtrace:

File: C:\wamp64\www\alnoor\application\core\MY_Controller.php
Line: 7
Function: __construct

File: C:\wamp64\www\alnoor\index.php
Line: 315
Function: require_once

Anybody knows what this means or how can I get it fixed?


RE: Error after update - maxxd - 03-04-2020

Version 3.x to 4 is less an upgrade than a migration - you'll have to rewrite the code for the site. See https://codeigniter4.github.io/userguide/installation/upgrade_4xx.html for details.


RE: Error after update - saror88 - 03-04-2020

(03-04-2020, 05:14 AM)maxxd Wrote: Version 3.x to 4 is less an upgrade than a migration - you'll have to rewrite the code for the site. See https://codeigniter4.github.io/userguide/installation/upgrade_4xx.html for details.

Hi, thanks for the reply.

It turns out there's a built in class called 'Generator', and I have a custom library with the same name. So that created the conflict.
I changed my library's name to 'My_generator' and changed the code accordingly and it works now, or at least shows a homepage.
However, you're right about the migration, I might get more errors like this as I test my code.


RE: Error after update - kilishan - 03-04-2020

@saror88 You should read up on namespaces. They'll help you to not have conflicts like this, and you'll get a whole lot more use out of CI4 once you get used to it.