Zend: Add missing ZPP specifier tests - #23343
Conversation
| 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 |
Girgias
left a comment
There was a problem hiding this comment.
Was this generated by an LLM?
|
@Girgias I know in #23192 you also tested multiple functions in one file, but how would you feel about making it one function one file? The "Writing Tests" docs ask to keep files small, and I believe it makes sense. Here specifically because:
Would you be fine to require that here? I'd offer to send a follow up for yours. |
Those are guidelines, and the point is to test ZPP not the functions that expose ZPP. So having multiple files here just makes everything harder for no reason. |
Fair enough, no splitting. How about making them at least better readable then? The This logically only affects the |
Add tests for remaining Zend parameter parsing (ZPP) specifiers including arrays, strings, paths, callables, objects, enums, variadics, and zvals in both strict and weak type modes. Also add corresponding test helper functions in ext/zend_test. Closes phpGH-23280.
8da2451 to
a5922ee
Compare
Yes, I used an LLM as an assistant to help scaffold the boilerplate and repetitive test matrix combinations for the missing specifiers. The C helpers in I have updated all added tests to adopt @NickSdot's formatting proposal (grouping by function headers with aligned output columns) and squashed the branch into a single clean commit. All 59 ZPP tests pass cleanly. |
|
The point of this issue was to help people to teach php-src. Not to have an LLM do the work for them. So I'm going to be very inclinded to close this PR as it defeats the whole purpose of giving people an avenue to actually learn how to contribute. |
It seems you no longer test the Though, @Girgias would anyway first need to approve what I propose. Personally, I find it much more clear now. |
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.