ID:               21210
 Updated by:       [EMAIL PROTECTED]
 Reported By:      [EMAIL PROTECTED]
 Status:           Bogus
 Bug Type:         Session related
 Operating System: Linux 2.4.7
 PHP Version:      4.2.3
 New Comment:

Email me your include file as an attachment please or put it up online
somewhere so I can see it.


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

[2002-12-26 23:10:09] [EMAIL PROTECTED]

When starting a new session we need to set a cookie which happens in
the response headers.  When simply reading a cookie we get that cookie
out of the request headers.  That's a completely different operation
and is done before you even start executing the script, so it is done
long before the include.

And you only have to eliminate blank lines outside of PHP tags in
include files.  You can have as many blank lines or PHP comments as you
want in include files.

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

[2002-12-26 23:08:58] [EMAIL PROTECTED]

BTW, I have the problem now WITHOUT any carriage returns in the include
file.

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

[2002-12-26 23:07:08] [EMAIL PROTECTED]

Understood. However, what makes this appear like a bug rather than a
feature is that once a session is successfully registered, the code
works as suspected, carriage returns and all. It's only in the very
first initial session_start() that the problem appears, which is weird
if, as you suggest, the problem simply has to remain in PHP. How come
PHP can read cookies fine even if preceded by carriage returns or other
whitespace, but cannot set cookies if preceded by carriage returns or
other whitespace junk? I was under the impression both operations are
performed in the headers, and if that's the case, and one works fine
with whitespace preceding it, and the other doesn't, that would seem to
indicate that this is a bug and not a feature.

I just think it's odd that I have to eliminate all comments and blank
lines in a PHP include file if I want to use sessions later in the
document.

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

[2002-12-26 21:14:34] [EMAIL PROTECTED]

No, it would be a really bad idea to have PHP swallow up whitespace and
other chars.  And any http body output, including whitespace, must be
preceded by the HTTP headers, so PHP has to force them out.

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

[2002-12-26 20:46:12] [EMAIL PROTECTED]

So I do indeed! Thanks.

The immediate problem is solved; however, it seems strange to me that
carriage returns should be causing "header like" output. Wouldn't it
make more sense to make the require and include functions function not
generate output from extraneous whitespace?

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

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
    http://bugs.php.net/21210

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

Reply via email to