PHP Deprecated: ltrim(): Passing null to parameter #1 ($string) of type string
-
Getting these warnings in
debug.log
[20-Jan-2025 08:07:15 UTC] PHP Deprecated: ltrim(): Passing null to parameter #1 ($string) of type string is deprecated in .../wp-includes/formatting.php on line 4494
[20-Jan-2025 08:07:15 UTC] PHP Deprecated: ltrim(): Passing null to parameter #1 ($string) of type string is deprecated in .../wp-includes/formatting.php on line 4494
[20-Jan-2025 08:07:15 UTC] PHP Deprecated: ltrim(): Passing null to parameter #1 ($string) of type string is deprecated in .../wp-includes/formatting.php on line 4494Backtrace example:
#0 .../wp-includes/formatting.php(4622): esc_url(NULL, NULL, 'db')
#1 .../wp-content/plugins/event-post/eventpost.php(2410): sanitize_url(NULL)
#2 .../wp-includes/class-wp-hook.php(326): EventPost->save_postdata(167850)
#3 .../wp-includes/class-wp-hook.php(348): WP_Hook->apply_filters(167850, Array)
#4 .../wp-includes/plugin.php(517): WP_Hook->do_action(Array)
#5 .../wp-includes/post.php(4760): do_action('save_post', 167850, Object(WP_Post), true)
#6 .../wp-includes/post.php(4862): wp_insert_post(Array, false, true)
#7 .../wp-admin/includes/post.php(453): wp_update_post(Array)
#8 .../wp-admin/includes/ajax-actions.php(2138): edit_post()
#9 .../wp-includes/class-wp-hook.php(324): wp_ajax_inline_save('')
#10 .../wp-includes/class-wp-hook.php(348): WP_Hook->apply_filters(NULL, Array)
#11 .../wp-includes/plugin.php(517): WP_Hook->do_action(Array)
#12 .../wp-admin/admin-ajax.php(188): do_action('wp_ajax_inline-...')Current code:
2404: if (false !== $virtual_location = filter_input(INPUT_POST, $this->META_VIRTUAL_LOCATION, FILTER_SANITIZE_URL)) {
2405: update_post_meta($post_id, $this->META_VIRTUAL_LOCATION, sanitize_url($virtual_location));
2406: }Function
sanitize_url($virtual_location)
is called withNULL
value there.Suggested fix: Check values for
NULL
before use.Event post 5.9.8, WordPress 6.4.5
Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
- You must be logged in to reply to this topic.