Invalid line offset '#children' in drupal_render ()

My complete calendar gives errors when viewing from the site:

Warning: invalid argument provided by foreach () in element_children () (regel 6400 van C: \ Users \ Simon \ My Websites \ Xampp \ htdocs \ xxx \ includes \ common.inc).
Warning: invalid line offset # of # children in drupal_render () (regel 5867 van C: \ Users \ Simon \ My Websites \ Xampp \ htdocs \ xxx \ includes \ common.inc).
Warning: Invalid line offset "#children" in drupal_render () (regel 5877 van C: \ Users \ Simon \ My Websites \ Xampp \ htdocs \ xxx \ includes \ common.inc).
Warning: invalid line offset # of children # in drupal_render () (regel 5915 van C: \ Users \ Simon \ My Websites \ Xampp \ htdocs \ xxx \ includes \ common.inc).
Warning: invalid line offset '#printed' in drupal_render () (regel 5922 van C: \ Users \ Simon \ My Websites \ Xampp \ htdocs \ xxx \ includes \ common.inc).

I read somewhere that it does not work well under PHP 5.4xx.

Any solution?

+4
source share
7 answers

This is a known issue with PHP / Drupal. All errors that you see are not errors, they are just warnings and can be very safely ignored. You only need to take care of the lines starting with Error: ....

To safely ignore these warnings, edit your drupal sites/default/settings.php and add the following line:

 error_reporting(E_ALL & ~(E_STRICT|E_NOTICE|E_WARNING)); 

This will also solve the same problem for other plugins.

The recommended performance tuning for Drupal is to completely disable error reporting so that your users do not receive any cryptic error messages. To create a Drupal website you must:

 error_reporting(0); 

And if you need to see errors on your website, use nginx logs.

Edit: fix report error, add production notes

+3
source

Best tip:

1) To hide user warnings / errors / notifications on the Drupal 7 real site, go to [SITE] / admin / config / development / logging and disable the error display. Do not do this in your settings file, as you will lose the ability to find problems.

2) Often it is worth debugging a little. Although it is true that, as a rule, warnings and notifications can be safely ignored, they will slow down your site (see. Does php work faster without warnings? ). Often an error occurs due to a known problem with a particular Drupal module, and a bug can be fixed on drupal.org that fixes the problem. The source of this particular (and general) error can be difficult to track, but there is a useful discussion on how to do this here: http://fuseinteractive.ca/blog/put-your-children-their-place-drupal-debug-snippet

In your case, this is probably an error in the Calendar module (provided that you use it to create your calendar), and you probably want to see the problem queue there: https://drupal.org/project/issues/calendar?categories = 1

+16
source

It looks like you are trying to display elements that do not have the correct layout of the array. Try using debug_backtrace() and debug_print_backtrace() to find the warning code.

You can also remove modules and see when the error disappears. Be sure to clear your cache to make sure you haven't tricked anyone.

Other commands you can use are dd() dpm() krumo() from the devel module.

Also see: http://php.net/display-errors and http://php.net/display-startup-errors

David

+3
source

I received tons of similar warnings with Drupal 7.23 and PHP 5.4, especially from panels. I just changed the PHP version from 5.4 to 5.3 (one php.ini) in cPanel / PHP Config and all of these warnings and notes disappeared.

0
source

Does it help, I donโ€™t know, but I had a similar error message, the name of the machine of the content type changed because of me .... I returned to the previous backup, which also changed the type of content, deleted it, recreated it with the intended name and all is well

0
source

Associated problem: in the commons_events module, equivalent error messages were caused by porting from PHP 5.3 to 5.4 and fixed in # 1995834: PHP 5.4. Be present on the Page Error page on page # 13 .

0
source

Adding this patch to the common.inc file helped me fix my problems

 diff --git a/includes/common.inc b/includes/common.inc index c6303ef..e8f7e66 100644 --- a/includes/common.inc +++ b/includes/common.inc @@ -6007,7 +6007,9 @@ function drupal_render(&$elements) { // for speed. if ($elements['#children'] == '') { foreach ($children as $key) { - $elements['#children'] .= drupal_render($elements[$key]); + if (is_array($elements[$key])) { + $elements['#children'] .= drupal_render($elements[$key]); + } } } 
0
source

Source: https://habr.com/ru/post/1483561/


All Articles