PEAR is archived and read-only

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

Home » File Formats » Archive_Zip » Bug #3893

require_one 'PEAR.php' not always needed?

Details

Request #3893require_one 'PEAR.php' not always needed?
Submitted2005-03-20 15:43 UTC
Fromsidney at sidney dot com
StatusSuspended
PackageArchive_Zip
PHP Version4.3.10
OSAny
Roadmaps(Not assigned)

Comments

[2005-03-20 15:43 UTC] sidney at sidney dot com

Description:
------------
I'm using Zip.php downloaded from cvs on a web host that does not have Pear installed. I had to comment out the require_once 'PEAR.php' in order to use it.

I notice that the only place Pear is needed is when there is no zlib, i.e., on line 134

if (!extension_loaded('zlib')) {
PEAR::loadExtension('zlib');
}

My ISP built PHP with zlib and without Pear.

By making the require_once only be called when !extension_loaded('zlib') this file will be useful without modification on more hosts.

Reproduce code:
---------------
On a system without Pear installed, with zlib installed, and with Zip.php copied to the current directory, try to run a file with the line:

require_once "Zip.php";

Expected result:
----------------
No error

Actual result:
--------------
An error from the require_once 'PEAR.php'; line in Zip.php when it can't find PEAR.php