Skip to:

Opened 4 years ago

Closed 4 years ago

#8288 closed defect (bug) (fixed)

PHP 7.4 Notice: Trying to access array offset...

Reported by: mercime's profile mercime Owned by: r-a-y's profile r-a-y
Milestone: 6.0.0 Priority: normal
Severity: normal Version:
Component: Core Keywords: has-patch commit


Member pages and Group pages:
PHP Notice: Trying to access array offset on value of type int in on line 904

  • on WP trunk and BP trunk

Attachments (1)

8288.01.patch (4.2 KB) - added by r-a-y 4 years ago.

Download all attachments as: .zip

Change History (7)

#1 @r-a-y
4 years ago

  • Keywords has-patch added
  • Milestone changed from Awaiting Review to 6.0.0

Seems to be caused by WP 5.4.1 due to the seems_utf8() check used in sanitize_file_name():

seems_utf8() throws this notice when an integer value is passed and we do so in a few spots.

Attached patch fixes this by removing sanitize_file_name() when we're passing integer values.

Last edited 4 years ago by r-a-y (previous) (diff)

4 years ago

#3 @imath
4 years ago

  • Keywords commit added

Thanks a lot for your patch @r-a-y : looks good to me 👌

This ticket was mentioned in Slack in #buddypress by imath. View the logs.

4 years ago

#5 @mercime
4 years ago

Thank you @r-a-y, two thumbs up!

#6 @r-a-y
4 years ago

  • Owner set to r-a-y
  • Resolution set to fixed
  • Status changed from new to closed

In 12647:

Do not use sanitize_file_name() when passing integer values.

Fixes an array offset notice due to the addition of seems_utf8() in
sanitize_file_name() for WordPress 5.4.1:

Props mercime, r-a-y.

Fixes #8288.

Note: See TracTickets for help on using tickets.