[wp-trac] [WordPress Trac] #61268: PHP Deprecated: ltrim() in formatting esc_url.

WordPress Trac noreply at wordpress.org
Thu May 23 09:47:47 UTC 2024


#61268: PHP Deprecated:  ltrim() in formatting esc_url.
--------------------------+------------------------------
 Reporter:  neo2k23       |       Owner:  (none)
     Type:  defect (bug)  |      Status:  new
 Priority:  normal        |   Milestone:  Awaiting Review
Component:  Formatting    |     Version:
 Severity:  normal        |  Resolution:
 Keywords:                |     Focuses:
--------------------------+------------------------------

Comment (by siliconforks):

 Replying to [comment:5 neo2k23]:
 > Until php 8.1 there was no warning and the return would still be a empty
 url. What is against checking in the esc_url function?

 The problem is that when a caller calls `esc_url()` with an empty
 argument, it's almost always a bug in the caller, so it's better to fix it
 in the caller's code.  In the case of the Maintenance plugin - their code
 is subtly wrong (I didn't notice this at first - thanks to @sabernhardt
 for pointing this out) - it's calling `bloginfo()` instead of
 `get_bloginfo()`.  So that's an issue which needs to be fixed in their
 code.  Modifying `esc_url()` to eliminate the warning would really just be
 masking the issue - it wouldn't actually be fixing the source of the
 problem.

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/61268#comment:6>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list