Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PHP 8.1: fix passing null to non-nullable deprecation #72

Merged
merged 2 commits into from
Oct 4, 2023

Conversation

mustafauysal
Copy link
Contributor

@mustafauysal mustafauysal commented Jan 18, 2023

It seems rtrim() expects to be passed a non-nullable string on PHP 8.1. Passing null results rtrim(): Passing null to parameter #1 ($string) of type string is deprecated notice.

Ref:

@lomeraniel
Copy link

Noting here that a VIP customer is facing this issue:

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

Trace from QM:
wp-includes/formatting.php:2827
rtrim()
wp-includes/formatting.php:2827
untrailingslashit()
wp-includes/formatting.php:2812
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:310
do_action('wp_head')
wp-includes/general-template.php:3053
wp_head()
wp-content/themes/dispatch/header.php:48
load_template('wp-content/themes/dispatch/header.php')
wp-includes/template.php:720
locate_template()
wp-includes/general-template.php:48
get_header()
wp-content/themes/dispatch/front-page.php:15

@mustafauysal
Copy link
Contributor Author

@lomeraniel could you give it a try on the root domain without having a trailingslash? ( e.g. example.com without / at the end )

@bytesizeguru
Copy link

Another VIP customer reporting the same issue today:

Deprecated rtrim(): Passing null to parameter [#1](https://wordpressvip.zendesk.com/agent/tickets/1) ($string) of type string is deprecated 183
wp-includes/formatting.php:2827
MU Plugin: http-concat
wp-includes/formatting.php:2827
rtrim()
wp-includes/formatting.php:2827
untrailingslashit()
wp-includes/formatting.php:2812
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/script-loader.php:2244
print_admin_styles()
wp-includes/class-wp-hook.php:310
do_action('admin_print_styles')
wp-admin/admin-header.php:132

@rodruiz
Copy link

rodruiz commented Sep 29, 2023

VIP customer here. We are having the same issue on our dev environment.

wp-includes/formatting.php:2827
rtrim()
wp-includes/formatting.php:2827
untrailingslashit()
wp-includes/formatting.php:2812
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:310
do_action('wp_head')
wp-includes/general-template.php:3053
wp_head()
wp-content/themes/rjth2019/header.php:44
load_template('wp-content/themes/rjth2019/header.php')
wp-includes/template.php:720
locate_template()
wp-includes/general-template.php:48
get_header()
wp-content/themes/rjth2019/single-post.php:21

Copy link

@emreerkan emreerkan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@rebeccahum
Copy link

Reproduced, fix works thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants