Doc #52526 [ReO->Csd]: Documentation for T_STRING implying bad programming style
| From: | kalle@php.net | Date: | Tue, 19 Oct 2010 04:15:45 +0000 |
| Subject: | Doc #52526 [ReO->Csd]: Documentation for T_STRING implying bad programming style | ||
| References: | 1 | Groups: | php.doc.bugs |
| Request: | Send a blank email to doc-bugs+get-5239@lists.php.net to get a copy of this message | ||
Edit report at http://bugs.php.net/bug.php?id=52526&edit=1
ID: 52526
Updated by: kalle@php.net
Reported by: + at ni-po dot com
Summary: Documentation for T_STRING implying bad programming
style
-Status: Re-Opened
+Status: Closed
Type: Documentation Problem
Package: Documentation problem
PHP Version: Irrelevant
Assigned To: kalle
Block user comment: N
New Comment:
This bug has been fixed in the documentation's XML sources. Since the
online and downloadable versions of the documentation need some time
to get updated, we would like to ask you to be a bit patient.
Thank you for the report, and for helping us make our documentation
better.
Previous Comments:
------------------------------------------------------------------------
[2010-10-19 06:15:40] kalle@php.net
Automatic comment from SVN on behalf of kalle
Revision: http://svn.php.net/viewvc/?view=revision&revision=304494
Log: Fixed bug #52526 (Documentation for T_STRING implying bad
programming style)
------------------------------------------------------------------------
[2010-09-29 19:57:42] stephan dot soller at helionweb dot de
I'm sorry for the duplicate (#52927). I've tested the original syntax
"$a[b]" and it reports b as a T_STRING token. If I understand this
correctly within strings it's permitted to use identifiers as string
indices to avoid complex escaping. However outside of a string it's
(rightfully) considered bad style.
If this is correct T_STRING is ALWAYS an identifier and "$a[b]" is just
a special case where it's ok to use an identifier as a string index.
------------------------------------------------------------------------
[2010-09-27 09:58:34] salathe@php.net
See also #52927 referencing the misinformation from the committed "fix"
for this
bug.
------------------------------------------------------------------------
[2010-08-05 13:01:12] + at ni-po dot com
Better turn it round or it is ambiguous (array index inside identifier
one could think):
<row>
<entry><constant>T_STRING</constant></entry>
<entry>identifier, "$a[a]"</entry>
<entry>identifier ( e.g. function or class name) or string array
index inside string</entry>
</row>
------------------------------------------------------------------------
[2010-08-05 12:37:24] + at ni-po dot com
salathe is perfectly right (in all points). I didn't realize, that
"$a[a]" is valid within a string. (Actually I had my thoughts on the
complex variable syntax "{$a[a]}" there it *would* be a notice.) I am
sorry for that. But the point about not mentioning identifiers like
class and function name is still valid.
<row>
<entry><constant>T_STRING</constant></entry>
<entry>"$a[a]", identifier</entry>
<entry>string array index inside string or identifier, e.g. function
or class name</entry>
</row>
------------------------------------------------------------------------
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/bug.php?id=52526
--
Edit this bug report at http://bugs.php.net/bug.php?id=52526&edit=1