Several errors needed to fix
#1
Issue 1: libxml_disable_entity_loader() deprecated

    Files:

    - inc/class_parser.php:2060

    Error:

   
Function libxml_disable_entity_loader() is deprecated since PHP 8.0,
    as external entity loading is disabled by default

    Call chain:

    1. portal.php:664 → parse_message()
    2. class_parser.php:284 → output_allowed()
    3. class_parser.php:2025 → validate_output()
    4. class_parser.php:2060 → @libxml_disable_entity_loader(true)

    Fix: The function libxml_disable_entity_loader() was deprecated in PHP 8.0 because
    external entity loading is now disabled by default. The call should be wrapped in a
    version check:

   
if (PHP_VERSION_ID < 80000) {
        @libxml_disable_entity_loader(true);
    }


    Issue 2: preg_replace() receives null subject

    File: inc/functions.php:5730

    Error:

   
preg_replace(): Passing null to parameter #3 ($subject) of type array|string is
    deprecated


    Call chain:

   
1. portal.php:581 → htmlspecialchars_uni()
2. functions.php:5730 → preg_replace("#&(?!\#[0-9]+;)#si", "&", $message)


    Root cause: The function htmlspecialchars_uni($message) does not handle null input. When
    called with a null value (e.g., a post field that is NULL in the database), preg_replace(
    ) receives null as the subject parameter, which is deprecated in PHP 8.1+.

    Fix: Add a type cast or null guard at the top of htmlspecialchars_uni():

   
function htmlspecialchars_uni($message)
    {
        $message = (string)$message;
        // ... existing logic
    }


    Or alternatively:

   
function htmlspecialchars_uni($message)
    {
        if ($message === null) {
            return '';
        }
        // ... existing logic
    }


Issue 3: mb_strpos() receives null haystack

     File: inc/functions.php:6284

     Error:

     
mb_strpos(): Passing null to parameter #1 ($haystack) of type string is deprecated

     Call chain:

     1. portal.php:618 → format_avatar()
     2. functions.php:3571 → my_strpos()
     3. functions.php:6284 → mb_strpos($haystack, $needle, $offset)

     Root cause: The function my_strpos($haystack, $needle, $offset) does not validate that
     $haystack is a string before passing it to mb_strpos(). When $haystack is null, PHP 8.1+
     emits a deprecation warning.

     Fix: Cast or validate the $haystack parameter at the top of my_strpos():

     
function my_strpos($haystack, $needle, $offset = 0)
     {
         $haystack = (string)$haystack;
         // ... existing logic
     }
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)