After installing the module, the following warning message appears at the top of all Drupal pages :

warning: strpos() [function.strpos]: Empty delimiter. in C:\Program Files\xampp\htdocs\drupal\sites\all\modules\views_bulk_operations\views_bulk_operations.module on line 69.

I'm using it with Drupal 5.7 and Views 5.x-1.6

Comments

infojunkie’s picture

Assigned: Unassigned » infojunkie
Status: Active » Fixed

I committed a fix in the latest -dev. Please confirm that it removed the warning.

On the side, can you please confirm that the "Operations" tab appears in a Views Bulk Operations view, when you access it both from its dedicated URL and from within the Views management page?

ronan’s picture

I can confirm that the latest dev does not throw that error any more. It was reported to me here: http://drupal.org/node/219396.

Anonymous’s picture

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for two weeks with no activity.

fago’s picture

Status: Closed (fixed) » Needs review

hm, I don't think it's a good fix to just ignore the error message? Shouldn't it be avoided?

Here is how I fixed it for beta5:

Index: views_bulk_operations_5/views_bulk_operations.module
===================================================================
--- views_bulk_operations_5/views_bulk_operations.module        (Revision 1341)
+++ views_bulk_operations_5/views_bulk_operations.module        (Arbeitskopie)
@@ -66,7 +66,7 @@
     else {
       $urls = views_get_all_urls();
       foreach ($urls as $key => $url) {
-        if (strpos($_GET['q'], $url) !== FALSE) {
+        if ($url && strpos($_GET['q'], $url) !== FALSE) {
           $view_name = $key;
           break;
         }
infojunkie’s picture

Status: Needs review » Fixed

Committed. Thanks.

Anonymous’s picture

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for two weeks with no activity.

adixon’s picture

That fix doesn't quite work for me - seems that the strpos gets executed regardless of the FALSEness of the first condition.

So I used:

@@ -66,9 +66,11 @@
     else {
       $urls = views_get_all_urls();
       foreach ($urls as $key => $url) {
-        if (strpos($_GET['q'], $url) !== FALSE) {
-          $view_name = $key;
-          break;
+        if ($url) {
+         if (strpos($_GET['q'], $url) !== FALSE) {
+            $view_name = $key;
+            break;
+         }
         }
       }

But I'm also a little wary about the source of this problem:

1. why does it appear twice (suggests that the non-cached version of the menu hook is being run twice)?
2. why is $url empty? I guess that's for views with no page version?
3. That strpos condition looks dangerous, suggests that partial matches might happen in an unexpected way. I think you only want to match when strpos === 0, no?

infojunkie’s picture

Status: Closed (fixed) » Active

Re-opened. @adixon: I'll check your case soon. Thanks for your report.

infojunkie’s picture

Are you using 5.x-1.0-beta5 or the latest 5.x-1.1 (or -1.x-dev)? The diff snippet you included in your report did *not* contain the statement

if ($url && strpos(..., $url) !== FALSE)

so I'm wondering about the version of the module that you've been using. Can you please check on that?

As for your other questions:
* I don't know. The Drupal menu system works in mysterious ways.
* That's a good guess. Again I don't know.
* Your suggestion makes sense. It has to be tested though because there might be special or unforeseen cases.

infojunkie’s picture

Status: Active » Closed (fixed)

Nothing happened on that thread. Closing unless anyone minds.