Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:32230 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 16275 invoked by uid 1010); 11 Sep 2007 05:06:02 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 16260 invoked from network); 11 Sep 2007 05:06:01 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 11 Sep 2007 05:06:01 -0000 Authentication-Results: pb1.pair.com smtp.mail=greg@chiaraquartet.net; spf=permerror; sender-id=unknown Authentication-Results: pb1.pair.com header.from=greg@chiaraquartet.net; sender-id=unknown Received-SPF: error (pb1.pair.com: domain chiaraquartet.net from 38.99.98.18 cause and error) X-PHP-List-Original-Sender: greg@chiaraquartet.net X-Host-Fingerprint: 38.99.98.18 beast.bluga.net Linux 2.6 Received: from [38.99.98.18] ([38.99.98.18:46502] helo=mail.bluga.net) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id E6/BC-28088-93226E64 for ; Tue, 11 Sep 2007 01:06:01 -0400 Received: from mail.bluga.net (localhost.localdomain [127.0.0.1]) by mail.bluga.net (Postfix) with ESMTP id 952A8C0DE06; Mon, 10 Sep 2007 22:05:57 -0700 (MST) Received: from [192.168.0.106] (CPE-76-84-1-170.neb.res.rr.com [76.84.1.170]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.bluga.net (Postfix) with ESMTP id C7034C0DE05; Mon, 10 Sep 2007 22:05:56 -0700 (MST) Message-ID: <46E622F6.5000208@chiaraquartet.net> Date: Tue, 11 Sep 2007 00:09:10 -0500 User-Agent: Thunderbird 1.5.0.13 (X11/20070824) MIME-Version: 1.0 To: Andi Gutmans CC: David Coallier , PHP Developers Mailing List References: <6F509818-65A2-4B17-8C44-6970E815A169@prohost.org> <698DE66518E7CA45812BD18E807866CEA2AE39@us-ex1.zend.net> <46E5B223.5070406@chiaraquartet.net> <698DE66518E7CA45812BD18E807866CEA2AE65@us-ex1.zend.net> <698DE66518E7CA45812BD18E807866CEA2AF4D@us-ex1.zend.net> In-Reply-To: <698DE66518E7CA45812BD18E807866CEA2AF4D@us-ex1.zend.net> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Virus-Scanned: ClamAV using ClamSMTP Subject: Why not jar for phar? (was Re: [PHP-DEV] PHAR was PHP 5.3 Suggested Feature List) From: greg@chiaraquartet.net (Gregory Beaver) Andi Gutmans wrote: >> -----Original Message----- >> From: david.coallier@gmail.com [mailto:david.coallier@gmail.com] On >> Behalf Of David Coallier >> Sent: Monday, September 10, 2007 4:05 PM >> To: Andi Gutmans >> Cc: Gregory Beaver; PHP Developers Mailing List >> Subject: Re: [PHP-DEV] PHAR was PHP 5.3 Suggested Feature List >> >> Andi, if there was to be a cross platform tool to view, extract, add, >> etc with phar archives, would that influence your choice ? >> > > > Well the point is that if you're using tar, zip (jar) or some other standard file format you have thousands of tools that you can use. > The format is really mainly an implementation detail (maybe with some minor semantics) so I think it's better for PHP to embrace an existing one than coming up with its own. This is also why Java took this approach. > > I realize there is some history to this implementation but I think tweaking the file format part of the implementation isn't a large amount of work and worthwhile in the long run esp. as phar hasn't been widely adopted at this point (and probably won't be for Web apps but rather installations and administration solutions). Hi, I'd like to clear up some confusion. Actually, phar works quite well in a web environment, I suggest we stop talking about it as if it were just an installation stub. There is even a possibility that applications within a phar will be faster than their filesystem equivalent when used with (as yet unwritten changes to) APC because of the complete lack of a need to do any filesystem stats on the files. The implementation of the jar format would require changes to the Zend Engine in order to work in the way that phar works, as there is no way to use a PHP loader stub with a jar because it uses the zip file format. Even if we did go with another standard file format like tar which the original PHP_Archive class used (A hack can be used to make the first file into a PHP loader stub), for performance reasons the structure of the file would still need to be specific to PHP's needs, rendering all of those thousands of tools useless for anything but looking inside of the file to see how it was implemented. For instance, the jar file format is a zip file with a customized manifest stored as one of the files. The same would be true of a tar-based implementation, but even more customization would be needed as we would need to store the index as well, something that is built into the zip file format. I chose a different file format because it was a better choice both for performance and usability than the existing formats out there, and simply calling it "different" does not do justice to the reasons that make it better. The reason we do not do classes like java is because PHP is not java, as many are very happy to say and rightly so. Why turn around and make the same arguments for phar? Phar is not jar any more than PHP namespace is C++ namespace. It does not solve the same problems as jar in Java, nor does it intend to solve the same problems. Incidentally, pecl/phar already provides a cross-platform tool to view, extract, add, it's called "phar.phar" and is run via "php phar.phar". I don't think it is quite feature complete, but this would actually take a small amount of work to reach that point, much less than modifying PHP's core to support the jar file format. I am happy to look at other implementations of the file format if and only if it can be shown to be worth the change, but I do expect the courtesy of compelling arguments that take into account the work already completed so that I'm not wasting anyone's time including my own. Thanks, Greg