[wp-trac] [WordPress Trac] #26829: Use of strpos() in extract_from_markers() and insert_with_markers() can target wrong BEGIN and END markers.

WordPress Trac noreply at wordpress.org
Sat May 20 13:42:26 UTC 2017


#26829: Use of strpos() in extract_from_markers() and insert_with_markers() can
target wrong BEGIN and END markers.
--------------------------------------+-----------------------------
 Reporter:  Faison                    |       Owner:
     Type:  defect (bug)              |      Status:  new
 Priority:  normal                    |   Milestone:  Future Release
Component:  Rewrite Rules             |     Version:  2.0
 Severity:  normal                    |  Resolution:
 Keywords:  has-patch has-unit-tests  |     Focuses:
--------------------------------------+-----------------------------
Changes (by chesio):

 * keywords:  has-patch has-unit-tests needs-refresh => has-patch has-unit-
     tests


Comment:

 Hi,

 I run into this issue too and subsequently found this old ticket.

 I propose a slightly different fix in my patch. Since both
 `extract_from_markers()` and `insert_with_markers()` functions need to
 split input lines in the same way, I re-factored the splitting part into
 separate function. Benefits are consistency and easier unit testing.

 Btw. this is the first time I submit unit tests for WordPress, so I'd be
 glad for any comments on what could be done better.

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


More information about the wp-trac mailing list