Hello internals,
Would this change be acceptable to merge without an RFC?
https://github.com/php/php-src/pull/22589
It adds “did you mean …?” suggestions to errors for undefined functions.
While it does not change language semantics, it changes error messages and
introduces additional checks on error paths, so I would like to confirm
whether consensus on the PR is sufficient or an RFC is expected.
If the sentiment is positive, I would like to pursue this direction for
methods, classes, constants etc.
Similar approach is used in Python or Ruby already:
-
Python: https://docs.python.org/3/whatsnew/3.10.html#nameerrors
-
Ruby: https://docs.ruby-lang.org/en/3.3/DidYouMean.html
Kind regards,
Jorg
Hello Jorg,
“did you mean …?” suggestions to errors for undefined functions. While it does not change language semantics, it changes error messages and introduces additional checks on error paths, so I would like to confirm whether consensus on the PR is sufficient or an RFC is expected.
Thanks, this is great.
According to PHP Policy RFC: Exempt input type and value validation from BC Break policy https://wiki.php.net/rfc/policy-exempt-type-value-error-bc-policy, rephrasing error messages is not subject to the backwards compatibility break policy.
I think the amount of punctuation at the end is a bit much. Perhaps it would be clearer (although less strictly correct) to say "(did you mean func?)" instead of "(did you mean func()?)". But either way I am in favor of this.
Regards,
Sjoerd Langkemper
Hi,
Il 04/08/2026 09:55, Sjoerd Langkemper ha scritto:
Hello Jorg,
“did you mean …?” suggestions to errors for undefined functions. While
it does not change language semantics, it changes error messages and
introduces additional checks on error paths, so I would like to
confirm whether consensus on the PR is sufficient or an RFC is expected.Thanks, this is great.
According to PHP Policy RFC: Exempt input type and value validation from
BC Break policy <https://wiki.php.net/rfc/policy-exempt-type-value-
error-bc-policy>, rephrasing error messages is not subject to the
backwards compatibility break policy.
We are very close to the soft feature freeze. I'm looking forward to
hearing some feedback on the list.
I think the amount of punctuation at the end is a bit much. Perhaps it
would be clearer (although less strictly correct) to say "(did you mean
func?)" instead of "(did you mean func()?)". But either way I am in
favor of this.
I do agree here there's a bit too much punctuation. Perhaps something
similar to what Python does (according to the posted link)?
Call to undefined function defined(). Did you mean: define?
Cheers
Matteo Beccati