Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

Side effects run out of order in echo lists and array literal keys

Chiusa
#143 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 2 giorni

@Giandonn ci sta già lavorando.

Dal 2/10/2026.

  • #144 di @Giandonn — aperta

Valutazione

Difficoltà
4/5
Tempo stimato
3-5 giorni
Idoneità per principianti
65/100
Tipo di issue
Bug
Chiarezza
Abbastanza chiara
Stato di attività
Attiva
Stack tecnologico
php
Ambito
compilers

Direzione di ricerca

Reproduce the PHP and TypePHP outputs from the issue, then trace the pre-statement temporary materialization for nested calls in echo operands and array key/value evaluation. Add regression coverage for the three examples and verify that side effects, output, and exceptions occur in PHP's order without changing the already-correct constructs.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

A call nested inside an expression can be materialized into a pre-statement temporary. In two constructs this moves side effects (output, mutations, exceptions) ahead of work PHP performs first.

<?php
function f(string $s): string { echo "[$s]"; return $s; }
function boom(): string { throw new RuntimeException('boom'); }

function main(): void
{
    echo "A", var_export(f("1"), true), "\n";
    try { echo "E-", var_export(boom(), true), "\n"; } catch (RuntimeException $e) { echo "| caught\n"; }
    $a = [f("k1") => strtoupper(f("v1")), f("k2") => f("v2")];
    echo "\n";
}
PHP TypePHP master
echo "A", var_export(f("1"), true) A[1]'1' [1]A'1'
echo "E-", var_export(boom(), true) E- then the exception the exception, E- is never printed
[f("k1") => strtoupper(f("v1")), f("k2") => f("v2")] [k1][v1][k2][v2] [v1][k1][v2][k2]

echo prints each operand before evaluating the next, and PHP evaluates an array key before its value. Function arguments, concatenation, binary operators and plain array values keep the right order (checked the same way).

Found with a differential fuzzer. Environment: PHP 8.4.26 ZTS + embed, GCC 11, Linux x64, master.

Lingua principale
PHP
Stelle
1.4k
Fork
80
Merge medio
1g 9h
PR unite (30g)
25

Preparare l'ambiente

Questo progetto non fornisce container di sviluppo, Dockerfile né guida per i contributori, quindi l'ambiente è a tuo carico: parti dal suo README e consulta la nostra guida al primo contributo per i passaggi generali.

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di swoole/typephp

Tutte le issue di swoole/typephp

Issue simili

Altre issue su PHP

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.