[Support request] Array null errors with ClassicPress using PHP 8

Home Forums Support [Support request] Array null errors with ClassicPress using PHP 8

Home Forums Support Array null errors with ClassicPress using PHP 8

Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • #2602919
    Graham

    I use the last version of GP and GP Premium that worked before blocks were required with GP, because I run ClassicPress instead of WordPress.

    Everything is fine using PHP 7.x but when I use 8.x I get errors saying “Trying to access array offset on value of type null….”

    The two files it complains about are:
    gp-premium/page-header/functions/functions.php
    gp-premium/blog/functions/images.php

    The types of lines it doesn’t like are:
    if ( '' !== $options[ 'content' ] ) {

    I realize I’m using old versions, but was wondering if there is now a new way of wording the “if” statement where the array is ” meaning empty (Null) I assume.

    Did some searching on Google but couldn’t find any answers. Tried using the word empty instead, but that didn’t work.

    Thanks in advance.

    #2603272
    Leo
    Staff
    Customer Support

    Hi Graham,

    Sorry, I’m not familiar with ClassicPress – What’s the advantage of using that over the Classic Editor plugin?

    And just to confirm, do you see the same issue when using WordPress?

    #2603308
    Graham

    ClassicPress is a fork of WordPress 4.9 and has no Gutenberg code or functions. It works the same as WP used to, with the TinyMCE editor as the only editor.

    The code works fine with PHP 7.x but throws an error with PHP 8.x

    The ” option appears to be incompatible with the newer PHP. It causes a PHP error as a syntax type error for a null value.

    I was just hoping someone might know why and if there was a different value you need to use.

    #2603341
    Leo
    Staff
    Customer Support

    I’ll forward this to our developer to check 🙂

    #2603825
    David
    Staff
    Customer Support

    Hi there,

    try changing that line to:

    if ( isset( $options['content'] ) ) {

    #2603920
    Graham

    That fixed the error in gp-premium/blog/functions/images.php

    But there are over 25 similar errors in gp-premium/page-header/functions/functions.php

    And they are all worded differently. They all have if ( ” at the start, but the rest of the line is different.

    I tried the fix on one line and it produced even more errors. I’m afraid it’s all a bit beyond me.

    Guess I’ll just have to stick with PHP 7.4

    Thanks for your help anyway.

    #2603997
    David
    Staff
    Customer Support

    Yeah their could be a quite a lot of changes. And the old Page Headers module has been deprecated some time now, so we wont be updating that.

    You could of course use the Header Element instead in the latest version of GeneratePress, that is still suppprted and that does not require blocks. The only functions that GP requires blocks for is the Block Element…

    #2604020
    Graham

    Actually, the change I made to gp-premium/blog/functions/images.php caused the post featured image to appear on single posts, so I had to undo that.

    The original post I made when GP stopped working on CP is:

    https://generatepress.com/forums/topic/cannot-configure-gp-premium-on-new-classicpress-site/

    So, I’ve gotten a couple of extra years out of it. Just have to hope PHP 7.4 is still available with my hosting for a few more years too.

Viewing 8 posts - 1 through 8 (of 8 total)
  • You must be logged in to reply to this topic.