php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #67600 make print_r use PHP_EOL
Submitted: 2014-07-09 21:46 UTC Modified: 2021-07-18 04:22 UTC
Votes:5
Avg. Score:3.6 ± 1.5
Reproduced:2 of 5 (40.0%)
Same Version:0 (0.0%)
Same OS:0 (0.0%)
From: zelnaga at gmail dot com Assigned: cmb (profile)
Status: No Feedback Package: Arrays related
PHP Version: 5.6.0RC2 OS: Windows 7
Private report: No CVE-ID: None
 [2014-07-09 21:46 UTC] 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

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2021-07-06 14:24 UTC] cmb@php.net
-Status: Open +Status: Feedback -Assigned To: +Assigned To: cmb
 [2021-07-06 14:24 UTC] cmb@php.net
I wonder what would be the use case for needing CRLF for debug
output?
 [2021-07-06 14:41 UTC] requinix@php.net
Probably for Notepad, but even that supports LFs now...
 [2021-07-18 04:22 UTC] php-bugs at lists dot php dot net
No feedback was provided. The bug is being suspended because
we assume that you are no longer experiencing the problem.
If this is not the case and you are able to provide the
information that was requested earlier, please do so and
change the status of the bug back to "Re-Opened". Thank you.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Dec 21 15:01:29 2024 UTC