Awkward error using first-class callable syntax with missing function
Nessuno ha ancora preso questa issue.
- Lingua principale
- C
- Stelle
- 40.4k
- Fork
- 8.2k
- Merge medio
- 2g 13h
- PR unite (30g)
- 96
Descrizione
Description
The following code:
<?php
'missing'(...);
Resulted in this output:
Fatal error: Uncaught Error: Call to undefined function missing()
But I expected this output instead:
Fatal error: Uncaught Error: Unable to create closure from undefined function missing()
When using the first-class callable syntax on a missing function, the error message claims the user is calling a function. However, this should only be creating a closure.
I thought the (...) syntax would only try to create a closure. Does it actually try to call the function with a ... argument if it's not found?
If you use the original Closure::fromCallable() method, the error is different.
Closure::fromCallable('missing');
Uncaught TypeError: Failed to create closure from callable: function "missing" not found or invalid function name
PHP Version
8.1
Operating System
No response
Guida per i contributori
Apri la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Direzione di ricerca
Inizia riproducendo l’esempio PHP 8.1 con 'missing'(...); e confronta il relativo errore con Closure::fromCallable('missing'). Traccia la gestione di un callable di prima classe per una funzione non definita; è completato quando la sintassi segnala un errore di creazione della closure invece di affermare che la funzione è stata chiamata.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Valutazione
- Stack tecnologico
- php
- Ambito
- compilers
- Tipo di issue
- Bug
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Stato di attività
- Ferma
- Chiarezza
- Specificata chiaramente
- Idoneità per principianti
- 45/100