[wp-trac] [WordPress Trac] #42579: Issue after Changeset 41928

WordPress Trac noreply at wordpress.org
Thu Nov 16 12:44:10 UTC 2017


#42579: Issue after Changeset 41928
----------------------------+-----------------------------
 Reporter:  stodorovic      |      Owner:
     Type:  defect (bug)    |     Status:  new
 Priority:  normal          |  Milestone:  Awaiting Review
Component:  Rewrite Rules   |    Version:  4.9
 Severity:  normal          |   Keywords:
  Focuses:  administration  |
----------------------------+-----------------------------
 I created simple PHP script to test function extract_from_markers:
 {{{#!php
 <?php
 include_once( __DIR__.'/wp-load.php' );
 require_once(ABSPATH . 'wp-admin/includes/admin.php');

 $wprules = extract_from_markers( ABSPATH.'.htaccess', 'WordPress' );

 var_dump( $wprules );
 }}}
 Result (WP 4.9):
 {{{
 array(0) {
 }
 }}}
 Result (WP 4.8.3):
 {{{
 array(9) {
   [0] =>
   string(24) "<IfModule mod_rewrite.c>"
   [1] =>
   string(16) "RewriteEngine On"
   [2] =>
   string(13) "RewriteBase /"
   [3] =>
   string(30) "RewriteRule ^index\.php$ - [L]"
   [4] =>
   string(35) "RewriteCond %{REQUEST_FILENAME} !-f"
   [5] =>
   string(35) "RewriteCond %{REQUEST_FILENAME} !-d"
   [6] =>
   string(28) "RewriteRule . /index.php [L]"
   [7] =>
   string(11) "</IfModule>"
   [8] =>
   string(0) ""
 }
 }}}

 It seems that's bug and correct code should be (function
 extract_from_markers):
 {{{#!php
         foreach ( $markerdata as $markerline ) {
                 if ( false !== strpos( $markerline, '# END ' . $marker ) )
 {
                         $state = false;
                 }
                 if ( $state ) {
                         $result[] = $markerline;
                 }
                 if ( false !== strpos( $markerline, '# BEGIN ' . $marker )
 ) {
                                 $state = true;
                 }
         }
 }}}

 Related topic: https://wordpress.org/support/topic/rewrite-rules-must-be-
 updated-message-on-wordpress-4-9/

 Thanks in advance,
 Sasa

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


More information about the wp-trac mailing list