Re: [PHP] Is this a bug?



Jochem Maas wrote:
T Lensselink schreef:
Catalin Zamfir Alexandru, DATAGRAM SRL wrote:
Hello guys,

I've been stalking on the list for some time. Didn't
have
anything to report/talk, until now. I have a code like this, maybe
you guys
can reproduce it, with output buffering started:

Echo 'something';

Echo 'another thing';

Echo 'something <br />'\;



What happens is that ANYTHING that was echo'ed until
that \,
will not reach the buffer. Although, this should actually be a Parse
Error,
it isn't, it just echoes what was echoed after the god damned \. It
took me
two hours to find this typo in the code .


ouch.
don't forget you can do:

$> php - l yourscript.php

to test for syntax errors (the warning does show up with this).

additionally a good syntax highlighting editor can help you to spot
stuff like this ... anything to stop the eyes from bleeding :/



Can you guys reproduce the error? I can actually
give you a
link to the server where this code runs.



The script doesn't cause a parse error Instead it throws a warning.

'PHP Warning: Unexpected character in input: '\' (ASCII=92) state=1
in'

Don't think it's a bug. And the reason there's no syntax error is
because the \ is a PHP
escape character.

is this character ever valid as an escape character outside of a string?
if it is that's news to me and if it isn't then really it is a bug ...
it should be a straight up parse error ... chances are that it's down
to limitations in the lexer?

the output buffer handler that seems to be swallowing the warning every
second request .... now that is weird.
I don't think it should be valid outside a string. But PHP seems to see
this different.
The only reason i could think of. Is that the \ somehow is a registered
symbol. So it throws
a non fatal E_COMPILE_ERROR. Could be a bug. That's for the guys on
internals to decide.
I'd also expect a parse error.

With output buffering enabled i still get the same warning on every request.







.



Relevant Pages

  • Re: [PHP] Is this a bug?
    ... can reproduce it, with output buffering started: ... to test for syntax errors. ... The script doesn't cause a parse error Instead it throws a warning. ...
    (php.general)
  • Re: Feeding data to a Citrix client
    ... android.c:119: error: parse error before "ClientData" ... android.c:119: warning: data definition has no type or storage class ...
    (comp.unix.shell)
  • [Full-Disclosure] [ http://www.k-otik.com/exploits/07.21.win2kdos.c.php ]
    ... test.c:1: parse error before "dcom_recv" ... test.c:15: warning: data definition has no type or storage class ... test.c:28: warning: passing arg 1 of `strlen' makes pointer from integer ...
    (Full-Disclosure)
  • Help with makeing DBD::DB2
    ... Constants.xs:25: warning: `not_here' defined but not used ... dbdimp.h:18: error: parse error before '*' token ... dbdimp.h:18: warning: type defaults to `int' in declaration of ...
    (comp.lang.perl.modules)
  • gaim encryption fails to compile
    ... ge_blist.h:12: error: parse error before '*' token ... ge_blist.h:14: warning: type defaults to `int' in declaration of `GaimAccount' ...
    (Debian-User)