Site logo

[Resolved] eval() d code 5 error within element hook

Home Forums Support [Resolved] eval() d code 5 error within element hook

Home Forums Support eval() d code 5 error within element hook

Viewing 14 posts - 16 through 29 (of 29 total)
  • Author
    Posts
  • #1315870
    Steve

    Just ran a PHP compatibility scan for 7.3 and received this error:

    FILE: /var/www/vhosts/mysite.uk/httpdocs/wp-content/themes/generatepress/page-editors.php
    ----------------------------------------------------------------------------------------------------------------
    FOUND 1 ERROR AFFECTING 1 LINE
    ----------------------------------------------------------------------------------------------------------------
     269 | ERROR | Function split() is deprecated since PHP 5.3 and removed since PHP 7.0; Use preg_split() instead
    #1315873
    Tom
    Lead Developer
    Lead Developer

    page-editors.php isn’t a file in GeneratePress. Did you add it to the theme?

    If so, you’ll want to move all custom code you’ve added to the parent theme to a child theme: https://docs.generatepress.com/article/using-child-theme/

    Then you’ll want to re-install a fresh copy of the parent theme.

    #1315888
    Steve

    That’s bizarre. I’m working with a copy of Generate Press originally installed by a previous designer and updated incrementally. It may be possible he placed files there. Just taken a look at it’s contents and it’s commented in Italian. If I were to delete the GP install entirely and upload a clean install downloaded direct from you guys, would that be a problem re-instating?

    #1316150
    Leo
    Staff
    Customer Support

    If I were to delete the GP install entirely and upload a clean install downloaded direct from you guys, would that be a problem re-instating?

    That would erase all the custom codes/files that doesn’t come with the theme by default.

    Your customizer settings will be saved as it’s in the database.

    I do recommend backing up your site before reinstalling.

    #1316165
    Steve

    Hi Leo, thanks for your advise. I am actually working from a child theme and did manage to overwrite the previous installation without losing any settings. Problem is, I’m still seeing this error. I’ve had a whole day of going back over error log files so may have to give my eyes a rest for tonight! Will take another look at this tomorrow. Any suggestions greatly appreciated!

    #1316170
    Steve

    Just as a final update for tonight;
    I just went to download a db optimisation plugin and noticed the ‘Add New’ button was missing from the Plugins management page. When I re-instated the line ‘define(‘DISALLOW_FILE_MODS’,true);’ in functions.php it re-appeared. Does this not mean it’s not being declared elsewhere?

    #1316240
    Leo
    Staff
    Customer Support

    Are you using any security plugins?

    It’s probably defined somewhere.

    #1316264
    Steve

    I use a User roles plugin but I already tried deactivating all plugins except GP premium and ACF and it still didn’t work.

    #1316553
    Steve

    This morning I now have an error message within the Hook admin
    Unable to execute PHP as DISALLOW_FILE_EDIT is defined.
    I have tried setting define('DISALLOW_FILE_MODS',false);
    in functions.php and I’ve tried taking it out altogether. I’ve also searched online to see if there is some kind of a scan I can perform to find where this code exists.
    I’m also writing to our webhosting company to see if the site may have been compromised.

    #1316931
    Leo
    Staff
    Customer Support

    Check your wp-config.php file for that:
    https://docs.generatepress.com/article/disallow-php-execution/

    #1316995
    Steve

    You’re right. When I comment out the one in wp-config.php the error message in Hooks admin page goes away but yet still, the PHP doesn’t execute in the Hook itself. I just can’t seem to find any clues as to where this is being blocked.

    #1317314
    Leo
    Staff
    Customer Support

    Does PHP execute in your child theme’s function.php file?

    #1317598
    Steve

    I thought to try a different approach in the hope to eliminate the possibility of any conflicts within the Hook PHP code capability by placing the Hook within my child theme’s functions.php as follows:

    function add_mixcloudplaylist(){
     if (is_singular ( 'dj' )) {
       add_action( 'generate_after_main_content', function(){
         echo '<h2>Latest Mixcloud uploads</h2>';
        echo '<div id="mixplaylists">';
    
    $page = get_page_by_path('my-slug');
    $page_id = is_object( $page ) ? $page->ID : '';
    get_field('mixcloud_playlist_code', $page_id);
    echo '</div>';
    }, 25);
     }
    }
    add_action( 'generate_after_main_content', 'add_mixcloudplaylist' );

    and it worked! I can only conclude there is something blocking PHP code being run from within GP Hooks but could not determine precisely what. Hope that helps someone.

    #1318145
    Leo
    Staff
    Customer Support

    Glad you’ve figured out 🙂

Viewing 14 posts - 16 through 29 (of 29 total)
  • The topic ‘eval() d code 5 error within element hook’ is closed to new replies.