Zend: Add missing ZPP specifier tests - #23343
Conversation
Fix segfaults in zend_test ZPP specifier helpers when handling immutable arrays (such as []) and non-refcounted variadic arguments. Also update phpt expectation files.
| try { | ||
| var_dump(zend_array_ht_or_long($type)); | ||
| } catch (Throwable $e) { | ||
| echo $e::class, ': ', $e->getMessage(), PHP_EOL; |
| string(8) "stdClass" | ||
| string(8) "stdClass" | ||
| Using anon class name: | ||
| string(106) "class@anonymous%0/home/timsurreal/Documents/mycode/githubContributions/php-src/Zend/tests/zpp/types.inc:9$1" |
There was a problem hiding this comment.
Your local paths are leaking in here.
Address PR php#23343 review feedback (NickSdot) and CI failures: - Replace hardcoded anonymous-class name expectation leaking the local build path (`string(106) "class@anonymous%0/home/timsurreal/...types.inc:9$1"`) with the canonical EXPECTF pattern `string(%d) "class@anonymous%s"`, matching the convention used by neighboring ZPP tests. The previous form baked in the author's local path and byte length, failing on all CI platforms. Affects: array_ht_or_str, str_or_long, str, zval, string_param (strict + weak). - Replace `PHP_EOL` with `"\n"` in assertion echo lines across all added test files. PHP_EOL is "\r\n" on Windows, a portability hazard per phpGH-23316 and phpGH-22799. All 59 Zend/tests/zpp tests pass locally with zend_test enabled. Co-Authored-By: Claude <noreply@anthropic.com>
|
Thanks for the review, @NickSdot! Both points are addressed in the latest push (
All 59 tests in |
Adds missing test coverage for Zend Parameter Parsing (ZPP) specifiers as outlined in GH-23280.
Summary of Changes
ext/zend_test(test.stub.phpandtest.c) to exercise missing ZPP specifiers (Z_PARAM_ENUM,Z_PARAM_ARRAY*,Z_PARAM_ARRAY_HT*,Z_PARAM_ARRAY_OR_OBJECT*,Z_PARAM_FUNC*,Z_PARAM_PATH*,Z_PARAM_STRING*,Z_PARAM_STR*,Z_PARAM_ZVAL*,Z_PARAM_VARIADIC*, and union specifiers)..phpttest cases inZend/tests/zpp/covering both strict and weak type modes.Closes GH-23280.