Skip to content

Testing: Include scope inheritance compliance (MiniWebApp templates) #477

@PurHur

Description

@PurHur

Problem

#471 closed documenting that include must inherit the caller scope (layout → partial templates). There is no compliance PHPT in test/compliance/cases/ and no CI filter include_scope.

examples/003-MiniWebApp/templates/layout.php sets $title then includes home.php — silent breakage if a future refactor isolates included file scope.

Goal

Add test/compliance/cases/include_scope_inherit.phpt (VM + JIT when #474 lands):

$title = 'Home';
include __DIR__ . '/partial.php'; // echoes $title

Assert VM and JIT output matches Zend.

Implementation hints

Area Notes
VM lib/VM.php TYPE_INCLUDE pushes frame from parseAndCompileFile — verify locals visible in included file
Fixture test/compliance/fixtures/include_scope/partial.php
MiniWebApp Optional integration: lint-only until #67; no ServeTest dependency

Acceptance criteria

docker run --rm -v "$(pwd):/compiler" -w /compiler php-compiler:22.04-dev \
  ./script/ci-local.sh --filter include_scope

JUnit/compliance reports pass for include_scope_inherit.phpt.

Verification (local / Docker only)

No GitHub Actions required.

Dependencies

Related

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions