Hi,

My module Hypergraph uses an applet that receives generated XML from Drupal (from file hg.php - you can have a look at it).

I - and some users - have noticed that the applet execution fails because the data it receives are corrupt. Finally I realized this is because Devel is adding some stats data at the end of the generated XML.

This is an example of how the end of the XML looks like:
</GraphXML><div class="dev-timer"> Page execution time was <em>16498.41</em> ms. </div><div class="dev-memory-usage"><h3>Memory usage:</h3><div class="item-list"><ul><li>Memory used at <em>devel_init()</em>: <em>30.51</em> MB</li><li>Memory used at <em>devel_shutdown()</em>: <em>30.62</em> MB</li></ul></div></div>

Now, obviously, I need to suppress this information in way other than by disabling Devel (that works).

I put exit() at the end of the XML generation - but the Devel stats are still there (yes, I did clear caches). I am not sure how otherwise can I do this. Could you kindly help?

Comments

moshe weitzman’s picture

Status: Active » Fixed

Anywhere during the page processing you can set GLOBALS['devel_shutdown'] = FALSE

vacilando’s picture

Thanks for getting back to me on this, Moshe.

Indeed, $GLOBALS['devel_shutdown'] = FALSE; has solved the problem.

I had to place it right after bootstrapping (when placed later in the code it was still wrecking the XML output).

Further; I realize my other module, and indeed any module that uses elements requesting data from Drupal may have problems, under some circumstances, if Devel is on (and user logged in / has access to Devel).

I wonder - is there anything to be changed in Devel that would prevent it from adding extra stuff into generated content? I mean, if somebody now writes another module where an applet asks for data, and the applet crashes due to the added content, they will have a hard time, like I did, determining Devel as the culprit, and then how the Devel output can be switched off. Any thoughts on that?

Thanks a lot,

Tomáš (vacilando)

moshe weitzman’s picture

I am not aware of devel adding any http headers. anyway, you can review the headers using firebug's 'net' tab. look at them with and without devel and see if you can spot any differences. also make sure the body of each page is exactly the same with and without devel.

vacilando’s picture

Sorry - I was just editing my post while you answered! Issue is solved now -- please see the new version at http://drupal.org/comment/reply/237239/786294#comment-786275

However, see for the additional question in there.

Thanks!

Tomáš (vacilando)

Anonymous’s picture

Status: Fixed » Closed (fixed)

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