PHP Warnings in BeTheme with PHP 8.4

Hi,

I’m using BeTheme 28.1.12 together with WordPress 6.8.3 and PHP 8.4, and I’m seeing several PHP Warnings that occur only when accessing certain BeTheme backend pages, such as:


  • wp-admin/admin.php?page=be-options
  • wp-admin/admin.php?page=be-changelog


In the server error log, these warnings appear repeatedly:




PHP Warning:  Undefined array key "std" in .../wp-content/themes/betheme/muffin-options/fields/color_multi/field_color_multi.php on line 17;

PHP Warning:  foreach() argument must be of type array|object, null given in .../wp-content/themes/betheme/muffin-options/fields/color_multi/field_color_multi.php on line 17;

PHP Warning:  foreach() argument must be of type array|object, null given in .../wp-content/themes/betheme/muffin-options/fields/color_multi/field_color_multi.php on line 17', referer: .../wp-admin/admin.php?page=be-options




They don’t cause any fatal errors and the frontend works normally, but the warnings are logged every time those backend pages are opened.


It looks like some internal option values or array keys may not be defined when running under PHP 8.4, which is stricter with undefined indexes and null array offsets.


Could you please confirm if these warnings are expected and whether there is an upcoming fix or adjustment to improve compatibility with PHP 8.4 for these sections of the BeTheme panel?


Thanks.

Comments

  • Hi,

    I have passed it on to the dev team, and we will correct that.


    Best regards

  • edited November 29

    Good morning,

    I wanted to add the following information:


    I've noticed that, in addition to what I mentioned earlier, I also occasionally see the following logs:


    [24-Nov-2025 15:02:31 UTC] PHP Deprecated: preg_replace(): Passing null to parameter #3 ($subject) of type array|string is deprecated in .../wp-includes/kses.php on line 1807

    [24-Nov-2025 15:02:31 UTC] PHP Deprecated: htmlentities(): Passing null to parameter #1 ($string) of type string is deprecated in .../wp-content/themes/betheme/functions/theme-functions.php on line 1936


    Best regards.

  • Thanks for letting us know.

    I will pass this information as well.


    Best regards

  • Hi,

    After updating to WP 6.9, I've received more warnings:



    ------------------------------------------------------------

    1) "Array to string conversion" warnings

    ------------------------------------------------------------


    These warnings appear hundreds of times in the log, always referencing the same file and line:


    PHP Warning: Array to string conversion 

    .../wp-content/themes/betheme/functions/admin/class-mfn-helper.php:96



    ------------------------------------------------------------

    2) Missing CSS includes (This is a blog post for which I have a single post template, but the post itself is a plain blog entry without any custom styles anywhere.)

    ------------------------------------------------------------


    PHP Warning: include_once(.../wp-content/uploads/betheme/css/post-630.css): Failed to open stream: No such file or directory 

    .../wp-content/themes/betheme/functions/theme-head.php:877


    PHP Warning: include_once(): Failed opening '/wp-content/uploads/betheme/css/post-630.css' for inclusion 

    .../wp-content/themes/betheme/functions/theme-head.php:877


    This occurs repeatedly and appears to be tied to dynamically generated CSS files that were never created or were removed.



    ------------------------------------------------------------

    3) Deprecated PHP warning triggered indirectly through theme execution

    ------------------------------------------------------------


    PHP Deprecated: preg_replace(): Passing null to parameter #3 ($subject) is deprecated 

    .../wp-includes/kses.php:2018




    ------------------------------------------------------------

    Environment details

    ------------------------------------------------------------


    - WordPress: 6.9 

    - PHP: 8.4 

    - BeTheme 28.1.13 



    Best regards

  • Thanks for being alert.

    I have informed the dev team about that.


    Best regards

  • We have prepared a correction for the first two, but to check the last one, we would need WP and FTP access to do a full debug process, as we are not able to replicate that.


    Best regards

  • I understand that you are referring to the issue of "kses.php".

    If so, the truth is that this particular one appears very rarely.

    I don't know if you use this directly or if it is native to WP.


    If you can tell me in which cases it can be used (related to BeTheme) I can do tests (since as I told you in other tickets I have people developing and it is difficult for me to give you access currently, as I did other times).


    From what I have been investigating the problem is that as of PHP 8.1+ passing null is no longer allowed.

    This does NOT break the website, but it indicates that some plugin or theme (most likely the BeTheme / BeBuilder builder) is sending null values ​​to the filter that WordPress uses to clean HTML.


    As kses.php receives data I understand what can happen: 

    1. BeTheme or its builder generates dynamic content 

    2. Some of your filters pass null to functions like wp_kses() 

    3. WordPress tries to sanitize it → reaches kses.php 

    4. preg_replace() receives null → warning appears


    I assume this notice appears when: 

    • builder blocks are loaded from AJAX 

    • there are empty shortcodes 

    • a dynamic field returns null or false 

    • HTML that is not present in some contexts is processed



    I understand that, if this is the reason, one of the solutions would be to validate that the content is a string type:


    $content = $content ?? '';


    before calling filters that go through wp_kses().



    Just an idea in case it helps.


    Best regards

  • edited December 9

    Yes we relate to wp_kses, but we are not yet sure what is triggering it. It does not have to be a direct call inside the theme or a plugin; it may also be invoked indirectly by another function that contains a wp_kses call. To debug this, you need to add the code below in the kses.php file at line 2018 and then review the logs to identify what is causing the invocation.

    if ( is_null( $content ) ) {
        error_log( 'WP_KSES DEPRECATION TRACER: Found NULL subject. Backtrace:' );
        error_log( print_r( wp_debug_backtrace_summary( null, 0, false ), true ) );
    }
    

    Best regards

  • Hi,

    I've implemented debugging in the wp_kses_no_null function and I'll let you know when I see any related results in the log.

Sign In or Register to comment.
This website uses cookies

We use cookies to personalise content and ads, to provide social media features and to analyse our traffic. We also share information about your use of our site with our social media, advertising and analytics partners who may combine it with other information that you’ve provided to them or that they’ve collected from your use of their services.

Cookies are small text files that can be used by websites to make a user's experience more efficient.

The law states that we can store cookies on your device if they are strictly necessary for the operation of this site. For all other types of cookies we need your permission. This means that cookies which are categorized as necessary, are processed based on GDPR Art. 6 (1) (f). All other cookies, meaning those from the categories preferences and marketing, are processed based on GDPR Art. 6 (1) (a) GDPR.

This site uses different types of cookies. Some cookies are placed by third party services that appear on our pages.

You can at any time change or withdraw your consent from the Cookie Declaration on our website.

Learn more about who we are, how you can contact us and how we process personal data in our Privacy Policy.

Please state your consent ID and date when you contact us regarding your consent.