1

I am using Drupal 7 on a CentOS 6.5 box. I am trying to debug some code which produces the following error:

User error: ImageMagick error 1: convert: no decode delegate for this image format /tmp/thesis-163.OBJ.xml' @ constitute.c/ReadImage/503. convert: missing an image filename jpg:/tmp/thesis-163.OBJ.PREVIEW.jpg' @ convert.c/ConvertImageCommand/2800. in _imagemagick_convert_exec() (line 519 of /var/www/html/sites/all/modules/imagemagick/imagemagick.module).

I can see that the problem is caused by the fact that ImageMagick is trying to make jpg out of a xml file. What the error is about, isn't really the issue. The issue is that, when I insert a dsm statement to check what is going and run the program again, the error goes away. If I comment out the dsm statement and run the program again the error returns. I have never seen this type of behaviour before and can't explain it.

Unfortunately, I can't reproduce this behavior with a small snippet of code otherwise I would post it here.

Can someone explain why this is happening so that I can fix it?

5
  • do you test dpm instead of dsm and the error exists? – Yuseferi May 19 '14 at 17:49
  • 1
    dsm maps to dsm, so should be: api.drupal.org/api/devel/devel.module/function/dsm/7 – sanzante May 19 '14 at 19:23
  • @tunic s reply below seems really interesting, using dd is a great tip, and another possible reason might be the session (ie dpm putting stuff into the session) ? but it would probably really help to see at least a part of the code :) – mojzis May 19 '14 at 20:52
  • Sorry not an answer but you might have some luck using the object_log module which saves krumo to the database instead of printing to the screen. You can access it in the backend under Reports > Object Log – leexonline May 20 '14 at 0:14
  • @leexonline That sounds very interesting. I will give that a try. – user5013 May 20 '14 at 23:33
1
+50

You may be experiencing a Krumo side effect:

https://drupal.org/node/1855468

The problem is that PHP handles references to array elements in a risky way, see this article: PHP: References To Array Elements Are Risky

I haven't read the post deeply, and can't assure you have this problem, but you may try the workaround to see if it works: use Krumo NG.

Another way is to use dd to dump your traces to a file, see functions documentation: https://api.drupal.org/api/devel/devel.module/function/dd/7

1
  • Thanks for the useful links. I will give Krumo NG a try and see if it solves the problem. – user5013 May 22 '14 at 15:36
0

May want to try one of these or some combination of them. Sometimes dsm gives me weird behavior and I have to resort to one of these.

print '<pre>' . print_r($your_item) . '</pre>';

print '<pre>' . dsm($your_item) . '</pre>';

drupal_set_message('<pre>' . print_r($your_item,true) . '</pre>');

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.