|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2004-07-05 11:41 UTC] derick@php.net
[2004-07-05 11:55 UTC] zxc at zmail dot ru
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Tue Nov 04 21:00:01 2025 UTC |
Description: ------------ I want to have strings without \r\n from my conf file. Conf file: #>>>> ./inc/conf.inc.dat #>>>> key=value (with \r\n) //Line:0>path=./user-sleepy/ //Line:1>access=moder //Line:2>password=36Fhenw7spw But after parsing script, the code returns strings with \r\n, why? Maybe bug? Because i found in docs: "By default, PCRE treats the subject string as consisting of a single "line" of characters (even if it actually contains several newlines)". Reproduce code: --------------- <? function rconf($ConfPath) { $OpConf=@FOpen($ConfPath,"r") or die("Cannot read!"); while(!feof($OpConf)) { preg_match("/.+/",FGets($OpConf),$matches); echo $matches[0]; } FLock($OpConf,LOCK_EX); FClose($OpConf); } rconf("./inc/conf.inc.dat"); ?> Expected result: ---------------- path=./user-sleepy/access=moderpassword=36Fhenw7spw (without \r\n) Actual result: -------------- path=./user-sleepy/ access=moder password=36Fhenw7spw