Download Latest Version 0.20.1 source code.tar.gz (1.1 MB)
Email in envelope

Get an email when there's a new version of Zephir

Home / 0.20.1
Name Modified Size InfoDownloads / Week
Parent folder
zephir.phar < 10 hours ago 2.0 MB
0.20.1 source code.tar.gz < 10 hours ago 1.1 MB
0.20.1 source code.zip < 10 hours ago 1.9 MB
README.md < 10 hours ago 3.1 kB
Totals: 4 Items   5.1 MB 0

Changed

  • Migrated Black-box Testing from Sharness to PHPUnit. #2492

Fixed

  • Fixed method return-type enforcement at runtime for return this->property: methods declared with a strict scalar return type (-> string, -> int, -> double, -> array) now throw TypeError when the property holds a mismatching value instead of silently returning it. PHP only verifies internal-function return types in ZEND_DEBUG=1 builds, so the generated C code now emits a runtime check via new RETURN_MEMBER_TYPED / RETURN_MM_MEMBER_TYPED kernel macros. The error message matches PHP's userland format: Class::method(): Return value must be of type X, Y returned. Nullable return types (string | null) and union/mixed returns are left unchecked, as before. #1991, #2196
  • Fixed built-in array methods called on a var-typed variable (e.g. let b = b->join(""); where b is declared var). Previously these were emitted as ZEPHIR_CALL_METHOD(b, "join", …) and surfaced as a RuntimeException: Trying to call method join on a non-object (originally a segfault, reduced to an exception over time). When the method name is one of the array-specific built-in names that can't meaningfully be a real object method (join, reversed, rev, tojson, haskey, mergerecursive, replacerecursive, sortbykey, reversesort, reversesortbykey), the compiler now dispatches via ArrayType — lowering to the matching PHP function call (e.g. join(glue, array)), just like statically-typed array variables already did. Common Iterator/Countable-style method names (count, push, pop, shift, sort, next, current, end, key, reset, each) are deliberately excluded so object dispatch on those is preserved. #733, #2228
  • Fixed let this->prop = value inside closures: the closure-binding detector from [#2497] caught property reads but missed let-statement writes (different AST shape), so writes were rejected as "Property not defined on stub\NN__closure". #1873, #2203
  • Reorganised populate_fcic() to pin calling/called scope earlier for direct call paths (zephir_fcall_ce and closures). #2321 is NOT fixed by this change. The original symptom — preg_replace_callback(..., [this, 'privateMethod'], ...) failing with "cannot access private method" — remains; PHP's callable-argument validation walks prev_execute_data for the nearest ZEND_USER_CODE frame and Zephir methods are ZEND_INTERNAL_FUNCTION so they're skipped. Workaround: wrap the callback in a Zephir closure that captures thisfunction (m) { return this->privateMethod(m); } — closures aren't re-validated by PHP. #2321, #2325
Source: README.md, updated 2026-05-15