Skip to content

Bridge bug: PHP filter does not decode \' escape in single-quoted strings #20

Description

@asgeirf

Surfaced by the spec contract audit (PR for spec/php).

Symptom

Per the PHP Manual on single quoted strings, inside a single-quoted PHP string the only two escape sequences are \' (literal apostrophe) and \\ (literal backslash). Both should decode to their literal characters in the extracted text.

The Okapi PHPContentFilter keeps the backslash and the apostrophe verbatim instead of decoding \''.

Reproduction

core/formats/phpcontent/spec.yaml feature single_quoted_string::escaped_apostrophe:

input:    <?php $text = 'It\'s a test';
expected: It's a test          (native, correct per PHP spec)
bridge:   It\'s a test         (backslash-apostrophe kept verbatim)

Spec tag

The example is tagged expected_fail: in the spec.yaml so the parity gate downgrades it to a warning until the bridge is fixed. Once the bridge fix lands, drop the expected_fail: block.

Repro test

KAPI_PARITY_SANDBOX=$PWD/.parity \
  go test -tags parity -run TestParityPhpSpec/single_quoted_string -count=1 -v ./parity/...

(from cli/, on branch spec/php)

Affected upstream code

okf_phpcontent (okapi-filter-php) — the single-quoted-string lexer in PHPContentFilter, all currently-shipped Okapi versions affected.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions