I don't know enough about how PHP handles this sort of thing to understand what's going wrong, but this code crashes krumo:

    $o = new StdClass;
    $o->array = array(1, 3, 4);
    $o->p = 'property';
    dpm($o);
    $a = (array) $o;
    $a['array'] = 'foo';

The error is Fatal error: Cannot unset string offsets in /Users/joachim/Sites/transport-drupal/sites/all/modules/devel/krumo/class.krumo.php on line 610

It seems to be getting confused by trying to handle something that's now a string but used to be an array. But like I say, I don't understand what I'm changing in the original $o object -- nothing as far as I can see.

The use case btw is converting an array of synonyms on a term object into a string that can be saved with taxonomy_save_term().

CommentFileSizeAuthor
#7 krumo_arrays.patch498 bytesdrzraf
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

salvis’s picture

Priority: Critical » Normal

I can confirm this Krumo bug by pasting

    $o = new StdClass;
    $o->array = array(1, 3, 4);
    $o->p = 'property';
    dpm($o);
    $a = (array) $o;
    $a['array'] = 'foo';
    dpm($a);

into devel/php. The behavior is the same whether you dpm() $a or $o at the end, and it only occurs if you have two dpm() calls.

I get the crash in class.krumo.php on line 608, though, not 610.

josepvalls’s picture

Same problem.
Mine is also on 608.
Any suggestions?

Agileware’s picture

I also get Fatal error: Cannot unset string offsets in /sites/all/modules/devel/krumo/class.krumo.php on line 611
in the D7 version.

I think it is usually if i'm doing dpm(debug_backtrace());

thebuckst0p’s picture

Subscribe. Seeing this all over the place with D7, but never saw it in D6.

Finn Lewis’s picture

I'm getting this too in D7.

function [themename]_preprocess_page(&$variables, $hook) {
  dsm($variables); // crashes krumo
}

Gives me:

Fatal error: Cannot unset string offsets in ...sites/all/modules/devel/krumo/class.krumo.php on line 610

Drupal 7.0, Devel 7.x-1.0 & 7.x-1.x-dev

Although I noticed that I see this before the error:

Krumo version 0.2.1a
http://krumo.sourceforge.net
Called from ...sites/all/modules/context/context_ui/context_ui.module, line 67   

even though I'm calling it from template.php.

Will try disabling context in case this has any effect.

Finn Lewis’s picture

Disabled context ui, and it started working as expected.
I'll check if there's an issue over at the context issue queue.

drzraf’s picture

FileSize
498 bytes

Also got this one on D7 (with common modules, I didn't dig), simple workaround attached.

xtfer’s picture

Status: Active » Needs review

Patch at #7 looks like its working to me, but I haven't done much testing.

xtfer’s picture

Status: Needs review » Reviewed & tested by the community

#7 has been working in 6.x for 5 days of development without issue.

salvis’s picture

Committed to D8/D7/D6, thanks for patch and review!

salvis’s picture

Status: Reviewed & tested by the community » Fixed

Status: Fixed » Closed (fixed)

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

Anonymous’s picture

Fixed since September 3 last year, but stuck in the dev version at least of D7.

seanr’s picture

Version: 6.x-1.x-dev » 7.x-1.x-dev
Status: Closed (fixed) » Active

Just ran into this myself. Patch works perfectly; how about a release?

salvis’s picture

Version: 7.x-1.x-dev » 6.x-1.x-dev
Status: Active » Closed (fixed)

Moshe just created 7.x-1.3 a few days ago; how about updating?

doublejosh’s picture

Awesome! Needed with views alters.

BEER. FOR. YOU.