Awake 3.9 + WordPress 4.5.2 + PHP 7.0.4 on Ubuntu 16.04 LTS: warnings on the log

open (9 posts) (4 voices)

  1. Hi,

    I'm well aware that Awake is one of those themes that sadly MySiteMyWay is not supporting any more, at least not very actively. But sometimes just a little tweak may provide good results...

    I have been seeing the following warnings on the logs:

    2016/05/28 10:53:33 [error] 8023#8023: *2495 FastCGI sent in stderr: "PHP message: PHP Warning:  Declaration of mysiteDescriptionWalker::start_el(&$output, $item, $depth, $args) should be compatible with Walker_Nav_Menu::start_el(&$output, $item, $depth = 0, $args = Array, $id = 0) in /var/www/clients/client6/web11/web/wp-content/themes/awake/lib/classes/menu-walker.php on line 45
    PHP message: PHP Warning:  Declaration of mysiteResponsiveMenuWalker::start_lvl(&$output, $depth) should be compatible with Walker_Nav_Menu::start_lvl(&$output, $depth = 0, $args = Array) in /var/www/clients/client6/web11/web/wp-content/themes/awake/lib/classes/menu-walker.php on line 87
    PHP message: PHP Warning:  Declaration of mysiteResponsiveMenuWalker::end_lvl(&$output, $depth) should be compatible with Walker_Nav_Menu::end_lvl(&$output, $depth = 0, $args = Array) in /var/www/clients/client6/web11/web/wp-content/themes/awake/lib/classes/menu-walker.php on line 87
    PHP message: PHP Warning:  Declaration of mysiteResponsiveMenuWalker::start_el(&$output, $item, $depth, $args) should be compatible with Walker_Nav_Menu::start_el(&$output, $item, $depth = 0, $args = Array, $id = 0) in /var/www/clients/client6/web11/web/wp-content/themes/awake/lib/classes/menu-walker.php on line 87
    PHP message: PHP Warning:  Declaration of mysiteResponsiveMenuWalker::end_el(&$output, $item, $depth) should be compatible with Walker_Nav_Menu::end_el(&$output, $item, $depth = 0, $args = Array) in /var/www/clients/client6/web11/web/wp-content/themes/awake/lib/classes/menu-walker.php on line 87" while reading response header from upstream, client: 89.152.248.220, server: mywebsite.tld, request: "POST /wp-admin/admin-ajax.php HTTP/1.1", upstream: "fastcgi://127.0.0.1:9020", host: "mywebsite.tld", referrer: "http://mywebsite.tld/wp-admin/themes.php?theme=awake"

    Note that the theme is displaying well, I have no errors, nor loss of functionality. These are just warnings — for now. It seems that the menu class has been wrongly coded or it is deriving from a WordPress menu class that has been changed in more recent WordPress installations (it now has an additional parameter). This would actually be strange, since it would affect other older themes as well (not only the ones from MSMW). I guess that PHP 7, because it includes a JIT compiler, is now a bit more stricter with how things are coded.

    I leave this here just because someone at MSMW might immediately see what they can fix with that class, and eventually that requires just a very simple fix — good enough for 3.9.1 :-)

    What I did was to change /wp-content/themes/awake/lib/classes/menu-walker.php the following way:

    On line 52, where it says:
    function start_lvl(&$output, $depth){

    change to:
    function start_lvl(&$output, $depth, $args){

    On line 82, where it says:
    function end_el(&$output, $item, $depth){

    change to:
    function end_el(&$output, $item, $depth, $args){

    The warnings continued as before, so I changed this a bit more; but all those tiny changes did not help much (i.e. I still get warnings on the logs). There is still something that eludes me...

    Posted 10 months ago #
  2. Ok, it seems that I had missed another one:

    On line 8, where it says:

    start_el(&$output, $item, $depth, $args)

    change to

    start_el(&$output, $item, depth = 0, $args = array(), $id = 0)

    And, as before, lines 52 and 82 should be changed correctly to:

    On line 52, where it says:
    function start_lvl(&$output, $depth){

    change to:
    function start_lvl(&$output, $depth = 0, $args = []){

    On line 82, where it says:
    function end_el(&$output, $item, $depth){

    change to:
    function end_el(&$output, $item, $depth = 0, $args = []){

    This should finally fix all warnings.

    Posted 9 months ago #
  3. bothclst
    Member

    Thank you so much for this post @GwynethLlewelyn.

    I found a similar issue with the Persuasion theme after moving to PHP 7.

    Oddly enough, some of the specific changes were a bit different than those you cite, but your post let me know where to look to resolve the problem. I would suggest others seeing similar issues take a close look at the error messages being presented, which actually describe quite clearly what the new function declarations should be.

    I hope MySiteMyWay patches their themes soon.

    Posted 9 months ago #
  4. bothclst
    Member

    I have now also encountered this in Myriad 2.5 with PHP 7.

    A few more details for those struggling with the same problem.

    You will see a series of warnings like this one: Warning: Declaration of mysiteDescriptionWalker::start_el(&$output, $item, $depth, $args) should be compatible with Walker_Nav_Menu::start_el(&$output, $item, $depth = 0, $args = Array, $id = 0) in /home/tyriannetwork/tyrian.net/wp/wp-content/themes/myriad/lib/classes/menu-walker.php on line 45

    Note the filename, that is the file you will edit. Unfortunately the line numbers are a bit misleading. The function declaration you are seeking is the part after the :: (it is start_el in this example). Note that there are two versions in the warning, copy what is between the parens in the second version (this is (&$output, $item, $depth = 0, $args = Array, $id = 0) in the example above), paste it into the occurrence of that function declarationabove the state line number, and add an empty set of parents after the Array. So our example in Myriad replaces the declaration on line 8 so that it becomes:

    	function start_el(&$output, $item, $depth = 0, $args = Array(), $id = 0) {

    Repeat for each of the warnings you see.

    Again, many thanks to GwynethLlewelyn for pointing the way and hopefully MSMW fixes all their themes soon!

    Posted 9 months ago #
  5. OnePressTech
    Member

    Many thanks to both of you.

    I would not hold your breath regarding MSMW fixing their themes. There has been no activity for 8 months by MSMW on this forum and direct emails to the contact addresses we have found have gone unanswered. The site is like a ghost ship drifting along with no crew in site (pun intended).

    I will be making a fork available in a few weeks that the community can use to manage community-led bug fixes.

    Posted 9 months ago #
  6. bothclst
    Member

    Hi @OnePressTech, I would love to be a part of that effort.

    I just found a whole other class of errors that was causing some fatal crashes in PHP7. These files are from Persuasion 2.8, but I believe these files are quite common across MSMW themes.

    Searching 1390 files for "\$this->(\$[^\(]*)\(" (regex, case sensitive)
    
    /Volumes/Magneto/Users/efc/Desktop/persuasion/lib/admin/classes/metaboxes-generator.php:
       45: 			$out .= $this->$value['type']( $value );
    
    /Volumes/Magneto/Users/efc/Desktop/persuasion/lib/admin/classes/option-generator.php:
       38: 			$out .= $this->$option['type']( $option );
    
    /Volumes/Magneto/Users/efc/Desktop/persuasion/lib/admin/classes/shortcode-generator.php:
      116: 									$out .= $this->$option['type']( $option );
      122: 									$out .= $this->$option['type']( $option );
      139: 							$out .= $this->$sc_option['options']['type']( $sc_option['options'] );
      147: 				$out .= $this->$sc_options['custom']( $sc_options );
    
    /Volumes/Magneto/Users/efc/Desktop/persuasion/lib/admin/classes/skin-generator.php:
      904: 					$out .= $this->$value['option'](array(
    
    7 matches across 4 files
    

    Should get some added curly brackets to disambiguate the code, like this...

    Searching 1390 files for "\$this->({\$[^\(]*)\(" (regex, case sensitive)
    
    /Volumes/Magneto/Users/efc/Desktop/persuasion/lib/admin/classes/metaboxes-generator.php:
       45: 			$out .= $this->{$value['type']}( $value );
    
    /Volumes/Magneto/Users/efc/Desktop/persuasion/lib/admin/classes/option-generator.php:
       38: 			$out .= $this->{$option['type']}( $option );
    
    /Volumes/Magneto/Users/efc/Desktop/persuasion/lib/admin/classes/shortcode-generator.php:
      116: 									$out .= $this->{$option['type']}( $option );
      122: 									$out .= $this->{$option['type']}( $option );
      139: 							$out .= $this->{$sc_option['options']['type']}( $sc_option['options'] );
      147: 				$out .= $this->{$sc_options['custom']}( $sc_options );
    
    /Volumes/Magneto/Users/efc/Desktop/persuasion/lib/admin/classes/skin-generator.php:
      904: 					$out .= $this->{$value['option']}(array(
    
    7 matches across 4 files
    
    Posted 8 months ago #
  7. OnePressTech
    Member

    Hi @bothclst - every helping hand will be great...I'll let you know when I have made the fork available :-)

    Posted 8 months ago #
  8. reanderson
    Member

    Hi OnePressTech,
    Did you ever go ahead with the Github repo for MSMW themes?

    Thanks,

    Bob

    Posted 3 weeks ago #
  9. OnePressTech
    Member

    I did Bob...you will find it at https://gitlab.com/BackStopThemes. I have fixed PHP and WordPress API errors and warnings to bring the theme support up to php7 / WP4.7. I still need to clean up the out-of-date jquery / javascript, deal with the TimThumb code and add in a one-button-press auto-update mechanism. In the next release I will have cleaned up a number of ThemeCheck warnings / errors. These don't change the quality of the current release but would give people peace-of-mind that the theme conforms to WordPress conventions. I will be adding GitLab CI support to auto-build, auto-check and auto-package the theme releases later this month. Currently you have to manually merge the theme framework with the specific theme files to package a theme release.

    The released versions of BackStop Themes for the non-techies can be found at https://backstopthemes.com.

    NOTE: This excludes Awake and inFocus since these are proprietary ThemeForest distributed themes.

    If you choose to continue with BackStop Themes you can email admin@backstopthemes.com to be added to the BackStop Themes newsletter....welcome to the new community :-)

    I will have a BackStopThemes blog, support form and newsletter in place by the end of the month.

    BackStop Themes Update Instructions:
    --------------------------------
    Note: Always make a backup of your current system before upgrading your theme in case you want to roll back.

    Manual upgrade options are:
    a) Copy the new folder contents into the old folder; OR;
    b) Rename the old folder, upload the new folder; OR;
    c) Delete the old folder, upload the new folder

    I tend to use option b.

    Remember to download a copy of the old theme folder first as a backup. If you upgrade using option b or c you will need to copy your skin folder and css file from the backup theme copy folder to the new live theme folder.

    Kind regards,
    Tim

    Tim Hibberd - Managing Director
    OnePressTech Pty Ltd

    Posted 3 weeks ago #

Reply

You must log in to post.

Construct WordPress Theme
Construct wordpress theme
Myriad WordPress Theme
Myriad wordpress theme
Method WordPress Theme
Method wordpress theme
Fusion WordPress Theme
Fusion wordpress theme
Elegance WordPress Theme
Elegance wordpress theme
Echelon WordPress Theme
Echelon wordpress theme
Dejavu WordPress Theme
Dejavu wordpress theme
Modular WordPress Theme
Modular wordpress theme