connection handling

From: Date: Tue, 05 Sep 2000 04:19:38 +0000
Subject: connection handling
Groups: php.general 
Request: Send a blank email to php-general+get-15228@lists.php.net to get a copy of this message
Please help me! Either PHP3's connection handling and use of register_shutdown_function() is badly broken or I've completely misread the manual. Larry ---- Start with this script <? function sf() { global $i; $fp = fopen("/tmp/sf", "a"); fputs($fp, "$i / " . connection_status() . "\n"); fclose($fp); } register_shutdown_function("sf"); set_time_limit(10); //1 for($i=0 ; $i < 10 ; $i++) { echo "$i "; sleep(1); } //2 for($i=0 ; $i < 2000000000; $i++) { if(!($i % 1000)) echo "$i "; } ?> Pick either loop 1 or 2 and remove the //# comment. Then either let the script run to completion or abort it after 5 seconds. This table shows what goes into /tmp/sf: run to user completion abort Loop 1 10/0 10/0 Loop 2 nothing nothing My conclusions: Loop 1: It appears that regardless of the user's aborting, a) the print loop runs to completion and b) connection_status() returns 0. Loop 2: It appears that a) (once again) the user abort is ignored b) when the execution timer fires, the shutdown function is not called.

« previous php.general (#15228) next »