Re: notices nightmare - looking for a regex solution

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

 



You can put an @  symbol in front each item that is throwing the error.
That may take some time though.  You could use something like

find /htdocs_folder -name \*.php -print | xargs sed -i
s/\$array_name/@$array_name/g

That might get you what you're looking for.  But be cautious because this
method does not create a backup file for you.   You can do a quick check
(but not fool proof) by using this command

find /htdocs_folder -name \*.php -print | xargs grep "\$array_name" | more

You may need to remove the slash in front of the $ sign.

Matt

On Wed, Jun 1, 2011 at 6:26 PM, Merlin Morgenstern <merlin_x@xxxxxxxxxxx>wrote:

> Hi there,
>
> I am working on a pretty huge site with thousands of files with php code.
> Unfortunatelly the app throws a ton of notices du to missing '' in arrays.
> Of course I could simply disable the output on the dev server to surpress
> notices, but I would rather like to get it fixed.
>
> Has somebody a good idea on how to fix this automated somehow with regex?
>
> The vars are right now: $var[element] and should be $var['element']
>
> I was looking into sed, but I was hoping that there is also a way in php.
> Has anybody a hint on how to get the regex done?
>
> I appreciate any help on that.
>
> Best regards,
>
> Merlin
>
> --
> 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