Make WordPress Core

Opened 20 years ago

Closed 19 years ago

#1082 closed defect (bug) (fixed)

Superfluous newlines added to .htaccess on update

Reported by: blu_matt's profile Blu_Matt Owned by: ryan's profile ryan
Milestone: 2.1 Priority: normal
Severity: minor Version: 2.0
Component: General Keywords: has-patch commit
Focuses: Cc:

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 (1)

stunt-htaccess.diff (780 bytes) - added by skeltoac 19 years ago.

Download all attachments as: .zip

Change History (10)

#1 @Blu_Matt
20 years ago

  • Patch set to No

#2 @dissurion
19 years ago

  • Milestone set to 2.0
  • Version changed from 1.5 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.

#3 @skeltoac
19 years ago

  • Keywords bg|has-patch added
  • Milestone changed from 2.0 to 2.0.1
  • Owner changed from anonymous to ryan
  • Severity changed from enhancement to minor

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.

#4 @matt
19 years ago

  • Milestone changed from 2.0.1 to 2.1

#5 @sjmurdoch
19 years ago

  • Cc sjmurdoch added

#6 @sjmurdoch
19 years ago

  • 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.

#7 @davidhouse
19 years ago

  • Keywords bg|needs-testing bg|commit added

I

#8 @abhay
19 years ago

  • 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.

#9 @ryan
19 years ago

  • Resolution set to fixed
  • Status changed from new to closed

(In [3688]) Control those newlines. Props to that Andy guy. fixes #1082

Note: See TracTickets for help on using tickets.