Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Backup database fails to download zip under PHP 7.1 #1624

Closed
markhobson opened this issue Apr 12, 2017 · 4 comments
Closed

Backup database fails to download zip under PHP 7.1 #1624

markhobson opened this issue Apr 12, 2017 · 4 comments
Assignees
Labels

Comments

@markhobson
Copy link

Description

Selecting 'Backup Database' under Settings appears to succeed but nothing is downloaded.

The server log shows an error zipping the SQL:

2017/04/11 15:39:18 [error] [php] A non well formed numeric value encountered (/var/www/craft/app/vendor/pclzip/pclzip/pclzip.lib.php:1797)
Stack trace:
#0 /var/www/craft/app/etc/io/PclZip.php(193): PclZip->add()
#1 /var/www/craft/app/etc/io/Zip.php(136): Craft\PclZip->add()
#2 /var/www/craft/app/tools/DbBackupTool.php(77): add()
#3 /var/www/craft/app/controllers/ToolsController.php(50): Craft\DbBackupTool->performAction()
#4 /var/www/craft/app/framework/web/actions/CInlineAction.php(49): Craft\ToolsController->actionPerformAction()
#5 /var/www/craft/app/framework/web/CController.php(308): CInlineAction->runWithParams()
#6 /var/www/craft/app/framework/web/CController.php(286): Craft\ToolsController->runAction()
#7 /var/www/craft/app/framework/web/CController.php(265): Craft\ToolsController->runActionWithFilters()
#8 /var/www/craft/app/framework/web/CWebApplication.php(282): Craft\ToolsController->run()
#9 /var/www/craft/app/etc/web/WebApp.php(817): Craft\WebApp->runController()
#10 /var/www/craft/app/etc/web/WebApp.php(287): Craft\WebApp->_processActionRequest()
#11 /var/www/craft/app/framework/base/CApplication.php(185): Craft\WebApp->processRequest()
#12 /var/www/craft/app/index.php(62): Craft\WebApp->run()
#13 /var/www/html/index.php(19): require_once()
REQUEST_URI=/index.php/admin/actions/tools/performAction
in /var/www/craft/app/etc/web/WebApp.php (687)
in /var/www/craft/app/vendor/pclzip/pclzip/pclzip.lib.php (1797)
in /var/www/craft/app/vendor/pclzip/pclzip/pclzip.lib.php (513)

Presumably this is due to the PHP 7.1 feature: https://wiki.php.net/rfc/invalid_strings_in_arithmetic

Downgrading to PHP 7.0 works around the problem.

Steps to reproduce

  1. Run Craft CMS under PHP 7.1
  2. Select 'Backup Database' under Settings
  3. No zip file is downloaded

Additional info

  • Craft version: 2.6.2971
  • PHP version: 7.1.3
  • Database driver & version: pdo_mysql
  • Plugins & versions: N/A
@angrybrad angrybrad self-assigned this Apr 12, 2017
@angrybrad
Copy link
Member

angrybrad commented Apr 12, 2017

Craft 2 bundles PclZip as a fallback zip library to use if ZipArchive isn't installed on the box. Unfortunately that PclZip class hasn't been updated since 2009 and is not PHP 7.1 compatible.

For Craft 2, the workaround is to install ZipArchive on your box if you want to use PHP 7.1 and Craft will use it automatically. For Craft 3, we've removed the PclZip fallback and just require ZipArchive.

@markhobson
Copy link
Author

Thanks, I'll give that a go. Should this be documented on Requirements?

@angrybrad
Copy link
Member

Probably... there are several PHP 7.1 gotchas like this. I think we're just going to write a support article that addresses them all.

@angrybrad
Copy link
Member

Craft 2.6.2994 added a PHP 7.1 compatible version of PclZip, so it should happen for any subsequent release, but we'd still recommend just installing ZipArchive.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants