Ticket #1082 (closed defect (bug): fixed)
Superfluous newlines added to .htaccess on update
| Reported by: |
|
Owned by: |
|
|---|---|---|---|
| Priority: | normal | Milestone: | 2.1 |
| Component: | General | Version: | 2.0 |
| Severity: | minor | Keywords: | has-patch commit |
| Cc: | Blu_Matt, sjmurdoch |
Description
After a page update, when only the content has changed (i.e. no change to the page slug or choice of parent page) the .htaccess gets rewritten, undoing any customisations.
Attachments
Change History
- Version changed from 1.5 to 2.0
- Milestone set to 2.0
I experience something similar: it adds blank lines everytime a page is edited (edited or moved). Eg every time I edit the content or move a page it adds 1 blank line, thus adding 1 byte.
- Keywords bg|has-patch added
- Owner changed from anonymous to ryan
- Severity changed from enhancement to minor
- Milestone changed from 2.0 to 2.0.1
Attached stunt-htaccess.diff fixes the newline issue.
If you are customizing .htaccess between the WordPress markers, you are cutting your own throat if you don't do it programmatically. Use the API or make the file unwritable.
- Component changed from Optimization to General
- Summary changed from .htaccess rewritten after trivial page update to Superfluous newlines added to .htaccess on update
As the main point of this ticket seems to have moved from the fact that .htaccess is updated to that when it is updated, extra newlines are added (and the included patch fixes this), I have updated the summary accordingly.
This bug can be reproduced by clicking "Update Permanlink Structure >>" in "Customize Permalink Structure", even if no changes are made to the settings. This appears to be fixed by the attached patch.
- Keywords has-patch commit added; bg|has-patch bg|needs-testing bg|commit removed
I may be playing semantics but the reasoning is that the code should be checking if the N-th element in the array is the second to last element not if the N+1-th element is the last element.
This may be a little more meaninful:
+ if ($state) {
+ fwrite($f, "{$markerline}");
+ if ( $n < count($markerdata) - 1)
+ fwrite($f, "\n");
+ }
Either, this seems ready for a commit.

