Make WordPress Core

Opened 14 months ago

Closed 4 months ago

Last modified 4 months ago

#59275 closed defect (bug) (invalid)

PHP 8.1 Deprecated function: rtrim(): Passing null to parameter

Reported by: srishtis's profile srishtis Owned by:
Milestone: Priority: normal
Severity: normal Version: 6.2.2
Component: Formatting Keywords:
Focuses: php-compatibility Cc:

Description (last modified by hellofromTonya)

Deprecated - rtrim(): Passing null to parameter #1 ($string) of type string is deprecated

used in

wp-includes/formatting.php:2809
rtrim()
wp-includes/formatting.php:2809
untrailingslashit()
wp-includes/formatting.php:2794
trailingslashit()
wp-content/mu-plugins/http-concat/concat-utils.php:27
WPCOM_Concat_Utils::realpath()
wp-content/mu-plugins/http-concat/cssconcat.php:84
WPcom_CSS_Concat->do_items()
wp-includes/functions.wp-styles.php:68
wp_print_styles()
wp-includes/class-wp-hook.php:308
do_action('wp_head')
wp-includes/general-template.php:3049
wp_head()
wp-includes/template-canvas.php:17

MU Plugin: http-concat

Change History (3)

#1 @srishtis
14 months ago

Also Found in WP version 6.3 and version 6.3.1

#2 @hellofromTonya
4 months ago

  • Description modified (diff)

#3 @hellofromTonya
4 months ago

  • Milestone Awaiting Review deleted
  • Resolution set to invalid
  • Status changed from assigned to closed

Hello @srishtis,

Welcome to WordPress Core's Trac :)

I'm sorry it's taken this long for someone to action on your ticket.

Thank you for providing the call stack with the deprecation notice. This is very helpful and much appreciated.

Looking at these calls:

wp-includes/formatting.php:2809
rtrim()
wp-includes/formatting.php:2809
untrailingslashit()
wp-includes/formatting.php:2794
trailingslashit()

each of these functions requires a non-nullable string. Passing null to any of them is incorrect. Thus the deprecation notice being thrown is correct and (somewhat) informative to alert of the incorrect data type.

What's passing null to them? Looking at the call stack, http-concat must-use is invoking trailingslashit() here:

wp-content/mu-plugins/http-concat/concat-utils.php:27
WPCOM_Concat_Utils::realpath()

Something on the site or within that must-use is likely the root cause, with what's known in this ticket.

What's the next step?

I'd advise opening a support ticket with WPCOM hosting for them to investigate what's happening and why.

I'll close this ticket as invalid. Though that resolution term might seem harsh, what it means is: the ticket appears to be a support request, rather than a bug within the WordPress Core source code.

What if WPCOM advises the root cause is within Core itself?

Then please reopen this ticket and provide the details they shared as well as other information such as a step-by-step instructions on how to reproduce the issue. This kind of information helps contributors attempt to reproduce the issue as the starting point for diagnosing what might be happening.

Last edited 4 months ago by hellofromTonya (previous) (diff)
Note: See TracTickets for help on using tickets.