Edit report at https://bugs.php.net/bug.php?id=26678&edit=1
ID: 26678 Comment by: vovan-ve at yandex dot ru Reported by: gnif at spacevs dot com Summary: preg_quote doesn't quote forward slashes Status: Bogus Type: Bug Package: *Regular Expressions Operating System: Debain PHP Version: 4.3.2 Block user comment: N Private report: N New Comment: I'm sorry for necroposting. Why optional value for $delimiter is NULL? I cannot understand, when I must not escape any delimiter? PCRE always requires delimiter for regexp. I think, there are no such situation, when delimiter can be omitted. OTOH, preg_quote() must not suppose, that delimiter is slash by default due to there are no defaults to delimiter in regexp. In this case, why $delimiter _is_ optional? Previous Comments: ------------------------------------------------------------------------ [2003-12-20 02:50:19] e...@php.net Thank you for taking the time to write to us, but this is not a bug. Please double-check the documentation available at http://www.php.net/manual/ and the instructions on how to report a bug at http://bugs.php.net/how-to-report.php see http://www.php.net/preg_quote echo preg_quote($file, \"/\"); ------------------------------------------------------------------------ [2003-12-19 21:58:20] gnif at spacevs dot com Description: ------------ if you use preg_quote to escape a string with forward slashes in it, it doesn't quote them. Reproduce code: --------------- $file = 'pages/box/test.php'; echo preg_quote($file); Expected result: ---------------- pages\/box\/test\.php Actual result: -------------- pages/box/test\.php ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=26678&edit=1