Vvv: Getting warnings relating to class-wp-hook.php on line 286

Created on 7 Sep 2019  Â·  34Comments  Â·  Source: Varying-Vagrant-Vagrants/VVV

After doing some work to restore a new version of VVV and get a new VM I am now seeing the following warnings injected on all my test sites:

Warning: Parameter 1 to wp_default_packages() expected to be a reference, value given in /srv/www/ttricks/public_html/wp-includes/class-wp-hook.php on line 286

Warning: Parameter 1 to wp_default_styles() expected to be a reference, value given in /srv/www/ttricks/public_html/wp-includes/class-wp-hook.php on line 286

I have done some searches already but have found no suggestions that will work. It isn't plugin or theme related as it effects the default installs as well with the Twenty Nineteen theme.

In fact I got into this issue by trying to install the latest version of WordPress by running it from the updates dashboard. I get the following error.

Parse error: syntax error, unexpected '->' (T_OBJECT_OPERATOR) in /srv/www/wordpress-one/public_html/wp-includes/post-template.php on line 1930
The site is experiencing technical difficulties. Please check your site admin email inbox for instructions.

question support

All 34 comments

Solved with the following in wp-config.php:

ini_set('display_errors','Off');
ini_set('error_reporting', E_ALL );
define('WP_DEBUG', false);
define('WP_DEBUG_DISPLAY', false);

NOTE: if you paste the above you may need to change the quote marks ( ' ). I copied the mark from an adjacent piece of code in that file.

There should be no PHP warnings in core itself. Can you confirm which
versions you updated to and from?

On Sat, 7 Sep 2019 at 17:34, irishetcher notifications@github.com wrote:

Solved with the following in wp-config.php:

ini_set('display_errors','Off');
ini_set('error_reporting', E_ALL );
define('WP_DEBUG', false);
define('WP_DEBUG_DISPLAY', false);

NOTE: if you paste the above you may need to change the quote marks ( ' ).
I copied the mark from an adjacent piece of code in that file.

—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
https://github.com/Varying-Vagrant-Vagrants/VVV/issues/1940?email_source=notifications&email_token=AAAOLZZBXEBY46OTKQET4RLQIPJYTA5CNFSM4IUQNR52YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD6E4T7Y#issuecomment-529123839,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AAAOLZ7XMVDPJGAQBBDO7DTQIPJYTANCNFSM4IUQNR5Q
.

I will need to go check. It was to 5.2.3 but from which version not 100% sure.

Ah I meant VVV version, not WP version, perhaps I misunderstood what you
meant

On Sat, 7 Sep 2019 at 19:42, irishetcher notifications@github.com wrote:

I will need to go check. It was to 5.2.3 but from which version not 100%
sure.

—
You are receiving this because you commented.

Reply to this email directly, view it on GitHub
https://github.com/Varying-Vagrant-Vagrants/VVV/issues/1940?email_source=notifications&email_token=AAAOLZZXN5HAOAVTXI4IYX3QIPYX3A5CNFSM4IUQNR52YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD6E7QCI#issuecomment-529135625,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AAAOLZ2DOAOVWCC3DT3GFY3QIPYX3ANCNFSM4IUQNR5Q
.

Hi Tom,

just got some time to look into this. I'm on Vagrant: v2.2.5 and v3.0.0 of Vagrant.

A bit more background into what I was doing. Initially I was attempting an update 5.2.3 of one of the sample installs of WordPress that comes with Varying Vagrant Vagrants. This failed with the following warning:

one/public_html/wp-includes/post-template.php on line 1930
The site is experiencing technical difficulties. Please check your site admin email inbox for instructions.

The site was not accessible so I reverted to a backup copy. Trying this again and, some other things lead to Varying Vagrant Vagrants launching but the sites, including the Varying Vagrant Vagrants dashboards, becoming inaccessible. There was some notice in the console relating to issues with Nginx.

Looking at VirtualBox, I noted that I didn't have a backup of the VM to roll back to so I deleted it and let Varying Vagrant Vagrants regenerate the VM. This got everything up and running but it at this stage I started getting the warnings:

Warning: Parameter 1 to wp_default_packages() expected to be a reference, value given in /srv/www/ttricks/public_html/wp-includes/class-wp-hook.php on line 286

Warning: Parameter 1 to wp_default_styles() expected to be a reference, value given in /srv/www/ttricks/public_html/wp-includes/class-wp-hook.php on line 286

As I am relatively new to Varying Vagrant Vagrants much of its working are, for the moment, a bit alien to me and, I have a bit more reading of the documentation to do. On the Wordpress updates I found that vagrant reload --provision was not bringing my sites to 5.2.3 except for one last attempt at making a new test site. For the other sites I did a manual update by downloading WordPress to overwrite all files except the wp-content directory. As I said already the temporary workaround is to add the following to wp-config:

ini_set('display_errors','Off');
ini_set('error_reporting', E_ALL );
define('WP_DEBUG', false);
define('WP_DEBUG_DISPLAY', false);

I do find that Varying Vagrant Vagrants is quite good, faster than MAMP which I have been using for the last number of years.

One last question. Is there any plans to set up Varying Vagrant Vagrants for staging so we can push changes to live sites?

I believe this is the kernel bug that was in the box used by VVV 3.0. Back
up your database, destroy your VM and update to VVV 3.1.

Like WordPress you should strive to always stay up to date with VVV, new
versions don’t just add new features, they include fixes. Updating VVV
should always be one of the first debugging steps when having VVV issues

On Sun, 8 Sep 2019 at 11:47, irishetcher notifications@github.com wrote:

Hi Tom,

just got some time to look into this. I'm on Vagrant: v2.2.5 and v3.0.0 of
Vagrant.

A bit more background into what I was doing. Initially I was attempting an
update 5.2.3 of one of the sample installs of WordPress that comes with
Varying Vagrant Vagrants. This failed with the following warning:

one/public_html/wp-includes/post-template.php on line 1930
The site is experiencing technical difficulties. Please check your site
admin email inbox for instructions.

The site was not accessible so I reverted to a backup copy. Trying this
again and, some other things lead to Varying Vagrant Vagrants launching but
the sites, including the Varying Vagrant Vagrants dashboards, becoming
inaccessible. There was some notice in the console relating to issues with
Nginx.

Looking at VirtualBox, I noted that I didn't have a backup of the VM to
roll back to so I deleted it and let Varying Vagrant Vagrants regenerate
the VM. This got everything up and running but it at this stage I started
getting the warnings:

Warning: Parameter 1 to wp_default_packages() expected to be a reference,
value given in /srv/www/ttricks/public_html/wp-includes/class-wp-hook.php
on line 286

Warning: Parameter 1 to wp_default_styles() expected to be a reference,
value given in /srv/www/ttricks/public_html/wp-includes/class-wp-hook.php
on line 286

As I am relatively new to Varying Vagrant Vagrants much of its working
are, for the moment, a bit alien to me and, I have a bit more reading of
the documentation to do. On the Wordpress updates I found that vagrant
reload --provision was not bringing my sites to 5.2.3 except for one last
attempt at making a new test site. For the other sites I did a manual
update by downloading WordPress to overwrite all files except the
wp-content directory. As I said already the temporary workaround is to add
the following to wp-config:

ini_set('display_errors','Off');
ini_set('error_reporting', E_ALL );
define('WP_DEBUG', false);
define('WP_DEBUG_DISPLAY', false);

I do find that Varying Vagrant Vagrants is quite good, faster than MAMP
which I have been using for the last number of years.

One last question. Is there any plans to set up Varying Vagrant Vagrants
for staging so we can push changes to live sites?

—
You are receiving this because you commented.

Reply to this email directly, view it on GitHub
https://github.com/Varying-Vagrant-Vagrants/VVV/issues/1940?email_source=notifications&email_token=AAAOLZ2GBXOJJRMCDGIBY7TQITJ47A5CNFSM4IUQNR52YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD6FNA6A#issuecomment-529191032,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AAAOLZYUPBMRHBCQ7YEAL53QITJ47ANCNFSM4IUQNR5Q
.

Thanks Tom.

I will do that. Note I went to this page which has the instructions but it states VVV 3.0 and not 3.1:

https://varyingvagrantvagrants.org/blog/2019/05/15/vvv-3-0-0.html

Is the 3.1 version what I'll get?

Varying Vagrant Vagrants
Hi! Welcome to the very late release post for VVV v3.0. As we follow semantic versioning, this is a breaking release, and requires slightly different update instructions.

Yeah that’s just the VVV 3.0 release post, it wouldn’t make sense to go
back to every release post and update the version number. The master branch
always has the latest stable release

On Sun, 8 Sep 2019 at 11:59, irishetcher notifications@github.com wrote:

Thanks Tom.

I will do that. Note I went to this page which has the instructions but it
states VVV 3.0 and not 3.1:

https://varyingvagrantvagrants.org/blog/2019/05/15/vvv-3-0-0.html

Is the 3.1 version what I'll get?

—
You are receiving this because you commented.

Reply to this email directly, view it on GitHub
https://github.com/Varying-Vagrant-Vagrants/VVV/issues/1940?email_source=notifications&email_token=AAAOLZZDZ6QF4DIDDZWUBB3QITLH3A5CNFSM4IUQNR52YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD6FNGLQ#issuecomment-529191726,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AAAOLZ7PGRIQPKYDXB5C6RLQITLH3ANCNFSM4IUQNR5Q
.

Hi Tom,

I followed the procedure on the linked page and it went very well. The warnings are still appearing though. Using the code in wp-config seems to hide them anyway so I am not too bothered about them for the moment. If I get time again I might investigate a bit more.

Thanks again.

I was having the same issue:

PHP Parse error: syntax error, unexpected '->' (T_OBJECT_OPERATOR) in ../wp-includes/post-template.php on line 1930

Pulling down the latest from master, destroying vagrant, and running a vagrant up --provision fixed it. Thanks.

@irishetcher fyi.. all you are doing with your solution is turning off debugging. You really want that on when you're in development.

Hi Ed,

I see that when I launch VVV from the terminal it is prompting me to update with vagrant box update. I had this the other day but id did not rectify the issue with the warnings but perhaps this one will.

You do mention getting the latest master and doing a clean install of that so perhaps I need to do that as well.

Correct, I shouldn't be hiding the warnings but as this is not a mission critical site in development, hiding them is less bother.

Thanks again

Also I have looked at various different pages of instruction on how to re-install and update which is a bit confusing?

https://varyingvagrantvagrants.org/docs/en-US/installation/keeping-up-to-date/

https://varyingvagrantvagrants.org/docs/en-US/troubleshooting/

There was another one which I can't find now and it mentioned something about making sure you had a backup of the databases.

So if you can point me to the correct one it would be much appreciated.

Varying Vagrant Vagrants
Update VVV from time to time to keep pace with new fixes and improvements.
Varying Vagrant Vagrants
Find help on GitHub and the wiki or check how to resolve common problems.

Those pages aren’t talking about the same thing

  • One is for keeping up to date, for a working install
  • The other is how to do a scorched earth complete fresh reinstall for
    troubleshooting purposes

Also, the box is basically the starting point/template that gets used when
the VM is first created. The problem being that in VVV 3.0 we used a box
with a critical kernel bug which manifests as filesystem errors or PHO
syntax errors after large writes/updates.

So if you’ve already updated to 3.1, and destroyed/rebuilt your VM then
you’re already done. Any warnings etc are probably from your code.

I’d also fix those warnings, high or low priority client it’s a bad habit
to have, and can get in the way when trying to debug future issues. Query
Monitor can help there

On Sat, 14 Sep 2019 at 10:51, irishetcher notifications@github.com wrote:

Also I have looked at various different pages of instruction on how to
re-install and update which is a bit confusing?

https://varyingvagrantvagrants.org/docs/en-US/installation/keeping-up-to-date/

https://varyingvagrantvagrants.org/docs/en-US/troubleshooting/

There was another one which I can't find now and it mentioned something
about making sure you had a backup of the databases.

So if you can point me to the correct one it would be much appreciated.

—
You are receiving this because you commented.

Reply to this email directly, view it on GitHub
https://github.com/Varying-Vagrant-Vagrants/VVV/issues/1940?email_source=notifications&email_token=AAAOLZ6DYNCRYMQBTLORFJ3QJSXZJA5CNFSM4IUQNR52YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD6WYRWI#issuecomment-531466457,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AAAOLZ2S5A4W4I76BBBAHV3QJSXZJANCNFSM4IUQNR5Q
.

Point taken regarding the warnings, but as I said the sites are not being used by any client and the warnings are across 4 sites, the two samples that come by default, one that I use to test layouts and the other themes.

I am tempted to try the scorched earth policy but it may wipe out the two sites I created? If this is the case can I mitigate this by restoring these sites, the databases and vvv-custom.yml from backup?

Trying to fix the warnings? I went down the rabbit hole already at attempting this and got nowhere. The fact that all sites were effected is a bit of a coincidence and Ed seems to resolved this with his suggestion.

I will install Query monitor and see if it shows me something that makes sense.

The scorched earth version will destroy your database, hence needing to
backup and restore

On Sat, 14 Sep 2019 at 11:56, irishetcher notifications@github.com wrote:

Trying to fix the warnings? I went down the rabbit hole already at
attempting this and got nowhere. The fact that all sites were effected is a
bit of a coincidence and Ed seems to resolved this with his suggestion.

I will install Query monitor and see if it shows me something that makes
sense.

—
You are receiving this because you commented.

Reply to this email directly, view it on GitHub
https://github.com/Varying-Vagrant-Vagrants/VVV/issues/1940?email_source=notifications&email_token=AAAOLZZA2KJNRU2BM75IZIDQJS7NTA5CNFSM4IUQNR52YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD6WZQQQ#issuecomment-531470402,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AAAOLZ4AZY4FUKRLZFS6A5LQJS7NTANCNFSM4IUQNR5Q
.

Thanks Tom.

I might give that a go if all else fails.

Hi Tom,

I gave that a try. Still some issues.

For some reason one of the databases was not being backed up. It's not the most important test site but it would be nice to get is back. What I have been able to do is pull a backup of the VM prior to the loss of database and have been able to get in mysql to see the database. I did some queries on it and can confirm it's the database I need. I am now trying to do a dump but I don't seem to be using the correct syntax according to the errors (ERROR 1064 (4200)).

I have found variants on the command online such as:

mysqldump --user=admin_backup --password --lock-tables --databases db1 > /data/backup/db1.sql

and

mysqldump -u [uname] -p db_name > db_backup.sql

Any tips on the correct command appreciated.

I presume that I can set the save location to one of the shared folders on my Mac set by the VM?

In terms of my initial issue of the PHP warnings I did a back up of the other WordPress site and installed it on MAMP and the warnings disappear. So, if or once I recover that database, I might clear everything out and install VV form scratch.

Hi Folks,

I managed to get the database with the mysqldump and found the command to copy over to my Mac. Was then able to dump the default database and import the one above.

If anyone has tips on fixing a database not being included is backup, please let me know.

Much appreciated.

I'm getting this exact same issue when provisioning a brand new machine.

Vagrant 2.2.5 and VVV on latest develop.

Interestingly enough, when xdebug_on is used, the issue is gone.

I'm attaching the provision log as well. Notice at the bottom where the provisioner provisions the sites, the errors are there too!

v1.txt

Is there a core trac ticket for this? I don’t see anything in VVV that
would cause this, and the debugging steps I’d recommend are the usual PHP
and stack traces route rather than dev ops

On Fri, 20 Sep 2019 at 07:20, Konstantinos Galanakis <
[email protected]> wrote:

I'm getting this exact same issue when provisioning a brand new machine.

Vagrant 2.2.5 and VVV on latest develop.

Interestingly enough, when xdebug_on is used, the issue is gone.

I'm attaching the provision log as well. Notice at the bottom where the
provisioner provisions the sites, the errors are there too!

v1.txt
https://github.com/Varying-Vagrant-Vagrants/VVV/files/3634451/v1.txt

—
You are receiving this because you commented.

Reply to this email directly, view it on GitHub
https://github.com/Varying-Vagrant-Vagrants/VVV/issues/1940?email_source=notifications&email_token=AAAOLZZCPURRUE5CJLOA2KLQKRTRNA5CNFSM4IUQNR52YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD7FWMOA#issuecomment-533423672,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AAAOLZ4TLDOR5OBM3EPPQB3QKRTRNANCNFSM4IUQNR5Q
.

How this cannot be related to VVV.

  • Latest Vagrant
  • Fresh checkout from develop
  • New VM
  • Latest WP 5.2.3

All these lead to those 3 notifications when xdebug_off while the notifications are gone when xdebug_on.

Also, note that 5.2.3 is not producing any of these notifications on other environments.

I have the same issue with the development version of wordpress: Warning: Parameter 1 to wp_default_scripts() expected to be a reference, value given in /srv/www/wordpress-develop/public_html/build/wp-includes/class-wp-hook.php on line 286
I am investigating.

@Mte90 thanks for taking a look.

How this cannot be related to VVV.

That implies the issue is in tideways, but given that new instances of VVV don't include that by default, I don't see what could be causing a PHP error when VVV adds no PHP

I also found a number of WP Engine users facing this issue in the past, and I too get this issue. it happens on both PHP 7.2, and 7.3.

Query Monitor gives this stack trace:

do_action('init')
wp-settings.php:525
wp_widgets_init()
Unknown location
do_action('widgets_init')
wp-includes/widgets.php:1715
WP_Widget_Factory->_register_widgets()
Unknown location
WP_Widget->_register()
wp-includes/class-wp-widget-factory.php:141
WP_Widget_Text->_register_one()
wp-includes/class-wp-widget.php:259
wp_add_inline_script()
wp-includes/widgets/class-wp-widget-text.php:58
wp_scripts()
wp-includes/functions.wp-scripts.php:128
WP_Scripts->__construct()
wp-includes/functions.wp-scripts.php:23
WP_Scripts->init()
wp-includes/class.wp-scripts.php:131
do_action_ref_array('wp_default_scripts')
wp-includes/class.wp-scripts.php:148
wp-includes/class-wp-hook.php:286

line 148 of wp-includes/class.wp-scripts.php:

    /**
     * Initialize the class.
     *
     * @since 3.4.0
     */
    public function init() {
        /**
         * Fires when the WP_Scripts instance is initialized.
         *
         * @since 2.6.0
         *
         * @param WP_Scripts $this WP_Scripts instance (passed by reference).
         */
        do_action_ref_array( 'wp_default_scripts', array( &$this ) );
    }

If we follow the rabbit hole down we get to the problem:

function wp_default_scripts( &$scripts ) {

The & causes the problem. I'm not sure why it's there, but it looks like a PHP 4-ism. Object variables in PHP 5+ contain a reference to the object, and it's the reference that's passed around. In PHP 4 however, it's the value, so passing an object without using & would copy the object.

Eliminating the & resolves the warning in wp_default_scripts, and doing the same in wp_default_packages and wp_default_styles resolves all warnings.

My recommendation would be a WP Core Trac ticket reporting the bug, and a patch that eliinates the &. Those functions could certainly be made more robust, but if the issue lays elsewhere, I do not see it or how to diagnose it at this time. It's not something that can be fixed via devops knowledge as far as I can tell

As for why this shows in VVV but not in other places, this could be due to the way warning and error level settings are configured. VVV may simply have configured PHP to have a lower threshold than other environments, it doesn't meant the issue only occurs on VVV, just that it's not displayed elsewhere.

Removing tideways also removed these notices on Drupal VM.

In that case using the xdebug_on script might resolve this issue

I can confirm that the issue with disabling tideways disappear.
The WordPress ticket mention also that this happen with UOPZ extension, so maybe with some extension enabled there are errors because those methods use an old compatibility feature.

Or rather this is something that should always happen, but enabling these features makes PHP a little stricter, revealing the warnings

Probably yes, the patch proposed on the ticket anyway fix the issue.
I am patching manually wordpress to avoid those errors.

Seems that the patch is planned for WordPress 5.4

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

Was this page helpful?
0 / 5 - 0 ratings