Re: [RFC] Import of variables

From: Date: Sun, 09 Aug 2020 22:10:49 +0000
Subject: Re: [RFC] Import of variables
References: 1 2 3 4  Groups: php.internals 
Request: Send a blank email to internals+get-111408@lists.php.net to get a copy of this message
Hi, Josh. Thanks ---- En dom, 09 ago 2020 21:36:30 +0200 Josh Bruce <josh@joshbruce.dev> escribió ---- > Have not tested - just catching up on emails. > > To verify: A property defined with a default value of the global does not already do this? In functions/methods. In some files can "inherit" gobal vars directly or simply "inherit" local vars of other function. > Developer need: I rarely access global variables directly - usually going through a lib or > framework. When I do I would probably wrap the access in a trait or method on a class. Some frameworks or CMS use view files in PHP like templates. https://platesphp.com/v3/templates/syntax/#syntax-example In WordPress case: "Developers are advised to consider this a Reserved Name List, and not to create local variables with the same names in Plugins or Themes. Under some circumstances, the global variable value will be replaced by the local variable value, causing errors in the WordPress Core that are difficult to diagnose. " https://codex.wordpress.org/Global_Variables This could be avoid easily with "use vars none" on the start of each file of theme/plugin. Regards

« previous php.internals (#111408) next »