PEAR is archived and read-only

This mirror preserves historical PEAR package releases and metadata so existing references remain available.

Home » Structures » OLE » Bug #6516

wrong usage of unpack()

Details

Submitted2006-01-18 15:25 UTC
Fromymettier at libertysurf dot fr
Assignedschmidt
StatusClosed
PackageOLE
PHP Version5.1.1
OSSolaris
Roadmaps(Not assigned)

Comments

[2006-01-18 15:25 UTC] ymettier at libertysurf dot fr

Description:
------------
I'm using OLE-0.5

The script, expected result and actual results are below.

I tried to hack OLE.php and I noticed a lot of unpack() like this :
$type = unpack("c", substr($pps_wk, 66, 1));
if (($type[''] != OLE_PPS_TYPE_ROOT) ...
return $this->raiseError("PPS at $pointer has unknown type: {$type['']}

However, unpack seems to return an array where the first element is 1.

Try to replace $type[''] with $type[1] for example. It works better with that change.

Test script:
---------------
$docfile = "my_document.doc";
$ole =& new OLE();
$pps = $ole->read($docfile);
if(PEAR::isError($pps)) {
echo "<hr><pre>".$pps->getMessage()."</pre><hr>\n";
}

Expected result:
----------------
Nothing, meaning that it works

Actual result:
--------------
----------------
PPS at 1 has unknown type:
----------------

[2006-12-28 09:44 UTC] pear dot php dot net at chsc dot dk

Here is a patch that fixes this problem:
http://dev.peytz.dk/~dr/OLE.patch