#42579 closed defect (bug) (fixed)
Correct the logic in extract_from_markers()
Reported by: | stodorovic | Owned by: | SergeyBiryukov |
---|---|---|---|
Milestone: | 4.9.1 | Priority: | high |
Severity: | normal | Version: | 4.9 |
Component: | Rewrite Rules | Keywords: | fixed-major |
Focuses: | administration | Cc: |
Description
I created simple PHP script to test function extract_from_markers:
<?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):
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
Change History (6)
#1
@
7 years ago
- Milestone changed from Awaiting Review to 4.9.1
- Priority changed from normal to high
#2
@
7 years ago
- Owner set to SergeyBiryukov
- Resolution set to fixed
- Status changed from new to closed
#3
@
7 years ago
- Keywords fixed-major added
- Resolution fixed deleted
- Status changed from closed to reopened
Reopening for 4.9 branch.
Note: See
TracTickets for help on using
tickets.
In 42199: