Repository navigation
Commit 1f50514
committed
feat(core): audit-remediation suite re-ported to the active EIR backend
Remediates the compiler-audit findings on the active EIR backend (the
legacy AST emitters under src/codegen/ are frozen and left as-is). Each
fix is verified byte-exact against the PHP CLI; builds warning-free,
whitespace- and assembly-alignment-clean; docs and the builtin registry
regenerated.
Builtins (element-type / argument coverage):
- round($mode): PHP_ROUND_HALF_UP / PHP_ROUND_HALF_EVEN.
- min()/max(): coerce a boxed Mixed operand to its numeric value.
- in_array()/array_search(): accept the optional $strict flag.
- array_sum()/array_product(): float-element arrays (float result reg).
- sort()/rsort(): float-element arrays ordered by IEEE numeric value.
- array_merge(): indexed string arrays via the 16-byte-slot helper.
- array_slice(preserve_keys: true): key-preserving associative slice.
- array_map($cb, $a, $b): two-input-array form (int/string subset).
- array_merge()/array_diff()/array_intersect(): accept three or more
arrays, folded left-associatively into the two-array runtime with the
intermediate arrays released.
- substr(): negative length drops characters from the end (PHP parity).
- is_a()/is_subclass_of(): boxed Mixed receiver (runtime class-id match)
and string class-name subject (with is_a allow_string semantics).
- number_format(): multi-byte separators preserved (ptr+len ABI), and
rounds half away from zero (PHP_ROUND_HALF_UP) instead of snprintf's
half-to-even.
Language safety:
- Division / modulo by zero raise an (uncatchable) fatal instead of
producing INF / 0; float `/` keeps NaN divisors as NaN.
- Constant folder computes `x % -1` as 0, avoiding the i64::MIN % -1
overflow panic.
EIR note: ir_lower derives its own builtin result types independent of
the checker, so the float-aggregate, array_slice-preserve, two-array
array_map, and variadic-merge result types are fixed there as well as in
the type checker.
Known residuals (pre-existing, tracked separately): number_format() /
round() do not apply PHP's _php_math_round pre-rounding, so FP-error
half cases (e.g. 1.005) differ; array-builtin results are not fully
reclaimed when consumed, so nested/variadic merges leak the result
header block (the intermediate payloads are explicitly released).
macOS-aarch64 green locally; Linux x86_64 / aarch64 via CI.1 parent c500d64 commit 1f50514
137 files changed
Lines changed: 3154 additions & 549 deletions
File tree
- docs
- internals/builtins
- array
- class
- math
- string
- type
- php
- builtins
- array
- math
- scripts/docs
- src
- builtins
- array
- math
- codegen_ir
- lower_inst
- builtins
- codegen
- abi
- runtime
- arrays
- strings
- ir_lower/expr
- optimize/fold
- types
- checker
- builtins
- driver
- tests
- codegen
- arrays
- indexed
- casts_and_constants
- oop
- optimizer/constant_folding
- strings
- type_builtins
- error_tests
Some content is hidden
Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
10 | 10 | | |
11 | 11 | | |
12 | 12 | | |
13 | | - | |
| 13 | + | |
14 | 14 | | |
15 | 15 | | |
16 | 16 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
10 | 10 | | |
11 | 11 | | |
12 | 12 | | |
13 | | - | |
| 13 | + | |
14 | 14 | | |
15 | 15 | | |
16 | 16 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
10 | 10 | | |
11 | 11 | | |
12 | 12 | | |
13 | | - | |
| 13 | + | |
14 | 14 | | |
15 | 15 | | |
16 | 16 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
10 | 10 | | |
11 | 11 | | |
12 | 12 | | |
13 | | - | |
| 13 | + | |
14 | 14 | | |
15 | 15 | | |
16 | 16 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
10 | 10 | | |
11 | 11 | | |
12 | 12 | | |
13 | | - | |
| 13 | + | |
14 | 14 | | |
15 | 15 | | |
16 | 16 | | |
| |||
31 | 31 | | |
32 | 32 | | |
33 | 33 | | |
34 | | - | |
| 34 | + | |
35 | 35 | | |
36 | 36 | | |
37 | 37 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
10 | 10 | | |
11 | 11 | | |
12 | 12 | | |
13 | | - | |
| 13 | + | |
14 | 14 | | |
15 | 15 | | |
16 | 16 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
10 | 10 | | |
11 | 11 | | |
12 | 12 | | |
13 | | - | |
| 13 | + | |
14 | 14 | | |
15 | 15 | | |
16 | 16 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
10 | 10 | | |
11 | 11 | | |
12 | 12 | | |
13 | | - | |
| 13 | + | |
14 | 14 | | |
15 | 15 | | |
16 | 16 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
10 | 10 | | |
11 | 11 | | |
12 | 12 | | |
13 | | - | |
| 13 | + | |
14 | 14 | | |
15 | 15 | | |
16 | 16 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
10 | 10 | | |
11 | 11 | | |
12 | 12 | | |
13 | | - | |
| 13 | + | |
14 | 14 | | |
15 | 15 | | |
16 | 16 | | |
| |||
0 commit comments