[development] Seg fault in PHP (FormsAPI)? Can you reproduce?
Sammy Spets
sammys-drupal at synerger.com
Thu Apr 27 07:08:27 UTC 2006
Thanks Tadej! Interesting. Still looking for more examples.
Cheers,
--
Sammy Spets
Synerger Pty Ltd
http://www.synerger.com/
On 27-Apr-06 08:52, Tadej Ba??a wrote:
> On XAMPP - Apache + PHP 5.1 only this error occurs when I uncomment the
> faulty line...
>
> Fatal error: Cannot create references to/from string offsets nor
> overloaded objects in D:\htdocs\drupal7\includes\form.inc on line 341
>
> cheers,
> tadej
>
> Sammy Spets pravi:
> >Hi everyone,
> >
> >I've just run into a segfault situation during development of a form
> >element. Basically, all I changed from a working system was add a new
> >form element and accidentally left something off one of the child
> >element definitions. Here is a code snippet you can drop into a module
> >and see if you can reproduce it.
> >
> >PHP Version: 4.3.10-16
> >System: Debian Sarge
> >Kernel: 2.6.8-3-k7
> >
> >function maillist_elements() {
> > $type['listadmin'] = array('#input' => TRUE, '#process' =>
> >array('expand_listadmin' => array()));
> > return $type;
> >}
> >
> >function expand_listadmin($element) {
> > $options = array('blah' => 'blah');
> > $element['list'] = array('#type' => 'select', '#options' => $options,
> >'#value' => $element['#value']['list']);
> >// $element['or'] = array('#type' => 'markup', '<span style="padding: 0
> >20px; text-weight: bold;">OR</span>');
> > $element['or'] = array('#type' => 'markup', '#value' => '<span
> >style="padding: 0 20px; text-weight: bold;">OR</span>');
> > $element['text'] = array('#type' => 'textfield', '#size' => 50,
> >'#maxlength' => 256, '#value' => $element['#value']['text']);
> > $element['#tree'] = TRUE;
> > return $element;
> >}
> >
> >function theme_listadmin($element) {
> > $output = '<div class="container-inline">' . $element['#children'] .
> >'</div>';
> > return theme('form_element', $element['#title'], $output,
> >$element['#description'], $element['#id'], $element['#required'],
> >form_get_error($element));
> >}
> >
> >The commented out line is the one that is causing the segfault. The line
> >below is the working line.
> >
> >It could be the forms API code ends up in an infinite loop over this
> >little fella and, if so, i'm happy to fix it. Just need someone to
> >reconfirm this happens (especially in another version of PHP).
> >
> >Cheers,
> >
>
More information about the development
mailing list