Repository navigation
Closed
Labels
area:vmVirtual machineVirtual machineenhancementNew feature or requestNew feature or requestimplementation-readySpec complete: repro, php-src ref, done-when — safe for workers to claimSpec complete: repro, php-src ref, done-when — safe for workers to claimphase-4:stdlibPhase 4 – stdlib for web appsPhase 4 – stdlib for web apps
Description
Category
stdlib
Problem
Debug output builtins are incomplete: print_r() is missing entirely; var_dump() exists in ext/standard/var_dump.php but is not registered in Module.php and only formats a tiny type subset.
Verified May 2026:
./script/docker-exec.sh -- bash -lc 'source script/php-env.sh && php bin/vm.php -r "print_r([1]);"'
# Call to undefined function print_r()
./script/docker-exec.sh -- bash -lc 'source script/php-env.sh && php bin/vm.php -r "var_dump([1]);"'
# Call to undefined function var_dump() (not registered)php-src reference
- php/php-src
ext/standard/basic_functions.c—PHP_FUNCTION(print_r),PHP_FUNCTION(var_dump) - php/php-src
ext/standard/var.c— shared pretty-print helpers
Repro
<?php
$a = ['k' => 1, 'nested' => ['x' => 2]];
print_r($a, true);
var_dump($a);./script/docker-exec.sh -- bash -lc 'source script/php-env.sh && php bin/vm.php repro.php'
php repro.php| Runtime | Result |
|---|---|
| Zend | structured array output; var_dump includes types/lengths |
| VM | undefined function for both |
Scope (this repo)
| Module | Path |
|---|---|
| Register | ext/standard/Module.php — add var_dump_() (already exists) and new print_r |
| Implement | ext/standard/print_r.php (new) |
| Extend | ext/standard/var_dump.php — arrays, objects (public props), recursion guard |
| Tests | test/compliance/cases/stdlib/print_r.phpt, var_dump.phpt |
| Matrix | php script/capability-matrix.php |
JIT/AOT may remain VM-only v1; document in matrix notes.
Done when
-
print_r($var, $return=false)echoes;$return=truereturns string -
var_dump(...$vars)registered and dumps arrays with keys/types - Repro produces Zend-like structure (exact whitespace optional; structure required)
-
./script/ci-fast.sh --filter "print_r|var_dump"green - No duplicate registration with
var_export(Stdlib: var_export() — arrays, scalars, and objects (ext/standard/var.c parity) #3594)
Related
- Stdlib: var_export() — arrays, scalars, and objects (ext/standard/var.c parity) #3594 —
var_export()full parity - Stdlib: preg_last_error_msg() — human-readable PCRE error (PHP 8.0) #3110 — preg JIT area (separate)
Metadata
Metadata
Assignees
Labels
area:vmVirtual machineVirtual machineenhancementNew feature or requestNew feature or requestimplementation-readySpec complete: repro, php-src ref, done-when — safe for workers to claimSpec complete: repro, php-src ref, done-when — safe for workers to claimphase-4:stdlibPhase 4 – stdlib for web appsPhase 4 – stdlib for web apps
Activity
PurHur commentedon Jun 1, 2026
claim: worker-lane-b — starting this run
PurHur commentedon Jun 1, 2026
Merged via #3966
Verification
```bash
./script/docker-exec.sh -- bash -lc 'source script/php-env.sh && vendor/bin/phpunit --filter "print_r|var_dump"'
OK (2 tests, 2 assertions)
```
print_r()VM builtin with array/object formatting and return-string modevar_dump()already registered; compliance PHPT added