Make WordPress Core

Opened 4 months ago

Last modified 3 months ago

#43304 new defect (bug)

Data type of deprecated parameter of load_plugin_textdomain function should be bool and not string

Reported by: sudar Owned by:
Milestone: 5.0 Priority: normal
Severity: normal Version: trunk
Component: I18N Keywords: has-patch
Focuses: docs, administration, coding-standards Cc:


The second parameter of the load_plugin_textdomain function has been deprecated. The default value of this parameter is set to false and if we pass anything other than false, then a deprecated notice is triggered.

        if ( false !== $plugin_rel_path ) {
                $path = WP_PLUGIN_DIR . '/' . trim( $plugin_rel_path, '/' );
        } elseif ( false !== $deprecated ) {
                _deprecated_argument( __FUNCTION__, '2.7.0' );
                $path = ABSPATH . trim( $deprecated, '/' );
        } else {
                $path = WP_PLUGIN_DIR;

But in the phpdoc block of this function the second parameter is still specified as string. But in practise the only value that can be passed to this function that does not trigger a deprecated warning is false.

This generates a error in lot of static code analysers/services like scrutinizer that deduces the data type of the parameter from phpdoc block.

The data type of the parameter should be changed to either bool or should be explicitly stated as false (even better)

Attachments (3)

43304.diff (807 bytes) - added by sudar 4 months ago.
Patch to fix the phpdoc blcok
43304.1.patch (806 bytes) - added by hardik2221 4 months ago.
43304.2.patch (807 bytes) - added by hardik2221 4 months ago.

Download all attachments as: .zip

Change History (7)

4 months ago

Patch to fix the phpdoc blcok

#1 @hardik2221
4 months ago

  • Focuses administration added
  • Keywords has-patch added

I have made changes to existing patch.

4 months ago

#2 @sudar
4 months ago

@hardik2221 Any specific reason for changing it from false to bool?

Also in your patch the @param statements are not aligned.

#3 @hardik2221
4 months ago

I think it is the parameter type bool where it will take the value true or false.

4 months ago

#4 @SergeyBiryukov
3 months ago

  • Milestone changed from Awaiting Review to 5.0
Note: See TracTickets for help on using tickets.