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: -
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:
Status: Open Package: Arrays related
PHP Version: 5.6.0RC2 OS: Windows 7
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: zelnaga at gmail dot com
New email:
PHP Version: OS:

 

 [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

Add a Patch

Pull Requests

Add a Pull Request

 
PHP Copyright © 2001-2019 The PHP Group
All rights reserved.
Last updated: Sun Nov 17 10:01:32 2019 UTC