Cliff Hirsch wrote:
I had a very strange error, catastrophic yesterday.
PEAR Config writes a PHP array file like so:

<?php

$config = array(
 param1 => 'value',
 param2 => 'val'ue2',
 ...
);

The writing process is what failed to generate the backslash. The parsing happens on subsequent page loads. The strange thing is that I have not been able to reproduce the error and I looked the the PEAR Config code, which
does use addcslashes($val, "\\'").
addcslashes failed to put a slash in front of a single quote. Can anyone imagine how this could happen? Is it possible it didn’t catch a multi-byte character? Am I back to charset issues?
Yeah... weird. I'm not terribly familiar with addcslashes or PEAR Config... but I do write a config file in a similar way to you... except I use smarty to write it and use the {$var|escape:'quotes'} modifier. I'm looking at the code for that modifier and it uses this odd regular expression:

preg_replace("%(?<!\\\\)'%", "\\'", $string);

Unfortunately, I can’t reproduce the error.
You tried a resave of your config with the same exact settings and it worked? I dunno. Is there anything else that could possible modify your config file? Or anyway that PEAR Config can write something without passing it through addcslashes?
_______________________________________________
New York PHP Community Talk Mailing List
http://lists.nyphp.org/mailman/listinfo/talk

NYPHPCon 2006 Presentations Online
http://www.nyphpcon.com

Show Your Participation in New York PHP
http://www.nyphp.org/show_participation.php

Reply via email to