When you use functions like dpm()/ddebug_backtrace() and wrapped data/entities is involved, weird stuff happens...

It seems like krumo adds a variable to the thing it's printing to avoid recursion. However, the wrapper class doesn't allow that and outputs a exception, so it stops in the middle and looks like the attached screenshot.

That's not so helpful :)

And even more generic, it seems to be very ... strict to throw an exception when you try to assign a property that is not defined or something in your entity/data metadata definition is not correct. For example, a property is defined with a _ instead of -. If you do that, drupal explodes. Can't we simply show an error and continue? Or catch the exception at least when this happens through rules.module and show an error?

CommentFileSizeAuthor
#3 krumo.patch2.12 KBberdir
devel_entity_metadata.png116.3 KBberdir

Comments

fago’s picture

hm, I noticed that explosion of krumo too, but I never had a closer look at it. Perhaps we could just special-case the variable krumo adds and ignore it?

@being-strict: Hm, yes. The wrapper just throws as an exception, what I think is fine as you need to know something went wrong. But yes, we should catch them in Rules.

klausi’s picture

Subscribing, exploding krumo annoyed me as well.

berdir’s picture

Status: Active » Needs review
StatusFileSize
new2.12 KB

Oh well, this wasn't as easy as I hoped :)

The attached patch fixes it in a way that it doesn't blow up but of course, the wrapped classes are empty because they don't have any public properties.

As you can see, it requires quite a few special cases.

Not sure what the reason for using wrappers for native datatypes like integer and strings are but this certainly makes it more complex ;)

fago’s picture

uhm. How is the variable of krumo called, is the name fixed? If so we could just add a public property $krumo to the class and it should work just fine. Or perhaps we can set this property as soon as we know the name internally and thus avoid some of those exceptions?

fago’s picture

Status: Needs review » Fixed

thanks, I had a look at it and committed a bit simpler version. krumo really shouldn't fiddle around with foreign objects, but at least it isn't crashing any more now.

Status: Fixed » Closed (fixed)

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