Topic: xajax and __destruct
Hi folks,
I have a strange problem. After some funny tests with xajax 0.5_standard I want it to integrate in my OO project. (php 5.2.2)
I have a class like this:
class c_html_site {
function __construct() {
... doing here xajax things , everything ok
.... begin html output bla bla
}
function someHtml() {
... some html output
}
function __destruct() {
echo "</body></html>";
}
}
$a = new c_html_site();
$a -> someHtml();
Without xajax my project works like designed, the constructor begins the html site, then all other output and when php is closed, the destructor will be called and you have a normal html site.
Integrating xajax, the process hangs when I press an xajaxe'd button.
After analyzing the problem I found out, that the reason for the hang is the echo statement of the destructor.
After removing the echo, resp. move the statements into the someHtml method, everything is fine, the process is back and is changing some <divs> or what you expected.
So don't missunderstand: I have no problem with registering methods or wrong javascript output.
The problem occurs in any destruct method of my classes with print or echo statements.
Strange: Even so when the class with an destructor thats doing some output has nothing to do with xajax (no $xajax->method, no registered methods with xajax), the site hangs after starting the xajax javascript by pressing an prepared button.
I was trying to google the problem , but with no success.
To reproduce the problem, simple add an echo "test" or an print "test" to one of your destructors.
As soon as I remove output from the destructor, all is fine.
I any case the source of the site looks in both cases identically.
Maybe I'm wrong, but I thought theres no problem to make outpout in destructors.
Any help?