# [Strawpoll] Promoting redefining constant to exception

- Thread: https://externals.io/message/116914
- Original archive: https://news-web.php.net/php.internals/116914
- Started by Mark Randall on 2022-01-23T03:29:26+00:00
- Messages: 1
- RFC: Exception on constant redefintion (Inactive) — https://externals.io/rfc/constant_redefinition.md
- Reply by email to internals@lists.php.net
- More for agents: search with https://externals.io/search.md?q={query} · RFCs at https://externals.io/rfc.md · JSON API at https://externals.io/api · documentation at https://externals.io/llms.txt

---

## #116914 — Mark Randall — 2022-01-23T03:29:26+00:00

URL: https://externals.io/message/116914#116914

Internals,

While cleaning up some PRs I was prompted to re-visit one I had 
outstanding about exception-throwing behaviour when redefining 
constants, this applies to functions like define and language syntax 
constructs such as const.

There have been a few discussions in the past about the topic.

Here is one from 2016 from Dmitry:
https://wiki.php.net/rfc/constant_redefinition

Discussion:
https://externals.io/message/93885

My own PR:
https://github.com/php/php-src/pull/5265

Since Dmitry's RFC was made in 2016, and my PR a while ago, attempted 
redeclaration was promoted from a notice to a warning, but I still think 
it's sensible to go one step further.

There was mention on github that there was some resistence to promotion 
to exception in the past, but I think there is a strong possibility that 
the mood may be different many years later, with PHPs positive moves 
towards throwing on poorly defined or illogical behaviour.

To gauge this, I'm throwing out a non-binding strawpoll to get the lay 
of the land before doing anything else with it. If there is general 
favour I'll fix up my patch and do a proper RFC.

https://wiki.php.net/redefine_constants_exception_strawpoll

Mark Randall
