[wp-trac] [WordPress Trac] #54721: wptexturize caches the result of run_wptexturize preventing themes from using this if a plugin has already called get_plugin_data

WordPress Trac noreply at wordpress.org
Tue Jul 2 21:56:32 UTC 2024


#54721: wptexturize caches the result of run_wptexturize preventing themes from
using this if a plugin has already called get_plugin_data
--------------------------+------------------------------
 Reporter:  tremlas       |       Owner:  (none)
     Type:  defect (bug)  |      Status:  closed
 Priority:  normal        |   Milestone:  Awaiting Review
Component:  Formatting    |     Version:  5.8.2
 Severity:  normal        |  Resolution:  invalid
 Keywords:  2nd-opinion   |     Focuses:
--------------------------+------------------------------
Changes (by bobbingwide):

 * keywords:   => 2nd-opinion
 * status:  new => closed
 * resolution:   => invalid


Comment:

 I've found a scenario where the reset logic doesn't work.


 If `wptexturize()` has already been run and the `run_texturize` filter had
 been set to `__return_false`
 by an activated plugin then it's not possible to use the `$reset`
 parameter since the following code is executed before anything else.


 {{{
 // If there's nothing to do, just stop.
         if ( empty( $text ) || false === $run_texturize ) {
                 return $text;
         }
 }}}


 This problem happens to occur in my own PHPUnit tests where I tried to re-
 enable wptexturize's processing using:
 {{{
 remove_filter( 'run_wptexturize', '__return_false', 10);
 wptexturize( '', true );
 }}}


 ... which is ironic.


 Also, the comment
 {{{
 The filter runs only once, the first time wptexturize() is called.
 }}}
 isn't completely true.
 It's run when $reset is true and $run_texturize is true.

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


More information about the wp-trac mailing list