This is a discussion on Silent death - code stops processing but I get no errors within the PHP Language forums, part of the PHP Programming Forums category; I've had buffer problems before where a script dies silently but no error message ever reaches my screen, because ...
|
|||||||
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
|
|||
|
I've had buffer problems before where a script dies silently but no
error message ever reaches my screen, because of buffering issues. Perhaps that is happening now. The other possibility, which I want to ask this group about, is if after the closing </html> tag it is simply impossible to get more HTML sent to a browser? I've pages that are rendered by functions that are put into one of three arrays, pageEventStart, pageEventMiddle, and pageEventEnd. All the functions in pageEventStart are currently working correctly. pageEventMiddle contains just one function, called renderPage, which gets all the content for the page out of the database and sends it to the visitors web browser. That too is working. The functions in pageEventEnd don't seem to be working, and it is hard to figure out why without error messages. pageEventStart has functions like putNewCommentInDatastore. These type things need to happen before any HTML is sent to the browser, or the new comment won't show up when the page loads. pageEventMiddle is where HTML is sent to the visitors web browser. pageEventEnd mostly has functions like updateNumberOfViewsForPage, which increments the number of times a page has been viewed. I save this stuff for after the page has been sent to the browser, to reduce the number of database calls needed to get info the visitor. The idea is to speed things up. So I ask, if I have an echo statement after the closing </html> should it show up? Interestingly, when I hit the 3 arrays below with print_r() I see that all the correct values are there, including updateNumberOfViewsForPage in pageEventEnd. class McPageRender { var $controllerForAll; var $globalsObject; var $pageEventStart; var $pageEventMiddle; var $pageEventEnd; /* * 09-26-03 - * This is the most crucial object in the software. It is called into * existence in McControllerForAll, which calls its runMainLoop function. Everything else, all other functions, are * called because someone has put a string representation of the function name into one of these 3 variables: * $pageEventStart * $pageEventMiddle * $pageEventEnd */ function McPageRender() { $this->controllerForAll = new McControllerForAll(); $this->globalsObject = $this->controllerForAll->getObject("McGlobals"); $this->pageEventStart = $this->globalsObject->getPageEventStart(); $this->pageEventMiddle = $this->globalsObject->getPageEventMiddle(); $this->pageEventEnd = $this->globalsObject->getPageEventEnd(); } function runMainLoop() { // 05-13-03 - the architexture of this software is simple, put your functions in one of these 3 arrays: // // $pageEventStart - this is for functions that must execute before any HTML is sent to the browser - stuff dealing with cookies, for instance. // // $pageEventMiddle - this is for functions that should appear on screen. Often, I assume, this would be in conjunction with renderPageCancel=true. XML sitemaps, for instance. renderPage(), too, most obviously. // // $pageEventEnd - this is for functions that should execute after all the HTML is sent to the visitor. updateNumTimesArticleViewed() would be an example. // 05-07-03 - it's time to get serious about architexture, so we're going to enforce the ban on $choiceMade // 06-21--03 - nice idea but hopeless. There's too much code that's been written using choiceMade. We'd have to rewrite the whole // program if we wanted to definitely, absolutely, ban it from here. We must find another path to security. // rule that $choiceMade can never be used on this page. //if ($choiceMade) die ("The programmer has made a mistake by using the variable choiceMade on this page, where it is not allowed."); // 09-17-03 - this function is getting moved to $pageRender today - lk for ($i=0; $i < count($this->pageEventStart); $i++) { $function = $this->pageEventStart[$i]; if (!function_exists($function)) $this->controllerForAll->import($function, "n"); if (!function_exists($function)) { print "The software is looking for a function called $function. It's possible that you don't really need this function, in which case, find the file that's calling for it and remove that file. First look in the folder mcGlobalEvents, as it is likely to have unneeded files. If, however, you need the function, then you need to reinstall the software. Remember you can always find a copy at <a href=\"http://www.publicDomainSoftware.org/\">Public Domain Software</a>."; } else { $function(); } } for ($i=0; $i < count($this->pageEventMiddle); $i++) { $function = $this->pageEventMiddle[$i]; if (!function_exists($function)) $this->controllerForAll->import($function, "n"); if (!function_exists($function)) { print "The software is looking for a function called $function. It's possible that you don't really need this function, in which case, find the file that's calling for it and remove that file. First look in the folder mcGlobalEvents, as it is likely to have unneeded files. If, however, you need the function, then you need to reinstall the software. Remember you can always find a copy at <a href=\"http://www.publicDomainSoftware.org/\">Public Domain Software</a>."; } else { $function(); } } for ($i=0; $i < count($this->pageEventEnd); $i++) { $function = $this->pageEventEnd[$i]; if (!function_exists($function)) $this->controllerForAll->import($function, "n"); if (!function_exists($function)) { print "The software is looking for a function called $function. It's possible that you don't really need this function, in which case, find the file that's calling for it and remove that file. First look in the folder mcGlobalEvents, as it is likely to have unneeded files. If, however, you need the function, then you need to reinstall the software. Remember you can always find a copy at <a href=\"http://www.publicDomainSoftware.org/\">Public Domain Software</a>."; } else { $function(); } } } } |
|
|||
|
Hi lawrence!
On 24 Oct 2003 18:51:50 -0700, lkrubner@geocities.com (lawrence) wrote: >I've had buffer problems before where a script dies silently but no >error message ever reaches my screen, because of buffering issues. Yeah, I had that too. I use a debugging function which simply prints what I want and runs flush(). But you can set it somewhere to flush automatically, which is not as efficient. Have you set error_reporting (E_ALL); ???? >Perhaps that is happening now. The other possibility, which I want to >ask this group about, is if after the closing </html> tag it is simply >impossible to get more HTML sent to a browser? You can definitely send more whatever you want, but if the browser displays it is another question. Look up W3C for a definition. >... HTH, Jochen -- Jochen Daum - CANS Ltd. PHP DB Edit Toolkit -- PHP scripts for building database editing interfaces. http://sourceforge.net/projects/phpdbedittk/ |