Bug #60096 [Com]: token_get_all on b"$var" returns invalid string token

From: Date: Wed, 02 Nov 2011 15:11:37 +0000
Subject: Bug #60096 [Com]: token_get_all on b"$var" returns invalid string token
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-164814@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=60096&edit=1

 ID:                 60096
 Comment by:         nikic@php.net
 Reported by:        nikic@php.net
 Summary:            token_get_all on b"$var" returns invalid string
                     token
 Status:             Wont fix
 Type:               Bug
 Package:            *General Issues
 PHP Version:        5.4.0beta1
 Block user comment: N
 Private report:     N

 New Comment:

@johannes: My main issue here is that the output of token_get_all is malformed. 'b"'
isn't a valid string token, because it has more than one character.

But really, I have to admit that I can't think of a way how to cleanly solve this issue,
without breaking BC for the tokenizer ext. So I'd say I agree with the Wontfix, especially as
this is easy to detect and fix in userland code.


Previous Comments:
------------------------------------------------------------------------
[2011-11-02 12:34:00] johannes@php.net

This is defined in the scanner this way.
Currently we don't need the b prefix and have it for forward compatibility only. I doubt we
won't add an extra token for the 'b' prefix (which most likely creates conflicts)
If anything like this is done it should be done according to the needs of a future use of that
prefix.

------------------------------------------------------------------------
[2011-10-20 05:19:25] nikic@php.net

I doubt that this is expected. Only single characters can be represented using a one-char string
token, because the token number and token text are identical in this case.
'b"' is not a single character and thus can't be returned as a string token,
because the token number is chr('"'), not chr('b"') (which is
chr('b')).

------------------------------------------------------------------------
[2011-10-19 22:55:35] felipe@php.net

Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to
report
a bug at http://bugs.php.net/how-to-report.php

Currently it's expected, as the 'b' prefix doesn't produces a separated token.

------------------------------------------------------------------------
[2011-10-19 16:02:23] nikic@php.net

Description:
------------
token_get_all('<?php b"$var"') will return 'b"' as a
string-token, even though it is not a single character.



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



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


Thread (6 messages)

« previous php.bugs (#164814) next »