Bug #67600 [Fbk]: make print_r use PHP_EOL

From: Date: Tue, 06 Jul 2021 14:41:27 +0000
Subject: Bug #67600 [Fbk]: make print_r use PHP_EOL
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-234825@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=67600&edit=1 ID: 67600 Updated by: requinix@php.net Reported by: zelnaga at gmail dot com Summary: make print_r use PHP_EOL Status: Feedback Type: Bug Package: Arrays related Operating System: Windows 7 PHP Version: 5.6.0RC2 Assigned To: cmb Block user comment: N Private report: N New Comment: Probably for Notepad, but even that supports LFs now... Previous Comments: ------------------------------------------------------------------------ [2021-07-06 14:24:13] cmb@php.net I wonder what would be the use case for needing CRLF for debug output? ------------------------------------------------------------------------ [2014-07-09 21:46:16] zelnaga at gmail dot com Description: ------------ print_r() seems to have \n hard-coded so even if your PHP_EOL is \r\n it'll still output everything with \n. The following stackoverflow post elaborates: http://stackoverflow.com/a/24664153/569976 Test script: --------------- <?php $a = print_r(array(2), true); echo urlencode($a); Expected result: ---------------- Array%0A%28%0A++++%5B0%5D+%3D%3E+2%0A%29%0A Actual result: -------------- Array%0D%0A%28%0D%0A++++%5B0%5D+%3D%3E+2%0D%0A%29%0D%0A ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=67600&edit=1

« previous php.bugs (#234825) next »