Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
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
Comment | File | Size | Author |
---|---|---|---|
#7 | 1342216.patch | 559 bytes | dawehner |
Comments
Comment #1
zymsys CreditAttribution: zymsys commentedPHP 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.
Comment #2
zymsys CreditAttribution: zymsys commentedI'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.
Comment #3
dawehner@joachim, @zymsys
Can you say whether this is a php5.4 only error? I would try to install this in a virtual machine then.
Comment #4
zymsys CreditAttribution: zymsys commentedYes. 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.
Comment #5
dawehnerWell if this is a core bug + php 5.4 only there is likely no easy way/no reason to fix it in views directly.
Comment #6
joachim CreditAttribution: joachim commentedI'm pretty sure I've only got PHP 5.3
Comment #7
dawehnerThis 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.
Comment #8
joachim CreditAttribution: joachim commented> 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.
Comment #9
dawehnerThanks for having a short look. Committted to 7.x-3.x