[wp-trac] [WordPress Trac] #63865: Replace warning-suppression with error-handler in _wp_can_use_pcre_u

WordPress Trac noreply at wordpress.org
Sat Aug 23 03:01:34 UTC 2025


#63865: Replace warning-suppression with error-handler in _wp_can_use_pcre_u
-------------------------+--------------------
 Reporter:  dmsnell      |      Owner:  (none)
     Type:  enhancement  |     Status:  new
 Priority:  normal       |  Milestone:  6.9
Component:  Charset      |    Version:  trunk
 Severity:  normal       |   Keywords:
  Focuses:               |
-------------------------+--------------------
 Follow-up to [45611].
 See #47632.

 A WPCS “ignore” comment was added to `_wp_can_use_pcre_u()` to silence
 alarms about the use of warning-suppression, which generally is
 problematic. While this silenced WPCS, it left the issue in Core.

 Warning suppression can be problematic:
  - It can mask and conflate unintended warnings.
  - It bypasses existing error-handling.
  - Some errors are not suppressed.

 In this case, the WPCS rule is actually helpful in pointing out risk,
 though it has not led to updating the code. The function can implement a
 specific error-handler to focus on the specific detection it wants to
 make: whether Unicode PCRE patterns are supported.

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/63865>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list