Whole file
terryyin/lizard
The author described this change as “fix php code without closing ?>”. It counts as a record because the check below fails on the code as it stood at 03fe2f28d and passes on f3ed0658d, with nothing else changed between the two runs.
Projectterryyin/lizard
Fix saved2016-06-08
Sharing licenceMIT · LICENSE.txt
Change size+3 −1
What the code was meant to do, written into the code itself as a save note
fix php code without closing ?>
The change
| 21 | 21 | extra += r"|(?:\$\w+)" | |
| 22 | 22 | extra += r"|(?:\<{3}(?P<quote>\w+).*?(?P=quote))" | |
| 23 | 23 | current_pos = 0 | |
| 24 | - | code_block_pattern = re.compile(r"\<\?(?:php)?(.*?)\?\>", re.M | re.S) | |
| 24 | + | code_block_pattern = re.compile( | |
| 25 | + | r"\<\?(?:php)?(.*?)(?:(\?\>)|\Z)", | |
| 26 | + | re.M | re.S) | |
| 25 | 27 | for match in code_block_pattern.finditer(source_code): | |
| 26 | 28 | if source_code[current_pos:match.start()]: | |
| 27 | 29 | yield '"' + source_code[current_pos:match.start()] + '"' |
The check that tells the two apart
fail→pass·test/test_languages/testPHP.py::Test_tokenizing_PHP::test_code_block_without_closing
Check file test/test_languages/testPHP.py, taken without changes from the fix and copied onto the older code, so the exact same check runs against both versions.
Origin and history
The code before it03fe2f28d0872dc482d2e5242cce8fdd052f4039
Broken version dated2016-06-08
Modulelizard_languages.php
Units changedPHPReader
Fingerprint457faa52ab792a16
Checked2026-08-18 by goldset/0.1
Every field above is generated by our program. None of it is written by hand.
Other bugs found in terryyin/lizard
- 2026-08-08fix(java): do not report control structures as methods
- 2026-07-02HalsteadClassifier
- 2026-07-02fix(csv): emit columns for extensions with multiple FUNCTION_INFO fields
- 2026-06-15fix(golike): register generic functions with [...] type params
- 2026-06-15fix(java): enhance parsing of generic and qualified type names in anonymous classes
- 2026-06-11fix(script): stop a '#' comment continuing past a trailing backslash (#317)