note 53910 deleted from function.parse-ini-file by danbrown

From: Date: Sun, 23 Jan 2011 17:14:25 +0000
Subject: note 53910 deleted from function.parse-ini-file by danbrown
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-176169@lists.php.net to get a copy of this message
Note Submitter: phpcoder at cyberpimp dot pimpdomain dot com ---- Oops. There is a small bug in my writeINIfile code example submitted on 13-Jan-2005 11:31. How embarassing. The incorrect statement is: if (substr($comtext, -1, 1)==$commentchar && substr($comtext, -1, 1)!=$commentchar) { Note that this is a logic error and the statement will never execute. It should have been written as: if (substr($comtext, -1, 1)==$commentchar && substr($commenttext, -1, 1)!=$commentchar) { Notice how in the corrected statement, the string passed to the second substr() function call is $commenttext and not $comtext. The purpose of this statement was to determine when to strip off the extra comment character that inadvertently gets appended to the comment text block by the previous compounded str_replace code (to prepend comment characters on each line of the comment text block) when the original comment text ends with a new-line sequence.

« previous php.notes (#176169) next »