Hello there.
I'd like to announce that I've opened the RFC for voting until 06/18.
https://wiki.php.net/rfc/compact
Thanks.
Gabriel Caruso
Hi Gabriel,
compact()
, extract()
, parse_str()
(with 1 argument) and get_defined_vars()
are bad functions, because they access local variables indirectly.
They might be considered to be removed in the next major PHP version, despite of this fix.
Thanks. Dmitry.
Am 09.06.2018 um 12:03 schrieb Dmitry Stogov:
They might be considered to be removed in the next major PHP version, despite of this fix.
+1
compact()
,extract()
,parse_str()
(with 1 argument) andget_defined_vars()
are bad functions, because they access local variables indirectly.
While I agree that extract()
and parse_str()
can be dangerous, I don't
understand why compact()
and get_defined_vars()
are “bad”. If the issue
is that these functions allow to access (local) variables by their name
(given as string), that appears to be not uncommon in PHP; cf. variable
variables and $GLOBALS.
They might be considered to be removed in the next major PHP version, despite of this fix.
That would certainly require the RFC process, and in my opinion, a
deprecation phase would be very appropriate. Note that parse_str()
without second argument is already deprecated as of PHP 7.2.0 and
scheduled for removal in the next major version[1].
[1]
https://wiki.php.net/rfc/deprecations_php_7_2?s[]=parse&s[]=str#parse_str_without_second_argument
--
Christoph M. Becker
Em sáb, 9 de jun de 2018 às 11:27, Christoph M. Becker cmbecker69@gmx.de
escreveu:
compact()
,extract()
,parse_str()
(with 1 argument) and
get_defined_vars()
are bad functions, because they access local variables
indirectly.While I agree that
extract()
andparse_str()
can be dangerous, I don't
understand whycompact()
andget_defined_vars()
are “bad”. If the issue
is that these functions allow to access (local) variables by their name
(given as string), that appears to be not uncommon in PHP; cf. variable
variables and $GLOBALS.
Agree here. I think that compact()
should be modified just to work like
compact($a, $b, $c) instead of compact('a', 'b', 'c'). It is very useful
for template engines.
They might be considered to be removed in the next major PHP version,
despite of this fix.That would certainly require the RFC process, and in my opinion, a
deprecation phase would be very appropriate. Note thatparse_str()
without second argument is already deprecated as of PHP 7.2.0 and
scheduled for removal in the next major version[1].[1]
<
https://wiki.php.net/rfc/deprecations_php_7_2?s[]=parse&s[]=str#parse_str_without_second_argument--
Christoph M. Becker--
--
David Rodrigues
Hi Gabriel,
compact()
,extract()
,parse_str()
(with 1 argument) and
get_defined_vars()
are bad functions, because they access local variables
indirectly.They might be considered to be removed in the next major PHP version,
despite of this fix.Thanks. Dmitry.
Hello Dmitry.
Thanks for this feedback. When I decided to create this RFC adding a
warning, many of friends actually suggested me creating an RFC depracting
compact
, and complaing with the same arguments as yours.Do you think we should do this already in PHP 7.3?
Thanks.
--
Gabriel Caruso