Doc #52526 [ReO]: Documentation for T_STRING implying bad programming style

From: Date: Mon, 27 Sep 2010 07:58:34 +0000
Subject: Doc #52526 [ReO]: Documentation for T_STRING implying bad programming style
References: 1  Groups: php.doc.bugs 
Request: Send a blank email to doc-bugs+get-5122@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: salathe@php.net Reported by: + at ni-po dot com Summary: Documentation for T_STRING implying bad programming style Status: Re-Opened Type: Documentation Problem Package: Documentation problem PHP Version: Irrelevant Assigned To: kalle Block user comment: N New Comment: See also #52927 referencing the misinformation from the committed "fix" for this bug. Previous Comments: ------------------------------------------------------------------------ [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> ------------------------------------------------------------------------ [2010-08-04 12:09:04] salathe@php.net The change does not address the issue. Changing the "$a[a]" to "$a['a']" only serves to break the example (literally, it will generate a parse error). The point, I think, was that the reporter (mistakenly) did not like the idea of using a "bad practice". However, "$a[a]" is perfectly acceptable (within a string!) and will not generate any notices. The description could do with mentioning that T_STRING also means class/function/etc. names as well. ------------------------------------------------------------------------ [2010-08-04 11:20:56] kalle@php.net 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. ------------------------------------------------------------------------ [2010-08-04 11:20:48] kalle@php.net Automatic comment from SVN on behalf of kalle Revision: http://svn.php.net/viewvc/?view=revision&amp;revision=301848 Log: Fixed bug #52526 (Documentation for T_STRING implying bad programming style) ------------------------------------------------------------------------ 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

« previous php.doc.bugs (#5122) next »