Bug #28643 [Com]: __LINE__ miscounts in case of using \r or \n as a newline

From: Date: Fri, 24 Sep 2021 06:46:53 +0000
Subject: Bug #28643 [Com]: __LINE__ miscounts in case of using \r or \n as a newline
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-236802@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=28643&edit=1 ID: 28643 Comment by: in at deliverypartner dot com Reported by: key at kemcity dot ru Summary: __LINE__ miscounts in case of using \r or \n as a newline Status: Not a bug Type: Bug Package: Scripting Engine problem Operating System: possibly any PHP Version: Irrelevant Block user comment: N Private report: N New Comment: https://deliverypartner.co/join-to-deliver https://deliverypartner.co/join-to-deliver https://deliverypartner.co/category/become-a-driver https://deliverypartner.co/category/join-as-driving-partner We have listed jobs for delivery partners Previous Comments: ------------------------------------------------------------------------ [2004-06-06 05:27:03] key at kemcity dot ru I suppose, nobody helps me ;) I hope others are awared of this bug and would find it at google, for example. Because I couldn't. ------------------------------------------------------------------------ [2004-06-05 18:13:13] key at kemcity dot ru For my followers: to change the script appropriate the requirements, you should replace any occurence of "wrong" newline. I used the next simple script: $filenameIn="funct.php"; $filenameOut="funct.out.php"; $x=fopen($filenameIn,"r"); $buf=fread($x,filesize($filenameIn)); fclose($x); $buf=preg_replace("/\r([^\n])/si","\r\n$1",$buf); $buf=preg_replace("/([^\r])\n/si","$1\r\n",$buf); $x=fopen($filenameOut,"w+"); fwrite($x,$buf); fclose($x); ------------------------------------------------------------------------ [2004-06-05 16:55:41] key at kemcity dot ru not any but every. Excuse me for a lot of msgs. ------------------------------------------------------------------------ [2004-06-05 16:54:42] key at kemcity dot ru Only after changing any $0d to $0d$0a I've got right result. So, the right definition is: use only $0d$0a in your scripts to get right __LINE__ count. Am I right? ------------------------------------------------------------------------ [2004-06-05 16:52:09] key at kemcity dot ru I've changed all newlines in file to $0d. There is no any $0a in file. Is this a solution? Error still out. Check the http://soft.kemcity.ru/test/index3.php and http://soft.kemcity.ru/test/index3.txt (source) ------------------------------------------------------------------------ The remainder of the comments for this report are too long. To view the rest of the comments, please view the bug report online at https://bugs.php.net/bug.php?id=28643 -- Edit this bug report at https://bugs.php.net/bug.php?id=28643&edit=1

« previous php.bugs (#236802) next »