Repository navigation
Description
Found incidentally while verifying the shared _slice_by_braces string-shielding fix (part of epic #813) against the real corpus.
The bug
For at least php/magento2/AbstractModel.php in the language-crucible corpus, Prism.split_streams()'s code_stream output for PHP retains mangled docblock text instead of having /** ... */ comments cleanly stripped. Example — the real source has:
protected $_eventPrefix = 'core_abstract';
/**
* Parameter name in event
* ...
* @var string
*/
protected $_eventObject = 'object';But code_stream contains (reconstructed from a direct prism.split_streams(content, "php") call):
protected $_eventPrefix = 'core_abstract""object""id""s original data
*
* @var array
*/
protected $storedData = [];
...
Real docblock prose (@var array, Synchronize object...) is bleeding into code_stream instead of being isolated into comment_stream, and multiple originally-separate single-quoted string literals and comment blocks appear to be getting concatenated/corrupted together (note the adjacent "" pairs with no legitimate PHP syntax between them).
Impact
This corrupted code_stream then confuses detector.py's downstream string/comment shielding step in _slice_by_braces (combined_pattern/fast_shield), which found one shield match spanning 4034 characters in this file — effectively treating almost the entire class body as a single string/comment. This caused func_start to detect only 1 of this file's ~16 real methods before a recent fix (epic #813, shared string-shielding ordering), and 0 of 16 after that fix (the fix makes matching more sensitive to this pre-existing corruption, since matches are now found directly against the corrected/shielded code rather than only using it for a narrower brace-search step — see that PR for details). Either way, this file's real extraction accuracy for PHP was already severely broken before that fix; this issue is about the root cause, not something introduced by it.
Suspected root cause
Likely in prism.py's _strip_segment_comments()/_compile_regex_matrix() path for whichever lexical family PHP maps to (standard_block) — either the block-comment delimiter pattern itself has a matching bug for PHP specifically, or there's a masking/unmasking step whose callback isn't correctly restoring shielded string content, given the tell-tale adjacent-"" artifact pattern.
Suggested next step
Reproduce directly via Prism.split_streams() on a minimal PHP snippet with a docblock followed by a single-quoted string property (the exact shape above), narrow down which specific step in the strip pipeline introduces the corruption, and fix with the same rigor as other prism.py architectural fixes in this repo (ReDoS check if a quantifier is touched, full crucible_check.py differential scan given PHP is a widely-used language in the corpus).
Not fixed as part of this discovery — filing separately per the epic's own "a fix spanning many languages/files is an architectural fix, not a per-language one" discipline (tests/extraction/how_to_harden_extraction.md).
Activity
Fix javascript/typescript func_start string-literal false positive (#814
Fix/859 php docblock corruption (#864)
squid-protocol commentedon Jul 31, 2026
fixed by #864
Tighten extraction-hardening rigor + add token-efficient tooling (#866)