This is the official MySQL UDF Repository bug tracker. Please use it with care.
- Before submitting a new bug report, please make sure the bug is not already reported.
- Include the given error code, trace and any other debugging information supplied.
- Please leave your e-mail address, so we can get back to you if it is unclear how to reproduce the bug.
Thank you!
FS#10 - preg_replace(pattern, replacement, str) returns empty string when replacement is NULL
Attached to Project:
lib_mysqludf_preg
Opened by 'vitspec-gmail' - Friday, 23 January 2009, 16:57 GMT+2
Opened by 'vitspec-gmail' - Friday, 23 January 2009, 16:57 GMT+2
|
Detailspreg_replace(pattern, replacement, str) returns empty string when replacement is NULL
mysql-5.1.22 |
This task depends upon
this as an error condition matches php's handling of the empty-string as an error condition.
One minor improvement could be to recognize a NULL that is passed in as a constant argument and error in the init function
where a message can be passed back to the user.
like this bug is for NULL replacements.
error. I don't think this is a great choice because of the limited error handling capabilities of the mysql udf api. Choice 2 is to return the subject unchanged.
This might be the most appropriate choice but I'm not sure its what is expected, and there is a reasonable workaround which is to filter out the NULLs before calling preg_replace. Choice 3 is what currently occurs which is that the portion of the regex
that matches the pattern is removed (ie. replaced with an empty string). I'll leave this bug open in case anyone wants to suggest some better
approaches or provide some specific examples of what should occur.