Debugging custom streams
| From: | Jared Williams | Date: | Fri, 10 Feb 2006 13:59:55 +0000 |
| Subject: | Debugging custom streams | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-230199@lists.php.net to get a copy of this message | ||
Hi,
Short version, is there any way of listing all open resources from within a PHP script? Think I may
have a problem relating
to the object/resource shutdown order within PHP, but cant see which custom stream handler still has
an open resource.
Long version...
I've been attempting to write a Zip archive class, which uses streams for providing the
individual files within the archive.
Gotten to the point where this code works as expected, producing a valid zip file, with 1 deflated
file named digits.txt with
1234567890 as contents.
$zip = new ZipArchive('test.zip', 'w+');
$stream = $zip->create('digits.txt');
fputs($stream, '1234567890');
fclose($stream);
$zip->close();
unset($zip);
The problem is once go beyond 1 file per zip, as in
$zip = new ZipArchive('test.zip', 'w+');
$stream = $zip->create('digits.txt');
fputs($stream, '1234567890');
fclose($stream);
$stream = $zip->create('alpha.txt');
fputs($stream, 'abcdefghijklmnopqrstuvwxyz');
fclose($stream);
$zip->close();
unset($zip);
I get an application exception on PHP shutdown, though the zip file is valid with 2 files.
Jared