Make WordPress Core

Opened 4 years ago

Closed 3 years ago

#56482 closed defect (bug) (wontfix)

potential null pointer error

Reported by: kbiegert Owned by:
Priority: normal Milestone:
Component: Script Loader Version: 6.0.2
Severity: normal Keywords: has-patch php81
Cc: Focuses:

Description (last modified by SergeyBiryukov)

In wp-includes/script-loader.php near line 2406 within function wp_global_styles_render_svg_filters() the function get_current_screen() can be null causing a null pointer.

Proposal is to add a null check before use:

if (
        is_admin() &&
        get_current_screen() != null &&
        ! get_current_screen()->is_block_editor()
    ) 

Change History (4)

This ticket was mentioned in PR #3163 on WordPress/wordpress-develop by kbiegert.


4 years ago
#1

  • Keywords has-patch added

Prevent null pointer.

Trac ticket: [](https://core.trac.wordpress.org/ticket/56482#ticket)

#2 @SergeyBiryukov
4 years ago

  • Description modified (diff)

#3 @jrf
4 years ago

  • Keywords php81 added

PHP does not have the concept of a null point error.

I presume you mean you are seeing a "passing null to non-nullable" deprecation notice on PHP 8.1 ?

#4 @hellofromTonya
3 years ago

  • Milestone Awaiting Review
  • Resolutionwontfix
  • Status newclosed

The wp_global_styles_render_svg_filters() function where this error occurred is deprecated in WP 6.3 via [56101] / #58555.

The issue within the function is not fixed. However, Core no longer calls this function. Since it's deprecated, it should no longer be used.

I'll close this ticket as wontfix. I'm using that resolution type because the function itself will not be changed now that it's deprecated.

Thank you everyone for your contributions!

Note: See TracTickets for help on using tickets.