Re: redefine a define ...

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sat, Aug 25, 2012 at 2:27 PM, Lester Caine <lester@xxxxxxxxxxx> wrote:
> What I was not expecting was a string of 'Notices:' complaining about the
> redefines. So how does one get around this message? One can't 'if defined'
> as the string needs to be replaced with the more appropriate one. I would
> say, why is this even a problem, or alternatively I just give up on E_STRICT
> and make sure it's disabled again on PHP5.4?
>
> Having spent several months getting the code clean on E_STRICT, switching it
> off again will really pig me off, but I can't see any real alternative given
> the number of languages and strings that will need reworking simply to get
> things clean :(

Well, I'd do the following to avoid issues in the future.

1) Create a function like that below, which provides global access to
variables and allows you to update existing values:

	function val($name, $value = null)
	{
		static $values = array();

		if ($value === null) {
			return isset($values[$name]) ? $values[$name] : null;
		} else {
			return $values[$name];
		}
         }

2) Create a php script that searches out define("SOME_NAME_PATTERN",
"value") and replaces that with val("some_name_pattern", "value").

3) Create a php script that searches out SOME_NAME_PATTERN and
replaces with val("SOME_NAME_PATTERN");

Not too bad in terms of work, as PHP's parsing capabilities are really nice.

Hope this gives you ideas :)

Adam

-- 
Nephtali:  A simple, flexible, fast, and security-focused PHP framework
http://nephtaliproject.com

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux