RE: [PHP] Debugging custom streams
| From: | Jared Williams | Date: | Fri, 10 Feb 2006 14:38:23 +0000 |
| Subject: | RE: [PHP] Debugging custom streams | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-230202@lists.php.net to get a copy of this message | ||
> -----Original Message-----
> From: Jochem Maas [mailto:jochem@iamjochem.com]
> Sent: 10 February 2006 14:17
> To: Jared.Williams@ntlworld.com
> Cc: php-general@lists.php.net
> Subject: Re: [PHP] Debugging custom streams
>
> Jared Williams wrote:
> >
> > 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();
>
>
> I don't suppose that your closing a stream twice?
> [ once with fclose() and one inside $zip->close() ]
$zip->close() doesn't (yet) ensure that internal streams are closed. So don't think it
can be that.
> > unset($zip);
> >
> > I get an application exception on PHP shutdown, though
> the zip file is valid with 2 files.
>
> what exactly is the exception?
>
---------------------------
php.exe - Application Error
---------------------------
The instruction at "0x100ac22f" referenced memory at "0x0000004c". The memory
could not be "read".
Click on OK to terminate the program
Click on CANCEL to debug the program
---------------------------
OK Cancel
---------------------------