Re: [RFC][Discussion] Make compact function reports undefined passed variables

From: Date: Mon, 02 Apr 2018 11:21:47 +0000
Subject: Re: [RFC][Discussion] Make compact function reports undefined passed variables
References: 1  Groups: php.internals 
Request: Send a blank email to internals+get-102013@lists.php.net to get a copy of this message
----- Original Message ----- > From: "Gabriel Caruso" <carusogabriel34@gmail.com> > To: "internals" <internals@lists.php.net> > Sent: Monday, April 2, 2018 11:17:43 AM > Subject: [PHP-DEV] [RFC][Discussion] Make compact function reports undefined passed variables > Hello dear internals, how are you? > > I'd like to propose a new RFC to PHP's core, but as this one contains a BC > Break, let's discussed it before making anything official. > > A couple of days ago, while discussing some [Coding Standards rules for > Doctrine, forbidden the compact function]( > https://github.com/doctrine/coding-standard/pull/49), an > argument caught my > attention: > >> The compact function var does not report undefined >> variables. > > Looking in [the compact > documentation](https://secure.php.net/compact), > this is even emphasizes: > >> Any strings that are not set will simply be skipped. > > I couldn't figure out why this is done this way, but, here's what I'd like > to propose: make the compact function starts to report > undefined passed > variables for it. > > With [only 2 lines of code]( > > https://github.com/php/php-src/compare/master...carusogabriel:warning-unknow-compact-variable), > this is possible, but, of course, this is a BC Break. > > Let me know your opinion on that, and perhaps, make it happen! > > Regards, > -- > Gabriel Caruso Hey Gabriel, What I am missing here is the reason why we should break well defined behavior of existing functions. How is the BC break for all existing code justified? Pieter

« previous php.internals (#102013) next »