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().

Files: 
CommentFileSizeAuthor
#7 krumo_arrays.patch498 bytesdrzraf
FAILED: [[SimpleTest]]: [MySQL] Unable to apply patch krumo_arrays.patch. This may be a -p0 (old style) patch, which is no longer supported by the testbots.
[ View ]

Comments

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.

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

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());

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

I'm getting this too in D7.

<?php
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.

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

StatusFileSize
new498 bytes
FAILED: [[SimpleTest]]: [MySQL] Unable to apply patch krumo_arrays.patch. This may be a -p0 (old style) patch, which is no longer supported by the testbots.
[ View ]

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

Status:Active» Needs review

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

Status:Needs review» Reviewed & tested by the community

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

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

Status:Reviewed & tested by the community» Fixed

Status:Fixed» Closed (fixed)

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

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

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?

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?

Awesome! Needed with views alters.

BEER. FOR. YOU.