php.net |  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
Votes:2
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
View Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
If you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
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
Description:
------------
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: http://www.phpclasses.org/browse.html/package/702.html 

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!



Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2003-08-24 14:48 UTC] sr@php.net
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] sniper@php.net
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-2024 The PHP Group
All rights reserved.
Last updated: Sat Dec 07 08:01:28 2024 UTC