ID:               26582
 Updated by:       [EMAIL PROTECTED]
 Reported By:      iwd32900 at yahoo dot com
-Status:           Open
+Status:           Closed
 Bug Type:         Documentation problem
 Operating System: Darwin/Mac OS X
 PHP Version:      4.3.4
 New Comment:

The documentation seems pretty clear on this.



Status -> Closed


Previous Comments:
------------------------------------------------------------------------

[2003-12-18 08:13:49] iwd32900 at yahoo dot com

No, it doesn't work with \r.



I realize that in some sense, \n is the new 'native' 

linefeed for Mac since OS X is Unix based. This doesn't 

change my opinion that PHP should be linefeed-agnostic, 

so that code can easily be transported from one platform 

to another.

------------------------------------------------------------------------

[2003-12-18 05:21:18] [EMAIL PROTECTED]

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 "Open". Thank you.



------------------------------------------------------------------------

[2003-12-10 09:39:06] [EMAIL PROTECTED]

Does heredoc work for you with \r?

------------------------------------------------------------------------

[2003-12-10 09:12:36] iwd32900 at yahoo dot com

Description:
------------
The current manual says this, under the "Heredoc" 

section in "Strings" in "Types":



-----

It's also important to realize that the first character 

before the closing identifier must be a newline as 

defined by your operating system. This is \r on 

Macintosh for example.



If this rule is broken and the closing identifier is not 

"clean" then it's not considered to be a closing 

identifier and PHP will continue looking for one. If in 

this case a proper closing identifier is not found then 

a parse error will result with the line number being at 

the end of the script.

-----



I have two issues with this.

1. This doesn't appear to be true. I'm using the 

entropy.ch distribution of 4.3.4, and it accepts \n as a 

linefeed before the end marker on my Mac.



2. One of the great things about PHP is that it's cross-

platform portable. The interpretter otherwise seems to 

be linefeed-agnostic; it should be here, too. That way, 

I can write my scripts on any platform and distribute 

them to any other, and no one has to worry about 

something as irritating as linefeeds. Just check for any 

of \n, \r, or \r\n before a heredoc terminator. Should 

be really easy, and it will do a lot for making PHP more 

platform independent.

Reproduce code:
---------------
$heredoc = <<<HEREDOC

    Does this cause a parse error?

HEREDOC;

echo $heredoc;



// No, it doesn't

Expected result:
----------------
Given what the manual says, this should break since the 

linefeeds are Unix but it was run on a Mac.



The documented behavior isn't the DESIRABLE behavior, 

however. PHP should accept all linefeed types on all 

platforms to promote code portability.

Actual result:
--------------
The example works just fine on my Mac, actually. It may 

be that the cross-platform behavior is already 

implementd, and just hasn't been documented yet.


------------------------------------------------------------------------


-- 
Edit this bug report at http://bugs.php.net/?id=26582&edit=1

Reply via email to