[wp-trac] [WordPress Trac] #55069: Optimize POMO_FileReader.read_all() using stream_get_contents()

WordPress Trac noreply at wordpress.org
Sun Feb 13 15:07:02 UTC 2022


#55069: Optimize POMO_FileReader.read_all() using stream_get_contents()
---------------------------+-----------------------------
 Reporter:  maxkellermann  |       Owner:  SergeyBiryukov
     Type:  enhancement    |      Status:  accepted
 Priority:  normal         |   Milestone:  6.0
Component:  I18N           |     Version:
 Severity:  normal         |  Resolution:
 Keywords:  has-patch      |     Focuses:  performance
---------------------------+-----------------------------

Comment (by SergeyBiryukov):

 Replying to [comment:14 SergeyBiryukov]:
 > Yes, on second thought, we can just add error suppression for the
 `dir()` call.

 Hmm, it looks like `is_readable()` was added in [45611/trunk/src/wp-
 admin/includes/class-wp-filesystem-direct.php] specifically to remove
 error suppression from the `dir()` call, so the patch reverts that part of
 the changeset. It also causes a WPCS warning:
 {{{
 FILE: src\wp-admin\includes\class-wp-filesystem-direct.php
 ----------------------------------------------------------------------
 FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
 ----------------------------------------------------------------------
  609 | WARNING | Silencing errors is strongly discouraged. Use proper
      |         | error checking instead. Found: @dir( $path ...
      |         | (WordPress.PHP.NoSilencedErrors.Discouraged)
 ----------------------------------------------------------------------
 }}}

 So we would need a `// phpcs:ignore` comment here.

 See [attachment:"0002-class-wp-filesystem-direct-remove-unnecessary-
 is_dir.2.patch"].

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


More information about the wp-trac mailing list