[wp-trac] [WordPress Trac] #58723: Remove deprecated parameter tests in comments_link()

WordPress Trac noreply at wordpress.org
Sun Aug 27 10:29:05 UTC 2023


#58723: Remove deprecated parameter tests in comments_link()
-----------------------------------------+------------------------------
 Reporter:  Cybr                         |       Owner:  (none)
     Type:  defect (bug)                 |      Status:  new
 Priority:  normal                       |   Milestone:  Awaiting Review
Component:  Comments                     |     Version:
 Severity:  normal                       |  Resolution:
 Keywords:  reporter-feedback has-patch  |     Focuses:  performance
-----------------------------------------+------------------------------

Comment (by Cybr):

 To clarify: `if ( empty( $var ) )` is OK, `if ( ! empty( $var ) )` isn't
 unless the variable might not exist. If the variable certainly exists, use
 a simple `if ( $var )` check.

 Due to this misunderstanding, the attached PR breaks many things by
 flipping the boolean.

 Nevertheless, I assume we want to keep the "final argument that is
 deprecated" for forward compatibility.
 Then, yes, adding deprecation notices for their use would be helpful.

 Please note that it might be better to deprecate these functions
 altogether and rewrite them for improved performance.

 I don't think there's a net benefit of having developer-focused heavy
 "if"-jumps in functions that can be used thousands of times during
 production runtime.

 Offenders include `convert_chars()`, `is_email()`, `switch_to_blog()`, and
 `get_site_option()`.

 There's also something to be said about keeping deprecations from back to
 WordPress 0.71 alive (20 years ago!), like we do in `convert_chars()`. If
 we can throw away backward compatibility for half the code in 5.0, we
 might as well consider doing that for earlier versions.

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


More information about the wp-trac mailing list