cakephp / upgrade

Upgrade tools for CakePHP meant to facilitate migrating from one version of the framework to another
MIT License
110 stars 60 forks source link

Fatal error upgrading 3.8 to 4 #137

Closed geoffoliver closed 4 years ago

geoffoliver commented 4 years ago

After upgrading to 3.8 and following the instructions here, running the bin/cake upgrade file_rename locales /var/www command didn't do anything (expected, I don't have any locales setup yet) , but running the bin/cake upgrade templates /var/www threw a couple nasty exceptions.

First, it actually does move some stuff (a git diff can confirm a bunch of renamed files) but then it fails with...

fatal: source directory is empty, source=templates/Layout/Email, destination=templates/Layout/email_

And then throws an uncaught fatal error...

PHP Fatal error: Uncaught Error: Class 'Cake\Error\FatalErrorException' not found in /home/vagrant/upgrade/src/Command/FileRenameCommand.php:283

For what it's worth, after everything is renamed (before it bombs), there isn't actually a folder named "templates/Layout/Email", but there is a folder named "templates/layout/Email"

geoffoliver commented 4 years ago

Verbose Stack trace:

Move /var/www/src/Template to /var/www/templates
Moving sub directories of /var/www/templates
Move /var/www/templates/Layout to /var/www/templates/layout with filesystem casing
Move /var/www/templates/Element/Layout to /var/www/templates/Element/layout with filesystem casing
Move /var/www/templates/Element to /var/www/templates/element with filesystem casing
Move /var/www/templates/Cell to /var/www/templates/cell with filesystem casing
Move /var/www/templates/Layout/Email to /var/www/templates/Layout/email with filesystem casing
fatal: source directory is empty, source=templates/Layout/Email, destination=templates/Layout/email_
PHP Fatal error:  Uncaught Error: Class 'Cake\Error\FatalErrorException' not found in /home/vagrant/upgrade/src/Command/FileRenameCommand.php:283
Stack trace:
#0 /home/vagrant/upgrade/src/Command/FileRenameCommand.php(220): Cake\Upgrade\Command\FileRenameCommand->renameWithCasing('/var/www/templa...', '/var/www/templa...')
#1 /home/vagrant/upgrade/src/Command/FileRenameCommand.php(125): Cake\Upgrade\Command\FileRenameCommand->renameSubFolders('/var/www/templa...')
#2 /home/vagrant/upgrade/src/Command/FileRenameCommand.php(103): Cake\Upgrade\Command\FileRenameCommand->processTemplates()
#3 /home/vagrant/upgrade/vendor/cakephp/console/BaseCommand.php(175): Cake\Upgrade\Command\FileRenameCommand->execute(Object(Cake\Console\Arguments), Object(Cake\Console\ConsoleIo))
#4 /home/vagrant/upgrade/vendor/cakephp/console/CommandRunner.php(336): Cake\Console\BaseCommand->run(Array, Object(Cake\Console\ConsoleIo))
#5 /home/vagrant/upgrade/vendor/cakephp/console/CommandRunner.php(171): Cake\Console\CommandRunner->runCommand(Object(Cake\Upg in /home/vagrant/upgrade/src/Command/FileRenameCommand.php on line 283

Fatal error: Uncaught Error: Class 'Cake\Error\FatalErrorException' not found in /home/vagrant/upgrade/src/Command/FileRenameCommand.php on line 283

Error: Class 'Cake\Error\FatalErrorException' not found in /home/vagrant/upgrade/src/Command/FileRenameCommand.php on line 283

Call Stack:
    0.0001     389672   1. {main}() /home/vagrant/upgrade/bin/cake.php:0
    0.0025     802160   2. Cake\Console\CommandRunner->run() /home/vagrant/upgrade/bin/cake.php:12
    0.0087    1625680   3. Cake\Console\CommandRunner->runCommand() /home/vagrant/upgrade/vendor/cakephp/console/CommandRunner.php:171
    0.0087    1625680   4. Cake\Upgrade\Command\FileRenameCommand->run() /home/vagrant/upgrade/vendor/cakephp/console/CommandRunner.php:336
    0.0107    1908696   5. Cake\Upgrade\Command\FileRenameCommand->execute() /home/vagrant/upgrade/vendor/cakephp/console/BaseCommand.php:175
    0.0111    1908752   6. Cake\Upgrade\Command\FileRenameCommand->processTemplates() /home/vagrant/upgrade/src/Command/FileRenameCommand.php:103
    0.0419    1908800   7. Cake\Upgrade\Command\FileRenameCommand->renameSubFolders() /home/vagrant/upgrade/src/Command/FileRenameCommand.php:125
    0.2757    1945000   8. Cake\Upgrade\Command\FileRenameCommand->renameWithCasing() /home/vagrant/upgrade/src/Command/FileRenameCommand.php:220
markstory commented 4 years ago

Closing as there is a pull request open now.

umer936 commented 1 year ago

Would like to reopen this issue.

I'm upgrading from CakePHP 2.10 to CakePHP 4.x and ran into the same error. It's caused by FileRenameCommand.php and not being able to find FatalErrorException class, which does not exist in my vendor.

I was unable to find a suitable Exception class to replace it with, but it did lead me to what my issue was, which is that I had uncommitted changes in my git repository.

Committing all changes allowed the upgrade to continue past the upgrading Templates section it was stuck at before.