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().
Comment | File | Size | Author |
---|---|---|---|
#7 | krumo_arrays.patch | 498 bytes | drzraf |
Comments
Comment #1
salvisI can confirm this Krumo bug by pasting
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.
Comment #2
josepvalls CreditAttribution: josepvalls commentedSame problem.
Mine is also on 608.
Any suggestions?
Comment #3
Agileware CreditAttribution: Agileware commentedI 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());
Comment #4
thebuckst0p CreditAttribution: thebuckst0p commentedSubscribe. Seeing this all over the place with D7, but never saw it in D6.
Comment #5
Finn Lewis CreditAttribution: Finn Lewis commentedI'm getting this too in D7.
Gives me:
Drupal 7.0, Devel 7.x-1.0 & 7.x-1.x-dev
Although I noticed that I see this before the error:
even though I'm calling it from template.php.
Will try disabling context in case this has any effect.
Comment #6
Finn Lewis CreditAttribution: Finn Lewis commentedDisabled context ui, and it started working as expected.
I'll check if there's an issue over at the context issue queue.
Comment #7
drzraf CreditAttribution: drzraf commentedAlso got this one on D7 (with common modules, I didn't dig), simple workaround attached.
Comment #8
xtfer CreditAttribution: xtfer commentedPatch at #7 looks like its working to me, but I haven't done much testing.
Comment #9
xtfer CreditAttribution: xtfer commented#7 has been working in 6.x for 5 days of development without issue.
Comment #10
salvisCommitted to D8/D7/D6, thanks for patch and review!
Comment #11
salvisComment #13
Anonymous (not verified) CreditAttribution: Anonymous commentedFixed since September 3 last year, but stuck in the dev version at least of D7.
Comment #14
seanrJust ran into this myself. Patch works perfectly; how about a release?
Comment #15
salvisMoshe just created 7.x-1.3 a few days ago; how about updating?
Comment #16
doublejosh CreditAttribution: doublejosh commentedAwesome! Needed with views alters.
BEER. FOR. YOU.