Req #19313 [Asn->Csd]: Make getTokensAsString() more robust by detecting incorrect length value
| From: | gsherwood at squiz dot net | Date: | Mon, 05 Mar 2012 01:18:44 +0000 |
| Subject: | Req #19313 [Asn->Csd]: Make getTokensAsString() more robust by detecting incorrect length value | ||
| References: | 1 | Groups: | php.pear.bugs |
| Request: | Send a blank email to pear-bugs+get-8358@lists.php.net to get a copy of this message | ||
Edit report at https://pear.php.net/bugs/bug.php?id=19313&edit=1
ID: 19313
Updated by: gsherwood@squiz.net
Reported By: klaus dot purer at gmail dot com
Summary: Make getTokensAsString() more robust by detecting
incorrect length value
-Status: Assigned
+Status: Closed
Type: Feature/Change Request
Package: PHP_CodeSniffer
Package Version: SVN
PHP Version: Irrelevant
Assigned To: squiz
Roadmap Versions:
New Comment:
-Status: Assigned
+Status: Closed
Committed to git:
https://github.com/squizlabs/PHP_CodeSniffer/commit/c946650634934347c96d9d1d2
99d4464c0c4757e
Thanks a lot for the patch. I ended up doing it in a slightly different
way so that the
condition $i < $this->numTokens doesnt need to be checked on each
iteration of the
loop.
Previous Comments:
------------------------------------------------------------------------
[2012-03-05 01:14:41] squiz
-Summary: Make
PHP_CodeSniffer_File::getTokensAsString() more robust
+Summary: Make getTokensAsString() more robust by
detecting incorrect length value
-Assigned To:
+Assigned To: squiz
------------------------------------------------------------------------
[2012-03-02 01:37:51] klausi
Added #patch
bug:19313;patch:phpcs-tokens-as-string.patch;revision:1330652271;.
------------------------------------------------------------------------
[2012-03-02 01:37:27] klausi
Description:
------------
If the length passed to the getTokensAsString() method exceeds the
number of tokens in the file PHP notices will occur.
For convenience this method should be more robust and stop assembling
the string if the last token has been reached. Otherwise I always have
to make sure myself that the limit is not exceeded before calling. Which
is tedious.
------------------------------------------------------------------------
--
Edit this bug report at https://pear.php.net/bugs/bug.php?id=19313&edit=1