[wp-trac] [WordPress Trac] #59154: PHP Deprecated: ltrim():
WordPress Trac
noreply at wordpress.org
Mon Aug 21 04:03:41 UTC 2023
#59154: PHP Deprecated: ltrim():
-------------------------------+-----------------------------
Reporter: codersantosh | Owner: (none)
Type: defect (bug) | Status: new
Priority: normal | Milestone: Awaiting Review
Component: General | Version: 6.3
Severity: normal | Keywords:
Focuses: php-compatibility |
-------------------------------+-----------------------------
PHP Deprecated: ltrim(): Passing null to parameter #1 ($string) of type
string is deprecated in wp-includes/formatting.php on line 4477
To reproduce:
{{{#!php
next_posts( $max_num_pages, false );
}}}
When $max_num_pages is 1,
PHP version: 8.1
Possible solution:
{{{#!php
<?php
function next_posts( $max_page = 0, $display = true ) {
$link = get_next_posts_page_link( $max_page );
$output = '';
if( $link ){
$output = esc_url( $link );
}
if ( $display ) {
echo $output;
} else {
return $output;
}
}
}}}
--
Ticket URL: <https://core.trac.wordpress.org/ticket/59154>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list