PHP error when deploy, after update to WP 4.6

After Composer update and deploy I got this error. Any help wellcome!

Thank you!

TASK [deploy : WordPress Installed?] *******************************************
System info:
  Ansible 2.0.2.0; Darwin
  Trellis at "Fix `wp_home` option in Multisite after install in development"
---------------------------------------------------
PHP Fatal error:  Uncaught Error: Call to undefined function apply_filters()
in /srv/www/stage.lolafonseca.com/releases/20160822111033/web/wp/wp-
includes/load.php:317
Stack trace:
#0 phar:///usr/bin/wp/php/utils-wp.php(22): wp_debug_mode()
#1 phar:///usr/bin/wp/php/wp-settings-cli.php(59):
WP_CLI\Utils\wp_debug_mode()
#2 phar:///usr/bin/wp/php/WP_CLI/Runner.php(807):
require('phar:///usr/bin...')
#3 phar:///usr/bin/wp/php/WP_CLI/Runner.php(755):
WP_CLI\Runner->load_wordpress()
#4 phar:///usr/bin/wp/php/wp-cli.php(21): WP_CLI\Runner->start()
#5 phar:///usr/bin/wp/php/boot-phar.php(5): include('phar:///usr/bin...')
#6 /usr/bin/wp(4): include('phar:///usr/bin...')
#7 {main}
  thrown in /srv/www/stage.lolafonseca.com/releases/20160822111033/web/wp/wp-
includes/load.php on line 317
fatal: [188.226.213.77]: FAILED! => {"changed": false, "cmd": ["wp", "core", "is-installed"], "delta": "0:00:00.204783", "end": "2016-08-22 11:11:36.244932", "failed": true, "failed_when_result": true, "rc": 255, "start": "2016-08-22 11:11:36.040149", "stderr": "PHP Fatal error:  Uncaught Error: Call to undefined function apply_filters() in /srv/www/stage.lolafonseca.com/releases/20160822111033/web/wp/wp-includes/load.php:317\nStack trace:\n#0 phar:///usr/bin/wp/php/utils-wp.php(22): wp_debug_mode()\n#1 phar:///usr/bin/wp/php/wp-settings-cli.php(59): WP_CLI\\Utils\\wp_debug_mode()\n#2 phar:///usr/bin/wp/php/WP_CLI/Runner.php(807): require('phar:///usr/bin...')\n#3 phar:///usr/bin/wp/php/WP_CLI/Runner.php(755): WP_CLI\\Runner->load_wordpress()\n#4 phar:///usr/bin/wp/php/wp-cli.php(21): WP_CLI\\Runner->start()\n#5 phar:///usr/bin/wp/php/boot-phar.php(5): include('phar:///usr/bin...')\n#6 /usr/bin/wp(4): include('phar:///usr/bin...')\n#7 {main}\n  thrown in /srv/www/stage.lolafonseca.com/releases/20160822111033/web/wp/wp-includes/load.php on line 317", "stdout": "", "stdout_lines": [], "warnings": []}

Updated my composer.json to use WP 4.6. Fails on deploy. Here is the failure stack:

System info:
  Ansible 2.0.2.0; Darwin
  Trellis at "Fix #569 - Only skip subdomains for non-www domains"
---------------------------------------------------
PHP Fatal error:  Uncaught Error: Call to undefined function apply_filters()
in /srv/www/thinlyveiledcontempt.com/releases/20160822152633/web/wp/wp-
includes/load.php:317
Stack trace:
#0 phar:///usr/bin/wp/php/utils-wp.php(22): wp_debug_mode()
#1 phar:///usr/bin/wp/php/wp-settings-cli.php(59):
WP_CLI\Utils\wp_debug_mode()
#2 phar:///usr/bin/wp/php/WP_CLI/Runner.php(807):
require('phar:///usr/bin...')
#3 phar:///usr/bin/wp/php/WP_CLI/Runner.php(755):
WP_CLI\Runner->load_wordpress()
#4 phar:///usr/bin/wp/php/wp-cli.php(21): WP_CLI\Runner->start()
#5 phar:///usr/bin/wp/php/boot-phar.php(5): include('phar:///usr/bin...')
#6 /usr/bin/wp(4): include('phar:///usr/bin...')
#7 {main}
  thrown in /srv/www/thinlyveiledcontempt.com/releases/20160822152633/web/wp
/wp-includes/load.php on line 317
fatal: [thinlyveiledcontempt.com]: FAILED! => {"changed": false, "cmd": ["wp", "core", "is-installed"], "delta": "0:00:00.125996", "end": "2016-08-22 15:26:46.924832", "failed": true, "failed_when_result": true, "rc": 255, "start": "2016-08-22 15:26:46.798836", "stderr": "PHP Fatal error:  Uncaught Error: Call to undefined function apply_filters() in /srv/www/thinlyveiledcontempt.com/releases/20160822152633/web/wp/wp-includes/load.php:317\nStack trace:\n#0 phar:///usr/bin/wp/php/utils-wp.php(22): wp_debug_mode()\n#1 phar:///usr/bin/wp/php/wp-settings-cli.php(59): WP_CLI\\Utils\\wp_debug_mode()\n#2 phar:///usr/bin/wp/php/WP_CLI/Runner.php(807): require('phar:///usr/bin...')\n#3 phar:///usr/bin/wp/php/WP_CLI/Runner.php(755): WP_CLI\\Runner->load_wordpress()\n#4 phar:///usr/bin/wp/php/wp-cli.php(21): WP_CLI\\Runner->start()\n#5 phar:///usr/bin/wp/php/boot-phar.php(5): include('phar:///usr/bin...')\n#6 /usr/bin/wp(4): include('phar:///usr/bin...')\n#7 {main}\n  thrown in /srv/www/thinlyveiledcontempt.com/releases/20160822152633/web/wp/wp-includes/load.php on line 317", "stdout": "", "stdout_lines": [], "warnings": []}

I saw #639, which mentioned a need for an updated wp-cli to work with 4.6, so I updated the file in question (/trellis/roles/wp-cli/defaults/main.yml) with the version in the commit, but it is still failing. Could use some help.

Same is happening here.

I think it’s WP problem and it will be fixed in 4.6.1 more inf o on link below.

I believe this is a wp-cli issue.

I’m going to manually SSH into the instance and update wp-cli to the latest version. I’ll update if it helps.

It did.

I’ve root access disabled, so I used ssh admin@site.com to login to the instance. Running wp cli update fails with Error: /usr/bin/wp is not writable by current user, but you can overcome that with sudo wp cli update --allow-root.

Enter your sudo password (the default is here: https://roots.io/trellis/docs/vault/), and just say yes when it asks you to.

After that the deploy worked just fine.

4 Likes

It works. Thank you very much.

Seems that the error has been found on the wp-cli side (wp-cli#315) but it requires a new release from an upstream project they use.

1 Like

Good find. Seems like you could also use this solution in the meantime: https://github.com/wp-cli/wp-cli/issues/3315#issuecomment-242084985

So it seems like wp-cli is in limbo waiting for that upstream project to update so they can tag a new release, but they seem to have hacked in the necessary fix to resolve this issue in an intermediate commit. How can I edit ~/site/trellis/roles/wp-cli/defaults/main.yml to pull down dev-master commit of wp-cli instead of a tagged release? Is that even possible with the method Trellis uses to obtain it?

Did you ever figure this one out? Or is it resolved? I’ve held off updating to 4.6.x because of this issue.

You can try to update the file I mentioned in the last post to download the master package from their github. it looks like they merge in a change which is pulling from the dev version of the software that is causing the issue. if you do that, it should let you update.