Bug #11598

PHP Notice: Undefined offset: 7139708045 in /usr/share/php/PHP/CodeSniffer/Standards/TYPO3/Sniffs/Commenting/ValidCommentIndentSniff.php on line 77

Added by Andy Grunwald over 3 years ago. Updated over 3 years ago.

Status:Closed Start date:2010-12-20
Priority:Must have Due date:
Assignee:Stefano Kowalke % Done:

100%

Category:Commenting
Target version:0.0.3
Branch: Tags:
Votes: 0

Description

Following notice occurs during the scan of extension "t3jquery".

PHP Notice:  Undefined offset: 7139708045 in /usr/share/php/PHP/CodeSniffer/Standards/TYPO3/Sniffs/Commenting/ValidCommentIndentSniff.php
on line 77
PHP Stack trace:
PHP   1. {main}() /usr/bin/phpcs:0
PHP   2. PHP_CodeSniffer_CLI->process() /usr/bin/phpcs:38
PHP   3. PHP_CodeSniffer->process()
/usr/share/php/PHP/CodeSniffer/CLI.php:494
PHP   4. PHP_CodeSniffer->processFiles()
/usr/share/php/PHP/CodeSniffer.php:435
PHP   5. PHP_CodeSniffer->processFile()
/usr/share/php/PHP/CodeSniffer.php:913
PHP   6. PHP_CodeSniffer->_processFile()
/usr/share/php/PHP/CodeSniffer.php:1001
PHP   7. PHP_CodeSniffer_File->start()
/usr/share/php/PHP/CodeSniffer.php:1087
PHP   8. TYPO3_Sniffs_Commenting_ValidCommentIndentSniff->process()
/usr/share/php/PHP/CodeSniffer/File.php:445

class.tx_t3jquery.php (10.1 kB) Stefano Kowalke, 2011-01-13 11:50


Related issues

related to PHP_CodeSniffer - Task #12205: Enable auto_detect_line_endings Closed 2011-01-14
related to PHP_CodeSniffer - Bug #12203: Exclude-Pattern for Sniffs / Folders Closed 2011-01-14

Associated revisions

Revision 2369
Added by Stefano Kowalke over 3 years ago

Rewrite the sniff to fix the issue and improve error messages.
Resolves #11598.

Revision 2369
Added by Stefano Kowalke over 3 years ago

Rewrite the sniff to fix the issue and improve error messages.
Resolves #11598.

History

Updated by Andy Grunwald over 3 years ago

If this ticket is closed, write Christian Trabold a short message.

Updated by Christian Trabold over 3 years ago

  • Assignee set to Stefano Kowalke

FYI We're still facing huge log files for some jobs:

1TB for extension-imagecarousel-metrics/builds/2010-12-22_20-02-29/log

This is an example file content:

PHP Notice:  Undefined offset: 10577449833 in
/usr/share/php/PHP/CodeSniffer/Standards/TYPO3/Sniffs/Commenting/ValidCommentIndentSniff.php
on line 77
PHP Stack trace:
PHP   1. {main}() /usr/bin/phpcs:0
PHP   2. PHP_CodeSniffer_CLI->process() /usr/bin/phpcs:38
PHP   3. PHP_CodeSniffer->process()
/usr/share/php/PHP/CodeSniffer/CLI.php:494
PHP   4. PHP_CodeSniffer->processFiles()
/usr/share/php/PHP/CodeSniffer.php:435
PHP   5. PHP_CodeSniffer->processFile()
/usr/share/php/PHP/CodeSniffer.php:913
PHP   6. PHP_CodeSniffer->_processFile()
/usr/share/php/PHP/CodeSniffer.php:1001
PHP   7. PHP_CodeSniffer_File->start()
/usr/share/php/PHP/CodeSniffer.php:1087
PHP   8. TYPO3_Sniffs_Commenting_ValidCommentIndentSniff->process()
/usr/share/php/PHP/CodeSniffer/File.php:445
PHP Notice:  Undefined offset: 10577449834 in
/usr/share/php/PHP/CodeSniffer/Standards/TYPO3/Sniffs/Commenting/ValidCommentIndentSniff.php
on line 77
PHP Stack trace:
PHP   1. {main}() /usr/bin/phpcs:0
PHP   2. PHP_CodeSniffer_CLI->process() /usr/bin/phpcs:38
PHP   3. PHP_CodeSniffer->process()
/usr/share/php/PHP/CodeSniffer/CLI.php:494
PHP   4. PHP_CodeSniffer->processFiles()
/usr/share/php/PHP/CodeSniffer.php:435
PHP   5. PHP_CodeSniffer->processFile()
/usr/share/php/PHP/CodeSniffer.php:913
PHP   6. PHP_CodeSniffer->_processFile()
/usr/share/php/PHP/CodeSniffer.php:1001
PHP   7. PHP_CodeSniffer_File->start()
/usr/share/php/PHP/CodeSniffer.php:1087
PHP   8. TYPO3_Sniffs_Commenting_ValidCommentIndentSniff->process()
/usr/share/php/PHP/CodeSniffer/File.php:445
PHP Notice:  Undefined offset: 10577449835 in
/usr/share/php/PHP/CodeSniffer/Standards/TYPO3/Sniffs/Commenting/ValidCommentIndentSniff.php
on line 77
PHP Stack trace:
PHP   1. {main}() /usr/bin/phpcs:0
PHP   2. PHP_CodeSniffer_CLI->process() /usr/bin/phpcs:38
PHP   3. PHP_CodeSniffer->process()
/usr/share/php/PHP/CodeSniffer/CLI.php:494
PHP   4. PHP_CodeSniffer->processFiles()
/usr/share/php/PHP/CodeSniffer.php:435
PHP   5. PHP_CodeSniffer->processFile()
/usr/share/php/PHP/CodeSniffer.php:913
PHP   6. PHP_CodeSniffer->_processFile()
/usr/share/php/PHP/CodeSniffer.php:1001
PHP   7. PHP_CodeSniffer_File->start()
/usr/share/php/PHP/CodeSniffer.php:1087
PHP   8. TYPO3_Sniffs_Commenting_ValidCommentIndentSniff->process()
/usr/share/php/PHP/CodeSniffer/File.php:445
PHP Notice:  Undefined offset: 10577449836 in
/usr/share/php/PHP/CodeSniffer/Standards/TYPO3/Sniffs/Commenting/ValidCommentIndentSniff.php
on line 77
PHP Stack trace:
PHP   1. {main}() /usr/bin/phpcs:0
PHP   2. PHP_CodeSniffer_CLI->process() /usr/bin/phpcs:38
PHP   3. PHP_CodeSniffer->process()
/usr/share/php/PHP/CodeSniffer/CLI.php:494
PHP   4. PHP_CodeSniffer->processFiles()
/usr/share/php/PHP/CodeSniffer.php:435
PHP   5. PHP_CodeSniffer->processFile()
/usr/share/php/PHP/CodeSniffer.php:913
PHP   6. PHP_CodeSniffer->_processFile()
/usr/share/php/PHP/CodeSniffer.php:1001
PHP   7. PHP_CodeSniffer_File->start()
/usr/share/php/PHP/CodeSniffer.php:1087
PHP   8. TYPO3_Sniffs_Commenting_ValidCommentIndentSniff->process()
/usr/share/php/PHP/CodeSniffer/File.php:445
PHP Notice:  Undefined offset: 10577449837 in /usr/share/php/PHP

Mr. Hudson can not go on processing the metric builds if this issue isn't solved.

Updated by Stefano Kowalke over 3 years ago

  • Status changed from New to Accepted

For a quick fix, please comment out line 23:

    <rule ref="TYPO3.Commenting.ValidCommentIndent" />

in ruleset.xml of TYPOv4 PEAR package.

I will have a closer look inside the sniff when I have more time.

Updated by Christian Trabold over 3 years ago

The line has been commented in ruleset.xml.

I also integrated new features to keep the amount of log data smaller:

  • A Build will "timeout" if it hangs for more than 10 Minutes
  • Hudson stores "commit"-build for 14 days and code metrics for 7 builds. Documentation-Builds will be stored for 1 build.

Updated by Stefano Kowalke over 3 years ago

The reason for this error is the incorrect line endings (CR) inside the file. The CodeSniffer doesn't reconized this as line endings and calculate the properties of the tokens wrong. (interprets the whole file as one line)

Anyway, I found this error after I rewriting the sniff. This issue is fixed and I added some usefull informations in the error warning.

Now we have to search the real issue inside the CodeSniffer ;-)

Updated by Stefano Kowalke over 3 years ago

  • Status changed from Accepted to Resolved
  • % Done changed from 0 to 100

Applied in changeset r2369.

Updated by Stefano Kowalke over 3 years ago

As I wrote above, the CodeSniffer can't reconize CR line endings. I filed a bug report at https://pear.php.net/bugs/bug.php?id=18193.

This means that the error messages in such files are wrong (line numbers and indention), but the php notice should fixed.

Updated by Stefano Kowalke over 3 years ago

  • Target version changed from Initial release to 0.0.3

Updated by Christian Trabold over 3 years ago

With PHP_CodeSniffer 1.3.0RC2 the exclude pattern can be set on a ruleset basis:

http://www.squizlabs.com/php-codesniffer/rule-based-exclude-patterns

Thus I'd suggest to store the exclude patterns in these rulesets and not in Hudson from now on.

Updated by Andy Grunwald over 3 years ago

Hey Christian,

for this task a`ve created a single Suggestion #12203

Updated by Stefano Kowalke over 3 years ago

The mentioned "bug" with the CR line endings caused by a setting in php.ini. You have set

auto_detect_line_endings = On

This is done in current trunk of PHP_CodeSniffer now by default.

See https://pear.php.net/bugs/bug.php?id=18193

Updated by Christian Trabold over 3 years ago

Stefano Kowalke wrote:

The mentioned "bug" with the CR line endings caused by a setting in php.ini. You have set

Patched settings in /etc/php5/cgi/php.ini.

Updated by Stefano Kowalke over 3 years ago

  • Priority changed from Should have to Must have

Updated by Stefano Kowalke over 3 years ago

  • Status changed from Resolved to Closed

Also available in: Atom PDF