symphony-3 icon indicating copy to clipboard operation
symphony-3 copied to clipboard

Decide on method for sanitizing paths

Open allen opened this issue 14 years ago • 1 comments

From phoque:

Just wanted to point you to a commit I made to my Sym 3 repository: 96ac533b36718410a20ada6839e6173d08e53c79">http://github.com/phoque/symphony-3/commit/96ac533b36718410a20ada6839e6173d08e53c79

It's about the broken paths in Windows (backslashes and regular ones). Usually, PHP works fine even when both types of slashes are mixed in one path string. But in this case, Field::load() was broken as it was using those strings as array-indices.

I guess those errors will pop up quite regularily so I am asking for a general way of sanitizing them. I've introduced a new function sanitize_path() in symphony/lib/include.utilities.php that simply replaces backslashes with the regular ones. Is this the way you'd like Symphony to do that or would you put the function somewhere in symphony/lib/class.general.php?

I am more than happy to search for more Windows-specific problems so all I am asking is a way of sanitizing paths that fits you. :-)

allen avatar Jul 19 '10 12:07 allen

From Alistair:

Pretty sure all that is required is use of DIRECTORY_SEPARATOR constant. Need to weed out any code that constructs paths using hardcoded /

allen avatar Jul 19 '10 12:07 allen