After upgrading to the 7.x-1.0, I am running into an error. Ctools seems to be the cause of this. This cropped up after doing a mass contrib update, so I went back to a previous version of my site and started by only upgrading ctools. Immediately the error cropped up :-(. It seems to change depending on the version of PHP.

PHP 5.3.9:
Warning: file_exists() expects parameter 1 to be string, array given in ctools_get_plugins() (line 253 of [edited out]/sites/all/modules/ctools/includes/plugins.inc).

PHP 5.2.17:
Notice: Array to string conversion in ctools_get_plugins() (line 253 of [edited out]/sites/all/modules/ctools/includes/plugins.inc).

This error pops up on all pages using Panels. I am also no longer able to upload videos using the Video module due to the same error.

A similar issue was also noticed in RC2:
#1488748: Array to string conversion
The suggestion was to apply this patch to PURL:
#1497258-2: Warning: file_exists() expects parameter 1 to be string, array given in ctools_get_plugins()

Sadly this patch did not fix the error. I was using PURL 7.x-1.0-beta1 before and after the upgrade.

Is there anything else I can provide to help you track down this issue?!

Comments

rowbeast’s picture

I'm having the same issue, and am not using PURL.
php 5.3.10
I'm getting the file_exists() error as detailed above.

I too am happy to help track it down. if you need a schema dump or access to the error itself I'm happy to provide it!

Thanks for all the work you do!

Patricia_W’s picture

Me too ...

michaelschutz’s picture

Just additional info, if it helps...I got this error when upgrading ctools to 1.0 and had purl enabled. It was showing on all pages on the site. When I disabled purl through drush, the error went away.

noslokire’s picture

Disabling the PURL module also worked for me. Doesnt look to be a CTools error.

merlinofchaos’s picture

If anyone could isolate what exactly purl is doing wrong to cause this, we could isolate that and validate the data so it would prevent errors and instead throw a watchdog notice or something.

emilianodelau’s picture

I had the same problem. When Spaces OG is activated (which requires PURL) then the error occurs.

Anonymous’s picture

PURL is supplying a parent plugin type of 'processor', then each processor plugin is supplied as a separate entry within the data array, of which 'path' is one element, which itself is an array with its own path and description.

What I think should happen is that each plugin that CTools is able to see should have the path data within the data array. Maybe an outdated API implementation?

Here's what I found with a bit of debugging:

 stdClass Object
(
    [cid] => plugins:purl:processor
    [data] => Array
        (
            [processor] => Array
                (
                    [handler] => Array
                        (
                            [class] => purl_processor
                            [file] => purl_processor.inc
                            [path] => sites/all/modules/vendor/purl/includes
                        )

                    [module] => purl
                    [name] => processor
                    [path] => sites/all/modules/vendor/purl
                    [file] => 
                    [plugin module] => purl
                    [plugin type] => processor
                )

            [path] => Array
                (
                    [title] => Path
                    [handler] => Array
                        (
                            [class] => purl_path
                            [file] => purl_path.inc
                            [path] => sites/all/modules/vendor/purl/includes
                            [parent] => processor
                        )

                    [module] => purl
                    [name] => path
                    [path] => sites/all/modules/vendor/purl
                    [file] => 
                    [plugin module] => purl
                    [plugin type] => processor
                )

            [pair] => Array
                (
                    [title] => Path pair
                    [null_id] => 1
                    [handler] => Array
                        (
                            [class] => purl_pair
                            [file] => purl_pair.inc
                            [path] => sites/all/modules/vendor/purl/includes
                            [parent] => path
                        )

                    [module] => purl
                    [name] => pair
                    [path] => sites/all/modules/vendor/purl
                    [file] => 
                    [plugin module] => purl
                    [plugin type] => processor
                )

            [subdomain] => Array
                (
                    [title] => Subdomain
                    [handler] => Array
                        (
                            [class] => purl_subdomain
                            [file] => purl_subdomain.inc
                            [path] => sites/all/modules/vendor/purl/includes
                            [parent] => processor
                        )

                    [module] => purl
                    [name] => subdomain
                    [path] => sites/all/modules/vendor/purl
                    [file] => 
                    [plugin module] => purl
                    [plugin type] => processor
                )

            [domain] => Array
                (
                    [title] => Domain
                    [handler] => Array
                        (
                            [class] => purl_domain
                            [file] => purl_domain.inc
                            [path] => sites/all/modules/vendor/purl/includes
                            [parent] => processor
                        )

                    [module] => purl
                    [name] => domain
                    [path] => sites/all/modules/vendor/purl
                    [file] => 
                    [plugin module] => purl
                    [plugin type] => processor
                )

            [extension] => Array
                (
                    [title] => File extension
                    [handler] => Array
                        (
                            [class] => purl_extension
                            [file] => purl_extension.inc
                            [path] => sites/all/modules/vendor/purl/includes
                            [parent] => processor
                        )

                    [module] => purl
                    [name] => extension
                    [path] => sites/all/modules/vendor/purl
                    [file] => 
                    [plugin module] => purl
                    [plugin type] => processor
                )

            [useragent] => Array
                (
                    [title] => User agent
                    [handler] => Array
                        (
                            [class] => purl_useragent
                            [file] => purl_useragent.inc
                            [path] => sites/all/modules/vendor/purl/includes
                            [parent] => processor
                        )

                    [module] => purl
                    [name] => useragent
                    [path] => sites/all/modules/vendor/purl
                    [file] => 
                    [plugin module] => purl
                    [plugin type] => processor
                )

            [querystring] => Array
                (
                    [title] => Query string
                    [null_id] => 1
                    [handler] => Array
                        (
                            [class] => purl_querystring
                            [file] => purl_querystring.inc
                            [path] => sites/all/modules/vendor/purl/includes
                            [parent] => processor
                        )

                    [module] => purl
                    [name] => querystring
                    [path] => sites/all/modules/vendor/purl
                    [file] => 
                    [plugin module] => purl
                    [plugin type] => processor
                )

        )

    [created] => 1334049534
    [expire] => 0
    [serialized] => 1
)
merlinofchaos’s picture

I'm not actually sure what this stdclass object is; the 'data' array that it contains looks like a list of plugins, but nothing I can think of in the plugins system creates this object. So it's hard for me to have any suggestions on this one.

merlinofchaos’s picture

Oh wait, I see. That's the data cache returned by cache_get().

merlinofchaos’s picture

OH! And now i see what the bug here is. Oh. That's a very silly piece of code, and completely non-functional.

Anonymous’s picture

Sorry, yes, should've explained myself a little better! Apologies for the confusion.

That's the cache output from PURL's plugins in the cache_get(), as you've said. This is why I think that PURL's plugin implementation needs a bit of rewriting, but you'd know better than me.

merlinofchaos’s picture

Status: Active » Closed (duplicate)

Ok, the cause of this bug is here: http://drupal.org/node/1371700#comment-5851864

Moving to that issue.

nvl.sateesh’s picture

Hey guys for anyone still having this issue, here is what i did and it worked. I did not read the whole thread, if there is any solution already.

I just added !is_array($cached->data['path']) in line 253. So, here is what that condition now looks like:

        if ((is_array($cache->data['path']) && file_exists($cache->data['path']['file'])) || 
                (  !is_array($cache->data['path']) && file_exists($cache->data['path'])  )) {

previously it was

        if ((is_array($cache->data['path']) && file_exists($cache->data['path']['file'])) || 
                file_exists($cache->data['path'])  ) {

I think this is only temporary fix. Some code needs to be rewritten in PURL module as per comments in other threads...

BuFr’s picture

I had the same problem here but the ctools 7.x-1.x-dev update fixed it for me.

lalit774’s picture

You can fix by change this also.

<?php
 if ((is_array($cache->data['path']) && file_exists($cache->data['path']['file'])) || 
                (  !is_array($cache->data['path']) && file_exists($cache->data['path'])  )) {

?>

Replace with

<?php
 if ((is_array($cache->data['path']) && file_exists($cache->data['path']['file'])) ||
           file_exists($cache->data['path']['path'])) {

?>

aaronmacy’s picture

ctools 7.x-1.x-dev update fixed it for me, too.

jawad.shah’s picture

yup ctools update also works for me

waqarit’s picture

Assigned: Unassigned » waqarit
Status: Closed (duplicate) » Fixed

I also found that problem But I just Update


Ctool

module, and hence fixed the error....:)

Status: Fixed » Closed (fixed)

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