Re: [PHP-DEV] [Strawpoll] Promoting redefining constant to exception

2022-01-26 Thread Chase Peeler
On Tue, Jan 25, 2022 at 5:11 PM Rowan Tommins wrote: > On 25/01/2022 19:44, Chase Peeler wrote: > > If we start throwing exceptions, which can't be suppressed, it will make > > this much more difficult to read since the constants.php will have to be > > updated: > > > > if(!defined('dbserver')){

Re: [PHP-DEV] [Strawpoll] Promoting redefining constant to exception

2022-01-25 Thread Rowan Tommins
On 25/01/2022 19:44, Chase Peeler wrote: If we start throwing exceptions, which can't be suppressed, it will make this much more difficult to read since the constants.php will have to be updated: if(!defined('dbserver')){ define('dbserver','productiondb.example.com'); } if(!defined('othercons

Re: [PHP-DEV] [Strawpoll] Promoting redefining constant to exception

2022-01-25 Thread Bruce Weirdan
On Tue, Jan 25, 2022 at 9:45 PM Chase Peeler wrote: > it will make this much more difficult to read since the constants.php will > have to be > updated: > > if(!defined('dbserver')){ > define('dbserver','productiondb.example.com'); > } > if(!defined('otherconstant')){ >define('otherconstan

Re: [PHP-DEV] [Strawpoll] Promoting redefining constant to exception

2022-01-25 Thread Chase Peeler
On Tue, Jan 25, 2022 at 3:08 PM Kamil Tekiela wrote: > A constant is a value that, unlike a variable, cannot be reassociated with > a different value. A properly written software should never redefine > constants. The possibility of redefining constants in PHP should be > considered a bug rather

Re: [PHP-DEV] [Strawpoll] Promoting redefining constant to exception

2022-01-25 Thread Kamil Tekiela
A constant is a value that, unlike a variable, cannot be reassociated with a different value. A properly written software should never redefine constants. The possibility of redefining constants in PHP should be considered a bug rather than a feature. Constants are not good for configuration values

Re: [PHP-DEV] [Strawpoll] Promoting redefining constant to exception

2022-01-25 Thread Chase Peeler
We have a main "constants.php" file that resides in git. The first line of constants.php includes local_constants.php, which is kept out of git. The idea is that we can "override" any of the constants on a per server basis. constants.php: @define('dbserver','productiondb.example.com'); local_cons

[PHP-DEV] [Strawpoll] Promoting redefining constant to exception

2022-01-22 Thread Mark Randall
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 top