Package home | Report new bug | New search | Development Roadmap Status: Open | Feedback | All | Closed Since Version 3.7.2

Bug #18815 $stackPtr is not a class member var
Submitted: 2011-09-08 16:41 UTC
From: hm2k Assigned: squiz
Status: Bogus Package: PHP_CodeSniffer (version 1.3.0)
PHP Version: 5.3.6 OS:
Roadmaps: (Not assigned)    
Subscription  
Comments Add Comment Add patch


Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know! Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
MUST BE VALID
Solve the problem : 20 + 40 = ?

 
 [2011-09-08 16:41 UTC] hm2k (James Wade)
Description: ------------ phpcs won't aborts checking on this file. I can't figure out where the cause is. Test script: --------------- Get this file: https://raw.github.com/hm2k/PHP_Mailman/master/PHP/Mailman.php Run phpcs --standard=PEAR PHP/Mailman.php Expected result: ---------------- Normal phpcs output, no fail. Actual result: -------------- [user@server PHP_Mailman]# phpcs --standard=PEAR PHP/Mailman.php FILE: .../PHP_Mailman/PHP/Mailman.php ------------------------------------------------------------------------ -------- FOUND 1 ERROR(S) AFFECTING 1 LINE(S) ------------------------------------------------------------------------ -------- 1 | ERROR | An error occurred during processing; checking has been aborted. | | The error message was: $stackPtr is not a class member var ------------------------------------------------------------------------ --------

Comments

 [2011-09-08 16:46 UTC] hm2k (James Wade)
I found the error, on line 183 there's a closing bracket missing: if (is_object($this->req)) { return true; else { $this->setError("Unable to create instance of HTTP_Request2"); return false; } Should be: if (is_object($this->req)) { return true; } else { $this->setError("Unable to create instance of HTTP_Request2"); return false; } See https://github.com/hm2k/PHP_Mailman/blob/4da766f00dfdfca97f78b13ea3693bb3e d73f8e0/PHP/Mailman.php
 [2011-09-09 04:13 UTC] squiz (Greg Sherwood)
-Status: Open +Status: Bogus -Assigned To: +Assigned To: squiz
Thanks for letting me know if was just a syntax error.
 [2011-09-09 04:16 UTC] hm2k (James Wade)
-Status: Bogus +Status: Open
Reopened. Surely CodeSniffer shouldn't produce a fatal error if the code it's "sniffing" has a syntax error? Yes I made a syntax error in my code, but phpcs was unable to identify it and instead it aborted and was unable to identify the syntax error in my code.
 [2011-09-09 04:23 UTC] squiz (Greg Sherwood)
-Status: Assigned +Status: Bogus
PHP_CodeSniffer is not a syntax checker, although it does report possible syntax errors if sniffs detect them. If you want to check for syntax errors, use the "php -l" command.
 [2011-09-09 04:29 UTC] hm2k (James Wade)
-Status: Bogus +Status: Open
The error "$stackPtr is not a class member var" is unexpected behaviour and should be addressed.
 [2011-09-09 05:03 UTC] squiz (Greg Sherwood)
-Status: Assigned +Status: Bogus
If you check code with syntax errors then yes, the results are unexpected. In this case, PHP_CodeSniffer internally matched the wrong curly braces because you left one out. Then a sniff checking member vars determined that an impossible situation occurred and had to abort the check. Please stop re-opening this bug report. It's not something that needs to be fixed. The documentation explicitly states that PHPCS does not do sytax checks. See http://pear.php.net/manual/en/package.php.php-codesniffer.faq.php - 3rd question down.