Menu

#66 block closure '}' detect in a string

Fixed
nobody
None
Medium
Defect
2013-12-03
2013-11-26
Anonymous
No

Originally created by: sanders.yao@gmail.com

steps will reproduce the problem

1. Detect code: a string declare that contain a character "}".
2. Result will report error "The block closure '}' must be on a new line.".
3. I found the private variable _inString in file src/PHPCheckstyle.php line 1027 always has a value (bool)false.
4. And I found this variable not assigned in anywhere.

version

I use version 0.12.2 and 0.12.3 reproduce the same problem

Related

Wiki: History

Discussion

  • Anonymous

    Anonymous - 2013-11-27

    Originally posted by: tch...@hotmail.com

    (No comment was entered for this change.)

    Status: Accepted

     
  • Anonymous

    Anonymous - 2013-12-02

    Originally posted by: tch...@hotmail.com

    The "_inString" flag was used when the tokenizer was separating Tokens and String, now everything should be Tokens, so I have removed the flag.

    I haven't been able to reproduce the problem with the following test sample :

    ---------------------------------------

    <?php
    /**
    * Block closure } inside a string.
    */

    $a = "test } test";

    $a = 'test } test';

    ----------------------------------

    Could you provided a test case and some information about your config (PHP version and system) ?  Sometimes the tokenizer doesn't react as I expect.

    Could you also run the test with the "--debug" flag on the command line ?

    I have the following result :
    [exec] Level 0 - line : 6, pos : 13, id : T_CONSTANT_ENCAPSED_STRING, text : "test } test"
    [exec] Level 0 - line : 8, pos : 21, id : T_CONSTANT_ENCAPSED_STRING, text : 'test } test'

    Thanks a lot,

     
  • Anonymous

    Anonymous - 2013-12-02

    Originally posted by: sanders.yao@gmail.com

    I expressed incomplete.

    Please test this source code :

    ----------------------------------
    <?php
    $a = "test {$hello} test";
    ----------------------------------

    I reproduced this problem.

     
  • Anonymous

    Anonymous - 2013-12-03

    Originally posted by: tch...@hotmail.com

    OK, thanks, problem reproduced and solved (I hope).

    I have commited a patch on trunk, I will have to test for regression before to release a new version.

    Status: Fixed

     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.