API page: http://api.drupal.org/api/drupal/includes%21common.inc/function/drupal_e...

I am not sure whether it's a bug or it's supposed to be so, but let me tell you.

$output = drupal_explode_tags('"my tag');

The function will return you empty array. Unless you closed the quote with its counterpart.

$output = drupal_explode_tags('"my tag, another tag');

On this input the function will return only the second tag "another tag".

$output = drupal_explode_tags('"my tag"');

And on this input the function will return the tag, however it will strip down the quotes.

I was working on a module with autocomplete look up functionality and I had a test entity named bla bla bla "hey hey" bla bla and when I tried looking up "hey hey it didn't return me expected suggestion. (as you can see I look up based on LIKE '%keyword%' and not LIKE 'keyword%')

I assume there can be some security implications, of which I am not aware, and for which this function was made this way. But if such does not exist, I guess it would be nice to rewrite it in order to support single quote better.

Comments

Status: Active » Closed (outdated)

Automatically closed because Drupal 7 security and bugfix support has ended as of 5 January 2025. If the issue verifiably applies to later versions, please reopen with details and update the version.