I got this warning when I tried to break a lock on a View I'd reverted to code default:

Notice: Array to string conversion in drupal_prepare_form() (line 964 of includes/form.inc). Backtrace:

drupal_prepare_form('views_ui_break_lock_confirm', 'fhere is no lock on view %view to break.', Array) form.inc:330
drupal_build_form('views_ui_break_lock_confirm', Array) form.inc:123
drupal_get_form('views_ui_break_lock_confirm', Object)
call_user_func_array('drupal_get_form', Array) menu.inc:503
menu_execute_active_handler() index.php:21

CommentFileSizeAuthor
#7 1342216.patch559 bytesdawehner
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

zymsys’s picture

PHP 5.4 added notifications for cases like this which may give inaccurate results:

https://bugs.php.net/bug.php?id=60198

I've noticed this also in menu.inc in menu_link_save at line 3112 in 7.9 and the current git version. I think that each use will need to be reviewed and we may need to write a replacement function which does deep comparisons. This should be easy to do with serialize().

I'm going to take a deeper look, but I'm new to Drupal so I may not be the best candidate to fix it... I'll try anyway.

zymsys’s picture

I've fixed my case of this issue (in menu) and submitted a patch to that issue:

http://drupal.org/node/1338282#comment-5257910

I expect that the same function would solve this problem, but I'm not using Views and haven't tested it.

dawehner’s picture

@joachim, @zymsys
Can you say whether this is a php5.4 only error? I would try to install this in a virtual machine then.

zymsys’s picture

Yes. My understanding is that this notice was added to PHP 5.4. I totally blew it with that post to the other issue though... I posted an old version of the function which doesn't work. Now I'm having trouble with my test environment, but I hope to have a corrected patch up soon.

dawehner’s picture

Well if this is a core bug + php 5.4 only there is likely no easy way/no reason to fix it in views directly.

joachim’s picture

I'm pretty sure I've only got PHP 5.3

dawehner’s picture

Status: Active » Needs review
FileSize
559 bytes

This patch probably fixes the issue. I had to manually reproduce the error by changing the logic in the if() above, but in general
it seems to make sense not to return a string, if a form array is expected.

joachim’s picture

> but in general it seems to make sense not to return a string, if a form array is expected.

Yup, that makes sense.
Not tested, but patch looks good to me.

dawehner’s picture

Status: Needs review » Fixed

Thanks for having a short look. Committted to 7.x-3.x

Status: Fixed » Closed (fixed)

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