|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #25224 gzuncompress problem
Submitted: 2003-08-24 13:00 UTC Modified: 2003-08-29 09:25 UTC
Avg. Score:3.0 ± 2.0
Reproduced:2 of 2 (100.0%)
Same Version:0 (0.0%)
Same OS:0 (0.0%)
From: r dot staribacher at hypermove dot com Assigned:
Status: No Feedback Package: Zlib related
PHP Version: 4.3.2 OS: windows 2000/xp
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If this is not your bug, you can add a comment by following this link.
If this is your bug, but you forgot your password, you can retrieve your password here.
Bug Type:
From: r dot staribacher at hypermove dot com
New email:
PHP Version: OS:


 [2003-08-24 13:00 UTC] r dot staribacher at hypermove dot com
error occured on:
OS: windows 2000 and xp
webserver: apache and iis

I am using a PHP class for reading pdf files. this class uses gzuncompress which causes problems on windows. IE displays the message "action canceled". Under Linux it "seems" to work. Parsing a large amount of pdf files also causes the process to stop.
I have seen the Bug #20535: zLib crashes when trying to gzuncompress. So I tried to solve the problem using the optional length parameter. That didn't solve the problem.

you can see or download the class on: 

I tried also xpdf (pdftotext.exe) to read PDFs using exec(), but another problem (unable to fork ...) occured! But this is not part of my bug report, but also annoying.

One question:
We can create PDFs using PHP! Why can't we read PDFs using PHP? It should be easier reading them instead of creating them?

php.ini settings:
savemode = off
magic quotes = off
no additional modules are activated (gzip is already compiled into php 4.3)

Reproduce code:
  function nextline() 
    $pos = strpos($this->_buffer, "\r");
    if ($pos === false) 
      return false;
    $line = substr($this->_buffer, 0, $pos);
    $this->_buffer = substr($this->_buffer, $pos + 1);
    if ($line == "stream") 
      $endpos = strpos($this->_buffer, "endstream");
      $stream = substr($this->_buffer, 1, $endpos - 1);
      $stream = gzuncompress($stream,1);
      $this->_buffer = $stream . substr($this->_buffer, $endpos + 9);
    return $line;

Expected result:
The code will return an integer (how many times is the search expression in the pdf document). 
The original class returns true (found search expression) othewise false I think!


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2003-08-24 14:48 UTC]
Can you provide a self-contained example without this pdf class and with concrete data? Maybe save and base64_encode the data which should be gzuncompress()ed.

Also "1" isn't a good choice for the optional length parameter to gzuncompress() if you want more than a single character. This parameter contains the maximal expected length of the uncompressed data.
 [2003-08-29 09:25 UTC]
No feedback was provided. The bug is being suspended because
we assume that you are no longer experiencing the problem.
If this is not the case and you are able to provide the
information that was requested earlier, please do so and
change the status of the bug back to "Open". Thank you.

PHP Copyright © 2001-2023 The PHP Group
All rights reserved.
Last updated: Mon Mar 27 11:03:36 2023 UTC