is not used any more and exists only for history. Post new tickets on the Github account. n'est plus utilisée, et existe uniquement pour son historique. Postez les nouveaux tickets sur le compte github.

Opened 13 years ago

Closed 13 years ago

#697 closed bug (fixed)

jIniFileModifier adds unusefull "\n"

Reported by: doubleface Owned by: doubleface
Priority: normal Milestone: Jelix 1.1 beta 1
Component: jelix:utils Version: trunk
Severity: minor Keywords:
Cc: Blocked By:
Blocking: Documentation needed: no
Hosting Provider: Php version:


If you load a ini file and save it n times, you get n empty lines between the original lines :







and becomes





after each jInifile::save().

See the joined patch

Attachments (1)

jInifileModifier.patch (1.1 KB) - added by doubleface 13 years ago.

Download all attachments as: .zip

Change History (2)

Changed 13 years ago by doubleface

comment:1 Changed 13 years ago by laurentj

  • Component changed from jelix to jelix:utils
  • Milestone set to Jelix 1.1 beta 1
  • Resolution set to fixed
  • review changed from review? to review-
  • Status changed from new to closed

In fact, the problem is not these added line break but the function used to read each line of the file (file() function). It seems you edit your ini file with an editor which generates \r or \r\n instead of single \n. So by removing them in your patch, you completely broke the behavior of the class for developers who edit their ini file with \n as line breaks (If you run unit-tests, you can see your error ;-)).

So I just changed the function and replaced ot by a file_get_contents + preg_split.

Note: See TracTickets for help on using tickets.