php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #29014 strings without \r\n
Submitted: 2004-07-05 11:36 UTC Modified: 2004-07-05 11:55 UTC
From: zxc at zmail dot ru Assigned:
Status: Not a bug Package: PCRE related
PHP Version: 4.3.7 OS: Windows XP build 2600
Private report: No CVE-ID: None
 [2004-07-05 11:36 UTC] zxc at zmail dot ru
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

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2004-07-05 11:41 UTC] derick@php.net
Sorry, but your problem does not imply a bug in PHP itself.  For a
list of more appropriate places to ask for help using PHP, please
visit http://www.php.net/support.php as this bug system is not the
appropriate forum for asking support questions. 

Thank you for your interest in PHP.

.
 [2004-07-05 11:55 UTC] zxc at zmail dot ru
Ok, thanks =) Best wishes.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Apr 19 16:01:27 2024 UTC