Repository navigation
Fix the bug backlog: coercion, references, crashes, uninitialised typed properties, access checks, async (ABI 24) - #429
Merged
Merged
Conversation
…string at call, return and property-store sinks Fixes #402
…at is decided from the text Fixes #403
…cals out of scalar sink coercion Fixes #412
…strlen, ord, chr) Fixes #411
…ator header Fixes #413
… over all of them Fixes #405
…ION__ is empty Fixes #408
… ctors, first-class callables and dynamic method calls Inherited constructors resolve up the parent chain, a pending $o->m(...) shim asks every holder of the method name, and a dynamic call no longer hoists a property argument into a copy. Spread and DynProp arguments stay open (#61, #353). Fixes #352
A typed by-ref param whose reference is stored rides a cell and is moved into a frame box on entry, so every &$v shares it and the caller sees later writes. Fixes #344
… on this tree) Fixes #251
…e a pointer (ABI v23) A denormal double with bits in (0xFFFF, 2^48) passed the plausible-pointer window and was dereferenced by the ptr-8 probes (is_resource, instanceof, is_array...). Lossless fix, not a flush to 0.0: box_float / box_by_repr or FLOAT_DENORM_TAG (0x7FF0<<48, an sNaN header box_float otherwise never emits) into those words; every cell->double read (tagged_to_double and the asfloat arms, array float-element decode, json/serialize writers) masks it back. Chosen over a new DENORM cell tag: the word stays in the synthetic FLOAT class, so no tag dispatch changes. Fixes #331
# Conflicts: # src/Compile/Mir/Passes/EmitLlvmObjects.php
# Conflicts: # prelude/array_fns.php # prelude/resource.php # src/Compile/Mir/Passes/EmitLlvmObjects.php # src/Compile/Mir/Passes/LowerFromAst.php # tests/aot/cases/array_map_zip.php # tests/aot/expected/array_map_zip.out
…es of already-promoted ones
…ee reads null, not a raw zero word Fixes #415
…as an expression An ArrayAccess offsetSet has no result of its own; park a non-trivial value in a local and read it back. Fixes #420
… uninitialized (ABI v24) A class tree declaring a typed property with no default (not promoted, not hooked) gets an init bitmap at one tree-wide offset past every member's properties and bag; allocation zeroes it, clone copies it. No reader or writer consults it yet.
Every write path into a property php may start uninitialized marks it in the init bitmap: the typed and erased stores, the class-id writers, union and rebind stores, array write-back into a property, by-reference addresses and clone-with. Nothing reads the bit yet.
…instead of dropping it Fixes #423
… rotating scan Fixes #426
…d it overrides Fixes #421
…ide any class A closure lowered outside a class has global scope unless the program rebinds closures (bindTo, call, Closure::bind), in which case the check stays off. Fixes #422
A plain read of a property php starts uninitialized tests its init bit and throws Error "Typed property C::$p must not be accessed before initialization". Write bases (element writes, references, by-ref arguments, isset/unset/??) are not reads and keep vivifying. Fixes #417
…n follow php isset() and ?? answer false/the default, unset() makes a typed property uninitialized again, json_encode / get_object_vars / (array) / print_r / var_export / serialize leave it out, var_dump prints uninitialized(T) and counts only written properties, ReflectionProperty::isInitialized() asks the bitmap. isset() of a written raw int/float/bool property is true even when it holds 0. Fixes #115
A conservative definite-assignment scan of the constructor's leading straight-line run ($this->p = expr, local assignments, parent::__construct) before anything could observe the object drops those properties from the maybe-uninitialized set, so most classes carry no bitmap and pay no check. A property a subclass's constructor may leave unwritten stays checked on every ancestor that declares it.
…, R: takes no slot Fixes #282
…ip slot bookkeeping without R: Refs #280: objects unserialize 325 -> 110 ms (php 50) on 20k objects
…id for php, and a borrowed element read keeps the plain store as an assignment value
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
A sweep over the open bug backlog: issues grouped by shared root cause, each fixed at the root, with its repro promoted to a regression case. ABI goes 22 -> 24 (denormal float encoding, init bitmap for typed properties); no bootstrap pin raise is needed.
Changes by group
Scalar coercion — a numeric string reaching an
intparameter, return or typed property is converted (#402);"10" + "5.5"isfloat(15.5)and"9" ** 2isint(81)(#403); a statically-null local used as an array key is""(#412).Crashes —
$cb(...$args)through a builtin name (#411); automatic cycle collector SIGBUS when an object is the first allocation of a malloc region (#413); denormal floats in a cell no longer look like pointers (#331, ABI 23).References — unset or rebind of a by-ref name (#346, #347, #200); a stored
&$vof a by-ref param is shared instead of copied (#344, #349, #351);$o->p = &$vbinds the property (#345, #58); references stored through inherited constructors and first-class callables (#352); nested element reference pinned by a case (#251).Runtime and stdlib —
array_mapwith several arrays (#405),is_resourceafterfclose(#406),__FUNCTION__at top level (#408),get_defined_vars()(#264),Ffi\Ptrin user code and a C NULL return (#400, #401),call_user_func_arrayinto a variadic closure (#414), destructor timing foruse (&$x)(#69).Garbage values — omitted
mixed &$v = null(#415), the value of$o[$k] = <string>as an expression (#420, #397), a denied property read falling back to__get(#419).Language checks — nullable typed class constants parse (#418); a trait method weakening the parent's visibility is rejected (#421); private access from an unbound closure is rejected (#422).
Uninitialised typed properties — reading one throws, as in php (#417);
json_encode,get_object_vars,serialize,var_dumpskip or flag them (#115). Costs one hidden bitmap word only in classes that need it; a constructor analysis removes the check where every path assigns.Async —
awaitAnyescalates a late loser's failure (#423),Semaphore::release()throws on an over-release (#424), the poll backend honours$maxEvents(#426).serialize / perf —
unserializerejects malformed input like php (#282); faster object unserialize (3x) andarray_splice/array_combine(#280, #278, #285 stay open: object serialize ~2.8x php, shared hash-insert path).Not fixed here
#353 (partly), #34, #61, #187, #350, #395, #59 need design; #409 left as is on purpose.
Verification
Fixes #115, fixes #200, fixes #251, fixes #264, fixes #282, fixes #331, fixes #344, fixes #345, fixes #346, fixes #347, fixes #349, fixes #351, fixes #352, fixes #397, fixes #400, fixes #401, fixes #402, fixes #403, fixes #405, fixes #406, fixes #408, fixes #411, fixes #412, fixes #413, fixes #414, fixes #415, fixes #417, fixes #418, fixes #419, fixes #420, fixes #421, fixes #422, fixes #423, fixes #424, fixes #426, fixes #58, fixes #69