Re: [PHP-DOC] oop5 basic rewrite informal RFC
Daniel Convissor wrote: // Copy-on-write is not what happens when dealing only with objects: class not_copy_on_write { public $m = 'foo'; } $a = new not_copy_on_write; $b = $a; $a-m = 'bar'; echo \$a-m = $a-m, \$b-m = $b-m\n; ? Hi Dan, Copy-on-write still happens, the example you gave doesn't change a variable, only a property. ?php class copy_on_write { public $m = 'foo'; } $a = new not_copy_on_write; $b = $a; // $a and $b are the same zval, refcount is 2 $a = new not_copy_on_write; // now they are different zvals $a-m = 'bar'; ? The above example is equivalent to Sara's simple example. A better comparison would be between arrays and objects, as this demonstrates that they behave differently in PHP 5, but were the same in PHP 4 ?php $a = array('m' = 'foo'); $b = $a; $a['m'] = 'bar'; echo \$a[m] = $a[m], \$b[m] = $b[m]\n; class not_copy_on_write { public $m = 'foo'; } $a = new not_copy_on_write; $b = $a; $a-m = 'bar'; echo \$a-m = $a-m, \$b-m = $b-m\n; ? Greg
Re: [PHP-DOC] oop5 basic rewrite informal RFC
Brandon Savage wrote: On Sep 8, 2009, at 6:12 PM, Daniel Convissor wrote: Hi Brandon: Nice stuff. Two qualms with the following: PHP 5's object model also significantly changes the way objects are passed, passing a pointer to the object rather than copying the object. First, passed is the followed immediately by passing. Pick a different word for one or the other. Second, the documentation in general talks about it being by reference rather than as a pointer. Thanks, --Dan Hi Dan, I have no trouble changing the wording on your first point, as it does make the wording seem a bit odd. However, each spot where the documentation states that objects are passed by reference is wrong. See this blog post by Sara Golemon: http://blog.libssh2.org/index.php?/archives/51-Youre-being-lied-to..html Essentially, objects are like references, pointing to a particular spot in memory where the object can be found. While it's easier to describe objects as being passed by reference in PHP 5, this is in fact not the case. I'm not sure how to change the documentation to reflect this. How specific should we get in the documentation? Hi, Don't use pointer, that's also inaccurate, and will be confusing to someone from a C background. Instead, use language somewhat similar to: PHP 5's object model was designed to make it simpler and faster to pass objects as parameters to functions and methods. Rather than copying the contents of the object, PHP 5 represents objects with a handle that is used to look up the actual object contents. The technical details are not important in most situations. The most important thing to understand is that the common PHP 4 practice of using references to instantiate and pass objects should not be used in PHP 5, for both the subtle bugs the practice can introduce and for performance reasons. Greg
Re: [PHP-DOC] Proposed patch to funchand docs
Lars Torben Wilson wrote: 2009/8/20 Hannes Magnusson hannes.magnus...@gmail.com: In 2 years (when everyone knows about the warning) people will be wondering why the example shows a complicated way to throw an error.. The example is nice to show what exactly no longer works, but the wording and example show a hint of disappointment that it doesn't work in 5.3.. I don't know how to rephrase it though ;) Maybe add refsect role=errors, including a file calling func_get_args() will throw an E_WARNING, even when included from functions.. ? -Hannes Hi Hannes, Greg, and others, I've been thinking about this some more and honestly, so far the wording I first posted still is the least ambiguous and most concise. I thought about Greg's idea some more, but that simply moves the problem from one place to another. What about simply removing the example unless we get a lot of complaints that the wording doesn't sufficiently explain it? Personally I feel that a careful reading of the wording should cover the issue well, and just included the example to be extra cautious. I personally had no idea what it was talking about until I read the example, for what that's worth :). I tend to find code far more explanatory than English for things of this nature. On another note, would just a reading of the version note, without the example added, sound disappointed? :) Honestly I'm not personally disappointed about the change. I've never personally encountered that usage before and probably would have considered it a little iffy if I had. Greg
[PHP-DOC] Re: Proposed patch to funchand docs
Lars Torben Wilson wrote: Hi all, Just asking because I've been out of the loop for a while (again) but a coworker recently noticed this BC break in func_get_args() and friends. While the changes to way func_get_args() do seem necessary this should probably still be documented. I just wanted to make sure I'm not breaking any current standards too badly with this. :) I've added similar notes and examples to func-get-arg.xml and func-arg-num.xml but have left them out of this email for brevity. If I don't hear any objections I'll commit tomorrow. Or if I get an OK tonight, I'll commit tonight. :) Comments/fixes of course are welcome. Cheers, Torben Index: reference/funchand/functions/func-get-args.xml === --- reference/funchand/functions/func-get-args.xml(revision 287473) +++ reference/funchand/functions/func-get-args.xml(working copy) @@ -48,6 +48,15 @@ This function can now be used in parameter lists. /entry /row + row + entry5.3.0/entry + entry +If this function is called from the outtermost scope of a file +which has been included by calling functioninclude/function +or functionrequire/function from within a function in the +calling file, now generates a warning and returns false;. + /entry How about: As of PHP version 5.3.0, func_get_args() may no longer be called in this manner example. Output in PHP versions older than 5.3.0: output Output in PHP versions 5.3.0 and newer output
Re: [PHP-DOC] Preferred doc checkouts
KSChan wrote: No, and what is worse svn does not fail, it simply ignores any changes in svn:externals. Unless you only ever plan to change docs in a single translation, I don't recommend using the svn:externals modules. However, for those people who are exclusively documenting in 1 language, and never touch the source code they're documenting it is a great system. For everyone else, use a sparse checkout. I put in a small amount of effort last week to make phd work, and as long as you aren't adding in images, it works fine (phd needs a small change to allow it to find images in a sparse checkout, which I have not and will not investigate since I don't care about images :). Greg My experience is different. I'm using TortoiseSVN on Windows XP SP3. I recently made a change to doc-en involving both doc-base and en - see http://svn.php.net/viewvc?view=revisionrevision=286553 http://svn.php.net/viewvc?view=revisionrevision=286553 Hi, Great - so that means users of TortoiseSVN don't have this issue. The command-line subversion client is the only deficiency if you're using svn:externals. Good to know. Hi, I just made a simple test with my repository and native svn-client Subversion 1.4.4 native svn-client 1.6.3 repository layout: tmp/test1 tmp/test2 tmp/test3 under tmp/test1 , svn:externals ext-t2 http://localhost/svn/tmp/test2 ext-t3 http://localhost/svn/tmp/test3 So, when I make svn co http://localhost/svn/tmp/test1, the whole thing becomes /test1 /test1/ext-t2 /test1/ext-t3 Then I touched 3 files. /test1/t1 /test1/ext-t2/t2 /test1/ext-t3/t3 svn st gives X ext-t2 X ext-t3 ? t1 Performing status on external item at 'ext-t2' ? ext-t2/t2 Performing status on external item at 'ext-t3' ? ext-t3/t3 after svn add and I perform svn ci -m test t1 ext-t2/t2 ext-t3/t3 gives: Adding t2 Adding ext-t2/t2 Adding ext-t3/t3 Commit with no problem and sharing the same commit log. Thus I think svn:externals gives no problem at all (with native svn-client 1.6.x I think) try: svn commit -m doesn't work in the top-level directory. All internal svn:externals are ignored. If you explicitly provide them, it will work. Having done this for a few months, I can say with certainty that 10% or more of the time, one of the directories with changes will be forgotten in the commit. We are, after all, human. Greg
Re: [PHP-DOC] Preferred doc checkouts
Hannes Magnusson wrote: On Thu, Jul 30, 2009 at 11:03, KSChanmr.ksc...@gmail.com wrote: Using svn:externals magic however is the simplest approach: $ svn checkout http://svn.php.net/viewvc/phpdoc/modules/doc-all/ If using externals, can svn commit using 1 operation only as svn ci doc-all/en/some_file doc-all/fr/just_another_file ? I honestly do not know :) Please try :) No, and what is worse svn does not fail, it simply ignores any changes in svn:externals. Unless you only ever plan to change docs in a single translation, I don't recommend using the svn:externals modules. However, for those people who are exclusively documenting in 1 language, and never touch the source code they're documenting it is a great system. For everyone else, use a sparse checkout. I put in a small amount of effort last week to make phd work, and as long as you aren't adding in images, it works fine (phd needs a small change to allow it to find images in a sparse checkout, which I have not and will not investigate since I don't care about images :). Greg
Re: [PHP-DOC] Preferred doc checkouts
Richard Quadling wrote: 2009/7/30 Greg Beaver g...@chiaraquartet.net: Hannes Magnusson wrote: On Thu, Jul 30, 2009 at 11:03, KSChanmr.ksc...@gmail.com wrote: Using svn:externals magic however is the simplest approach: $ svn checkout http://svn.php.net/viewvc/phpdoc/modules/doc-all/ If using externals, can svn commit using 1 operation only as svn ci doc-all/en/some_file doc-all/fr/just_another_file ? I honestly do not know :) Please try :) No, and what is worse svn does not fail, it simply ignores any changes in svn:externals. Unless you only ever plan to change docs in a single translation, I don't recommend using the svn:externals modules. However, for those people who are exclusively documenting in 1 language, and never touch the source code they're documenting it is a great system. For everyone else, use a sparse checkout. I put in a small amount of effort last week to make phd work, and as long as you aren't adding in images, it works fine (phd needs a small change to allow it to find images in a sparse checkout, which I have not and will not investigate since I don't care about images :). Greg My experience is different. I'm using TortoiseSVN on Windows XP SP3. I recently made a change to doc-en involving both doc-base and en - see http://svn.php.net/viewvc?view=revisionrevision=286553 Hi, Great - so that means users of TortoiseSVN don't have this issue. The command-line subversion client is the only deficiency if you're using svn:externals. Good to know. Greg
Re: [PHP-DOC] Intro and quick patches
KSChan wrote: And, svn:externals does not have a prompt so everything will be checkout-ed for everyone by the externals definition. This is not necessarily true, see http://svn.pear.php.net/wsvn/PEARSVN?op=compcompare[]=%2f...@663compare[]=%2f...@837 for an example of how to make a straight checkout do a whole bunch of externals checkouts. one simply does svn co http://svn.pear.php.net/PEAR2/all Greg
[PHP-DOC] Re: namespaces docs
Stanislav Malyshev wrote: Hi! Shows that a namespace name with \ acts very differently from a namespace name without \ in imports, so I don't think it is entirely accurate to say that PHP namespaces don't support sub-namespacing. I'm afraid I don't understand what do you mean by sub-namespacing besides the trivial fact that if you add foo, \ and bar you get foo\bar. Could you please explain? I'll try :). Aside from the import example, let's look at this code: ?php namespace foo; $a = bar\buh; ? instantiates a class in the foo\bar namespace named buh. In other words, it instantiates class buh from the sub-namespace bar of namespace foo. This is the same as C++ nested namespaces (see the example at http://www.java2s.com/Tutorial/Cpp/0020__Language-Basics/Anestednamespace.htm) specifically: quote // use MyNamespace1 using namespace MyNamespace1; cout i * MyNamespace2::j; /quote which accesses: quote namespace MyNamespace1 { int i; namespace MyNamespace2 { // a nested namespace int j; } } /quote we can do something this exact thing in PHP as: ?php namespace MyNamespace1 { const i = 1; } namespace MyNamespace1\MyNamespace2 { const j = 2; } namespace MyNamespace1 { echo i * MyNamespace2\j; } ? The important line is MyNamespace2\j which resolves the same way as in the C++ example. The same principle exists in C# (from http://msdn.microsoft.com/en-us/library/z2kcy19k(VS.80).aspx): quote using System; namespace SomeNameSpace { public class MyClass { static void Main() { Nested.NestedNameSpaceClass.SayHello(); } } // a nested namespace namespace Nested { public class NestedNameSpaceClass { public static void SayHello() { Console.WriteLine(Hello); } } } } /quote which we can do in PHP as: ?php namespace SomeNameSpace { class MyClass { static function Main() { Nested\NestedNameSpaceClass::sayHello(); } } } namespace SomeNameSpace\Nested { class NestedNameSpaceClass { static function SayHello() { echo Hello; } } } ? actually, use \Long\Classname; is a parse error - did we intend to allow it? I thought it was allowed, to be compatible with use \Classname. Wouldn't hurt to do it, I think. This is trivial, and can be added after the bracketed namespace support is in 5.3 (don't forget to review the patch I sent, http://pear.php.net/~greg/bracketed.patch.txt) Thanks, Greg
[PHP-DOC] cvs: php-src(PHP_5_3) / NEWS /ext/bz2 bz2_filter.c /ext/zlib zlib_filter.c
cellog Sat Oct 11 19:14:08 2008 UTC Modified files: (Branch: PHP_5_3) /php-srcNEWS /php-src/ext/zlib zlib_filter.c /php-src/ext/bz2bz2_filter.c Log: fix Bug #46026: bz2.decompress/zlib.inflate filter tries to decompress after end of stream [DOC] add concatenation option to bz2.decompress stream filter http://cvs.php.net/viewvc.cgi/php-src/NEWS?r1=1.2027.2.547.2.965.2.342r2=1.2027.2.547.2.965.2.343diff_format=u Index: php-src/NEWS diff -u php-src/NEWS:1.2027.2.547.2.965.2.342 php-src/NEWS:1.2027.2.547.2.965.2.343 --- php-src/NEWS:1.2027.2.547.2.965.2.342 Thu Oct 9 00:51:10 2008 +++ php-src/NEWSSat Oct 11 19:14:08 2008 @@ -9,7 +9,9 @@ - Changed openssl info to show the shared library version number. (Scott) - Added ability to send user defined HTTP headers with SOAP request. - (Brain J.France, Dmitry) + (Brian J.France, Dmitry) +- Added concatenation option to bz2.decompress stream filter. + (Keisial at gmail dot com, Greg) - Fixed bug causing the algorithm parameter of mhash() to be modified. (Scott) http://cvs.php.net/viewvc.cgi/php-src/ext/zlib/zlib_filter.c?r1=1.6.2.2.2.4.2.7r2=1.6.2.2.2.4.2.8diff_format=u Index: php-src/ext/zlib/zlib_filter.c diff -u php-src/ext/zlib/zlib_filter.c:1.6.2.2.2.4.2.7 php-src/ext/zlib/zlib_filter.c:1.6.2.2.2.4.2.8 --- php-src/ext/zlib/zlib_filter.c:1.6.2.2.2.4.2.7 Tue Feb 12 23:28:05 2008 +++ php-src/ext/zlib/zlib_filter.c Sat Oct 11 19:14:08 2008 @@ -16,7 +16,7 @@ +--+ */ -/* $Id: zlib_filter.c,v 1.6.2.2.2.4.2.7 2008/02/12 23:28:05 cellog Exp $ */ +/* $Id: zlib_filter.c,v 1.6.2.2.2.4.2.8 2008/10/11 19:14:08 cellog Exp $ */ #include php.h #include php_zlib.h @@ -31,6 +31,7 @@ size_t inbuf_len; char *outbuf; size_t outbuf_len; + zend_bool finished; } php_zlib_filter_data; /* }}} */ @@ -81,6 +82,12 @@ bucket = php_stream_bucket_make_writeable(buckets_in-head TSRMLS_CC); while (bin bucket-buflen) { + + if (data-finished) { + consumed += bucket-buflen; + break; + } + desired = bucket-buflen - bin; if (desired data-inbuf_len) { desired = data-inbuf_len; @@ -89,7 +96,10 @@ data-strm.avail_in = desired; status = inflate((data-strm), flags PSFS_FLAG_FLUSH_CLOSE ? Z_FINISH : Z_SYNC_FLUSH); - if (status != Z_OK status != Z_STREAM_END) { + if (status == Z_STREAM_END) { + inflateEnd((data-strm)); + data-finished = '\1'; + } else if (status != Z_OK) { /* Something bad happened */ php_stream_bucket_delref(bucket TSRMLS_CC); return PSFS_ERR_FATAL; @@ -117,7 +127,7 @@ php_stream_bucket_delref(bucket TSRMLS_CC); } - if (flags PSFS_FLAG_FLUSH_CLOSE) { + if (!data-finished flags PSFS_FLAG_FLUSH_CLOSE) { /* Spit it out! */ status = Z_OK; while (status == Z_OK) { @@ -145,7 +155,9 @@ { if (thisfilter thisfilter-abstract) { php_zlib_filter_data *data = thisfilter-abstract; - inflateEnd((data-strm)); + if (!data-finished) { + inflateEnd((data-strm)); + } pefree(data-inbuf, data-persistent); pefree(data-outbuf, data-persistent); pefree(data, data-persistent); @@ -329,6 +341,7 @@ } /* RFC 1951 Inflate */ + data-finished = '\0'; status = inflateInit2((data-strm), windowBits); fops = php_zlib_inflate_ops; } else if (strcasecmp(filtername, zlib.deflate) == 0) { http://cvs.php.net/viewvc.cgi/php-src/ext/bz2/bz2_filter.c?r1=1.3.2.2.2.5.2.4r2=1.3.2.2.2.5.2.5diff_format=u Index: php-src/ext/bz2/bz2_filter.c diff -u php-src/ext/bz2/bz2_filter.c:1.3.2.2.2.5.2.4 php-src/ext/bz2/bz2_filter.c:1.3.2.2.2.5.2.5 --- php-src/ext/bz2/bz2_filter.c:1.3.2.2.2.5.2.4Sat Jan 12 22:03:32 2008 +++ php-src/ext/bz2/bz2_filter.cSat Oct 11 19:14:08 2008 @@ -16,7 +16,7 @@ +--+ */ -/* $Id: bz2_filter.c,v 1.3.2.2.2.5.2.4 2008/01/12 22:03:32 cellog Exp $ */ +/* $Id: bz2_filter.c,v 1.3.2.2.2.5.2.5 2008/10/11 19:14:08 cellog Exp $ */ #ifdef HAVE_CONFIG_H #include config.h @@ -27,6 +27,12 @@ /* {{{ data structure */ +enum strm_status { +PHP_BZ2_UNITIALIZED, +PHP_BZ2_RUNNING, +PHP_BZ2_FINISHED +}; + typedef struct
Re: [PHP-DOC] [DOC] Commit messages dead?
Elizabeth M Smith wrote: [snip] Many of us - 'documentors' - (if not all) are programmers and used to use CVS and other versioning system. But this takes some extra time that IMHO it shouldn't. If you want to spread the word and get lots of people to help in docs, I believe this kind of thing that Launchpad uses is a go. I'm very well aware that this takes time and not every contributor may actually help with good docs, but it could be moderated. [snip] 100% yes - the initial hurtle to getting new people writing docs is teaching them docbook and cvs. You can whine all you want about how easy it is - but it is NOT a zero learning curve and there are no good (free) docbook tools on the systems most people use on the desktop (yes, I mean Windows - and no people are not going to switch OS's for docbook tools). Writing in XML is not a natural thing. An online interface where people can edit docs would seriously boost people helping out. Why do you think there are so many user notes in the PHP manual ;) However...you will have to wade through the bad docs too. And I have no solution for dealing with the three million tools issues. Hi, I think Hannes was also talking about the fact that committers to CVS are not using [DOC] in their commit messages. I agree with Liz's appraisal of setting up docs for documenting. This could actually be solved with a minimal VMWare appliance that is pre-setup with everything we need to do the docs (not sure how hard that is to do). VMware works great on windows and the version we would need is free. An online interface would be useful, but would it really occur to the developers committing to php's cvs to use it? I'm not so sure. It takes me almost as long, sometimes twice as long to document the things that I write, this is the main problem from a coder's perspective: free time. I would almost rather have short summaries inside /* */ of how things work close to the lines that implement them, it would make it easier to debug other people's code as well as make documenting small changes easier. Big changes perhaps should be documented with either quick README.DOCUMENTING files, or some other quick-and-dirty situation in the source repo for those who are not yet comfortable in docbook, or in English (as both native and non-native speakers can attest, it's hard to translate PHP into English :). This was done with namespaces, and it made documenting easier, right? Greg
[PHP-DOC] cvs: php-src(PHP_5_3) /ext/phar phar.phar phar_internal.h phar_object.c tar.c util.c /ext/phar/tests badparameters.phpt phar_convert_again.phpt phar_setsignaturealgo2.phpt stat2.phpt stat2_
cellog Fri Jun 13 22:07:45 2008 UTC Added files: (Branch: PHP_5_3) /php-src/ext/phar/tests/tar phar_setsignaturealgo2.phpt require_hash.phpt Modified files: /php-src/ext/phar phar.phar phar_internal.h phar_object.c tar.c util.c /php-src/ext/phar/tests badparameters.phpt phar_convert_again.phpt phar_setsignaturealgo2.phpt stat2.phpt stat2_5.3.phpt zf_test.phpt /php-src/ext/phar/tests/tar bignames.phpt links.phpt links3.phpt links4.phpt links5.phpt tar_003.phpt tar_004.phpt tar_bz2.phpt tar_gzip.phpt tar_nostub.phpt /php-src/ext/phar/tests/tar/files frontcontroller.phar.tar frontcontroller10.phar.tar frontcontroller11.phar.tar frontcontroller12.phar.tar frontcontroller2.phar.tar frontcontroller3.phar.tar frontcontroller4.phar.tar frontcontroller5.phar.tar frontcontroller6.phar.tar frontcontroller7.phar.tar frontcontroller8.phar.tar frontcontroller9.phar.tar Log: [DOC] implement full signature support for tar-based archives. By default, data archives do not have a signature, but can have one set via setSignatureAlgorithm() http://cvs.php.net/viewvc.cgi/php-src/ext/phar/phar.phar?r1=1.7.2.13r2=1.7.2.14diff_format=u Index: php-src/ext/phar/phar.phar http://cvs.php.net/viewvc.cgi/php-src/ext/phar/phar_internal.h?r1=1.109.2.10r2=1.109.2.11diff_format=u Index: php-src/ext/phar/phar_internal.h diff -u php-src/ext/phar/phar_internal.h:1.109.2.10 php-src/ext/phar/phar_internal.h:1.109.2.11 --- php-src/ext/phar/phar_internal.h:1.109.2.10 Fri Jun 13 20:15:19 2008 +++ php-src/ext/phar/phar_internal.hFri Jun 13 22:07:44 2008 @@ -17,7 +17,7 @@ +--+ */ -/* $Id: phar_internal.h,v 1.109.2.10 2008/06/13 20:15:19 cellog Exp $ */ +/* $Id: phar_internal.h,v 1.109.2.11 2008/06/13 22:07:44 cellog Exp $ */ #ifdef HAVE_CONFIG_H #include config.h @@ -420,7 +420,7 @@ int phar_free_alias(phar_archive_data *phar, char *alias, int alias_len TSRMLS_DC); int phar_get_archive(phar_archive_data **archive, char *fname, int fname_len, char *alias, int alias_len, char **error TSRMLS_DC); int phar_open_parsed_phar(char *fname, int fname_len, char *alias, int alias_len, int is_data, int options, phar_archive_data** pphar, char **error TSRMLS_DC); -int phar_verify_signature(php_stream *fp, size_t end_of_phar, int sig_type, char *sig, int sig_len, char *fname, char **signature, int *signature_len, char **error TSRMLS_DC); +int phar_verify_signature(php_stream *fp, size_t end_of_phar, php_uint32 sig_type, char *sig, int sig_len, char *fname, char **signature, int *signature_len, char **error TSRMLS_DC); int phar_create_signature(phar_archive_data *phar, php_stream *fp, char **signature, int *signature_length, char **error TSRMLS_DC); /* utility functions */ http://cvs.php.net/viewvc.cgi/php-src/ext/phar/phar_object.c?r1=1.266.2.18r2=1.266.2.19diff_format=u Index: php-src/ext/phar/phar_object.c diff -u php-src/ext/phar/phar_object.c:1.266.2.18 php-src/ext/phar/phar_object.c:1.266.2.19 --- php-src/ext/phar/phar_object.c:1.266.2.18 Fri Jun 13 20:15:19 2008 +++ php-src/ext/phar/phar_object.c Fri Jun 13 22:07:44 2008 @@ -17,7 +17,7 @@ +--+ */ -/* $Id: phar_object.c,v 1.266.2.18 2008/06/13 20:15:19 cellog Exp $ */ +/* $Id: phar_object.c,v 1.266.2.19 2008/06/13 22:07:44 cellog Exp $ */ #include phar_internal.h #include func_interceptors.h @@ -2707,11 +2707,6 @@ Cannot set signature algorithm, phar is read-only); return; } - if (phar_obj-arc.archive-is_tar) { - zend_throw_exception_ex(spl_ce_BadMethodCallException, 0 TSRMLS_CC, - Cannot set signature algorithm, not possible with tar-based phar archives); - return; - } if (phar_obj-arc.archive-is_zip) { zend_throw_exception_ex(spl_ce_BadMethodCallException, 0 TSRMLS_CC, Cannot set signature algorithm, not possible with zip-based phar archives); http://cvs.php.net/viewvc.cgi/php-src/ext/phar/tar.c?r1=1.55.2.5r2=1.55.2.6diff_format=u Index: php-src/ext/phar/tar.c diff -u php-src/ext/phar/tar.c:1.55.2.5
[PHP-DOC] cvs: php-src(PHP_5_3) /ext/phar phar.c phar.phar phar_internal.h tar.c zip.c /ext/phar/tests phpinfo_001.phpt phpinfo_002.phpt phpinfo_003.phpt phpinfo_004.phpt
cellog Thu Jun 12 18:56:23 2008 UTC Modified files: (Branch: PHP_5_3) /php-src/ext/phar phar.c phar.phar phar_internal.h tar.c zip.c /php-src/ext/phar/tests phpinfo_001.phpt phpinfo_002.phpt phpinfo_003.phpt phpinfo_004.phpt Log: [DOC] add phar.cache_list, a PATH_SEPARATOR-separated list of full paths to phar archives to cache at startup. This caches the manifest, so that on first access to a phar archive, no file manifest parsing occurs. This could use further tweaking. For instance, the full copy of the manifest into the current process may be unnecessary if refcounting could be external to the manifest. This would be another significant gain. With APC, I measure a slight perf increase to 19 req/sec up from 16 req/sec, without it approaches regular PHP at 3.8 req/sec (regular is 4 req/sec). This is benching phpMyAdmin http://cvs.php.net/viewvc.cgi/php-src/ext/phar/phar.c?r1=1.370.2.11r2=1.370.2.12diff_format=u Index: php-src/ext/phar/phar.c diff -u php-src/ext/phar/phar.c:1.370.2.11 php-src/ext/phar/phar.c:1.370.2.12 --- php-src/ext/phar/phar.c:1.370.2.11 Mon Jun 9 16:07:18 2008 +++ php-src/ext/phar/phar.c Thu Jun 12 18:56:23 2008 @@ -17,7 +17,7 @@ +--+ */ -/* $Id: phar.c,v 1.370.2.11 2008/06/09 16:07:18 cellog Exp $ */ +/* $Id: phar.c,v 1.370.2.12 2008/06/12 18:56:23 cellog Exp $ */ #define PHAR_MAIN 1 #include phar_internal.h @@ -43,6 +43,7 @@ #ifndef PHAR_HAVE_OPENSSL static int phar_call_openssl_signverify(int is_sign, php_stream *fp, off_t end, char *key, int key_len, char **signature, int *signature_len TSRMLS_DC); #endif +static void destroy_phar_data(void *pDest); ZEND_DECLARE_MODULE_GLOBALS(phar) #if PHP_VERSION_ID = 50300 @@ -112,9 +113,94 @@ } /* }}}*/ +/* this global stores the global cached pre-parsed manifests */ +static HashTable cached_phars; +static HashTable cached_alias; + +static void phar_split_cache_list(TSRMLS_D) +{ + char *tmp; + char *key, *lasts, *end; + char ds[1]; + phar_archive_data *phar; + + if (!PHAR_GLOBALS-cache_list || !(PHAR_GLOBALS-cache_list[0])) { + return; + } + + ds[0] = DEFAULT_DIR_SEPARATOR; + zend_init_rsrc_list(TSRMLS_C); + tmp = estrdup(PHAR_GLOBALS-cache_list); + + /* fake request startup */ + PHAR_GLOBALS-request_init = 1; + PHAR_G(has_bz2) = zend_hash_exists(module_registry, bz2, sizeof(bz2)); + PHAR_G(has_zlib) = zend_hash_exists(module_registry, zlib, sizeof(zlib)); + zend_hash_init((PHAR_GLOBALS-phar_fname_map), sizeof(phar_archive_data*), zend_get_hash_value, destroy_phar_data, 1); + zend_hash_init((PHAR_GLOBALS-phar_alias_map), sizeof(phar_archive_data*), zend_get_hash_value, NULL, 1); + PHAR_GLOBALS-manifest_cached = 1; + PHAR_GLOBALS-persist = 1; + + for (key = php_strtok_r(tmp, ds, lasts); + key; + key = php_strtok_r(NULL, ds, lasts)) + { + end = strchr(key, DEFAULT_DIR_SEPARATOR); + if (end) { + if (SUCCESS == phar_open_from_filename(key, end - key, NULL, 0, 0, phar, NULL TSRMLS_CC)) { +finish_up: + php_stream_close(phar-fp); + phar-fp = NULL; + } else { +finish_error: + PHAR_GLOBALS-persist = 0; + PHAR_GLOBALS-manifest_cached = 0; + zend_destroy_rsrc_list(EG(regular_list) TSRMLS_CC); + efree(tmp); + zend_hash_destroy((PHAR_G(phar_fname_map))); + PHAR_GLOBALS-phar_fname_map.arBuckets = 0; + zend_hash_destroy((PHAR_G(phar_alias_map))); + PHAR_GLOBALS-phar_alias_map.arBuckets = 0; + /* free cached manifests */ + PHAR_GLOBALS-request_init = 0; + return; + } + } else { + if (SUCCESS == phar_open_from_filename(key, strlen(key), NULL, 0, 0, phar, NULL TSRMLS_CC)) { + goto finish_up; + } else { + goto finish_error; + } + } + } + PHAR_GLOBALS-persist = 0; + PHAR_GLOBALS-request_init = 0; + cached_phars = PHAR_GLOBALS-phar_fname_map; + cached_alias = PHAR_GLOBALS-phar_alias_map; + PHAR_GLOBALS-phar_fname_map.arBuckets = 0; + PHAR_GLOBALS-phar_alias_map.arBuckets = 0; + + zend_destroy_rsrc_list(EG(regular_list) TSRMLS_CC); + efree(tmp); +} +/* }}} */ + +ZEND_INI_MH(phar_ini_cache_list) /* {{{ */ +{ +
[PHP-DOC] cvs: php-src(PHP_5_3) /ext/phar config.m4 phar.c phar_internal.h phar_object.c /ext/phar/tests phar_get_supported_signatures_001.phpt phar_get_supported_signatures_002.phpt phar_setsignatur
cellog Sun Jun 1 04:21:27 2008 UTC Added files: (Branch: PHP_5_3) /php-src/ext/phar/tests/files openssl.phar openssl.phar.pubkey private.pem Modified files: /php-src/ext/phar config.m4 phar.c phar_internal.h phar_object.c /php-src/ext/phar/tests phar_get_supported_signatures_001.phpt phar_get_supported_signatures_002.phpt phar_setsignaturealgo2.phpt test_signaturealgos.phpt Log: add openssl signing support. This adds an extra parameter for the contents of the exported private key to Phar-setSignatureAlgorithm, and expects the public key to be in a file named blah.phar.pubkey in the same directory as the phar blah.phar. This works with openssl static or shared and fails gracefully if openssl is not present without adding a dependency. config.w32 needs updating to match config.m4 [DOC] http://cvs.php.net/viewvc.cgi/php-src/ext/phar/config.m4?r1=1.27.2.3r2=1.27.2.4diff_format=u Index: php-src/ext/phar/config.m4 diff -u php-src/ext/phar/config.m4:1.27.2.3 php-src/ext/phar/config.m4:1.27.2.4 --- php-src/ext/phar/config.m4:1.27.2.3 Sat May 17 20:07:22 2008 +++ php-src/ext/phar/config.m4 Sun Jun 1 04:21:26 2008 @@ -1,4 +1,4 @@ -dnl $Id: config.m4,v 1.27.2.3 2008/05/17 20:07:22 cellog Exp $ +dnl $Id: config.m4,v 1.27.2.4 2008/06/01 04:21:26 cellog Exp $ dnl config.m4 for extension phar PHP_ARG_ENABLE(phar, for phar archive support, @@ -8,6 +8,17 @@ PHP_NEW_EXTENSION(phar, util.c tar.c zip.c stream.c func_interceptors.c dirstream.c phar.c phar_object.c phar_path_check.c, $ext_shared) PHP_ADD_BUILD_DIR($ext_builddir/lib, 1) PHP_SUBST(PHAR_SHARED_LIBADD) + AC_MSG_CHECKING([for phar openssl support]) + if test $PHP_OPENSSL_SHARED = yes; then +AC_MSG_RESULT([no (shared openssl)]) + else +if test $PHP_OPENSSL = yes; then + AC_MSG_RESULT([yes]) + AC_DEFINE(PHAR_HAVE_OPENSSL,1,[ ]) +else + AC_MSG_RESULT([no]) +fi + fi PHP_ADD_EXTENSION_DEP(phar, spl, true) PHP_ADD_MAKEFILE_FRAGMENT fi http://cvs.php.net/viewvc.cgi/php-src/ext/phar/phar.c?r1=1.370.2.9r2=1.370.2.10diff_format=u Index: php-src/ext/phar/phar.c diff -u php-src/ext/phar/phar.c:1.370.2.9 php-src/ext/phar/phar.c:1.370.2.10 --- php-src/ext/phar/phar.c:1.370.2.9 Fri May 30 22:49:33 2008 +++ php-src/ext/phar/phar.c Sun Jun 1 04:21:26 2008 @@ -17,13 +17,31 @@ +--+ */ -/* $Id: phar.c,v 1.370.2.9 2008/05/30 22:49:33 cellog Exp $ */ +/* $Id: phar.c,v 1.370.2.10 2008/06/01 04:21:26 cellog Exp $ */ #define PHAR_MAIN 1 #include phar_internal.h #include SAPI.h #include func_interceptors.h +#ifdef PHAR_HAVE_OPENSSL + +/* OpenSSL includes */ +#include openssl/evp.h +#include openssl/x509.h +#include openssl/x509v3.h +#include openssl/crypto.h +#include openssl/pem.h +#include openssl/err.h +#include openssl/conf.h +#include openssl/rand.h +#include openssl/ssl.h +#include openssl/pkcs12.h + +#endif + +static int phar_call_openssl_signverify(int is_sign, php_stream *fp, off_t end, char *key, int key_len, char **signature, int *signature_len TSRMLS_DC); + ZEND_DECLARE_MODULE_GLOBALS(phar) #if PHP_VERSION_ID = 50300 char *(*phar_save_resolve_path)(const char *filename, int filename_len TSRMLS_DC); @@ -113,6 +131,7 @@ } if (phar-signature) { efree(phar-signature); + phar-signature = NULL; } if (phar-manifest.arBuckets) { zend_hash_destroy(phar-manifest); @@ -592,6 +611,7 @@ int read_size, len; char sig_buf[8], *sig_ptr = sig_buf; off_t read_len; + size_t end_of_phar; if (-1 == php_stream_seek(fp, -8, SEEK_END) || (read_len = php_stream_tell(fp)) 20 @@ -606,6 +626,149 @@ } PHAR_GET_32(sig_ptr, sig_flags); switch(sig_flags) { + case PHAR_SIG_OPENSSL: { +#ifdef PHAR_HAVE_OPENSSL + BIO *in; + EVP_PKEY *key; + EVP_MD *mdtype = (EVP_MD *) EVP_sha1(); + EVP_MD_CTX md_ctx; +#endif + php_uint32 signature_len, pubkey_len; + char *sig, *pubkey = NULL, *pfile; + off_t whence; + php_stream *pfp; + int tempsig; + + if (!zend_hash_exists(module_registry, openssl, sizeof(openssl))) { + efree(savebuf); + php_stream_close(fp); + if (error) { + spprintf(error, 0, phar \%s\ openssl signature cannot be verified, openssl not loaded, fname); +
[PHP-DOC] cvs: pecl /phar dirstream.c phar.c phar_internal.h phar_object.c stream.c /phar/tests 027.phpt dir.phpt extracted_001.phpt fopen_edgecases.phpt loadphar_plainmap.phpt mapphar_plainmap.phpt
cellog Wed May 7 05:38:30 2008 UTC Removed files: /pecl/phar/testsextracted_001.phpt loadphar_plainmap.phpt mapphar_plainmap.phpt webphar_plainmap.phpt Modified files: /pecl/phar dirstream.c phar.c phar_internal.h phar_object.c stream.c /pecl/phar/tests027.phpt dir.phpt fopen_edgecases.phpt opendir.phpt phar_buildfromiterator10.phpt phar_isvalidpharfilename.phpt phpinfo_001.phpt phpinfo_002.phpt phpinfo_003.phpt phpinfo_004.phpt Log: [DOC] remove phar.extract_list remove Phar::getExtractList() http://cvs.php.net/viewvc.cgi/pecl/phar/dirstream.c?r1=1.25r2=1.26diff_format=u Index: pecl/phar/dirstream.c diff -u pecl/phar/dirstream.c:1.25 pecl/phar/dirstream.c:1.26 --- pecl/phar/dirstream.c:1.25 Mon Apr 21 16:29:08 2008 +++ pecl/phar/dirstream.c Wed May 7 05:38:29 2008 @@ -289,7 +289,7 @@ { php_url *resource = NULL; php_stream *ret; - char *internal_file, *key, *error, *plain_map; + char *internal_file, *key, *error; uint keylen; ulong unused; phar_archive_data *phar; @@ -321,16 +321,6 @@ host_len = strlen(resource-host); phar_request_initialize(TSRMLS_C); - if (zend_hash_find((PHAR_GLOBALS-phar_plain_map), resource-host, host_len+1, (void **)plain_map) == SUCCESS) { - spprintf(internal_file, 0, %s%s, plain_map, resource-path); - ret = php_stream_opendir(internal_file, options, context); - if (!ret) { - php_stream_wrapper_log_error(wrapper, options TSRMLS_CC, phar error: file \%s\ extracted from \%s\ could not be opened, internal_file, resource-host); - } - php_url_free(resource); - efree(internal_file); - return ret; - } internal_file = resource-path + 1; /* strip leading / */ if (FAILURE == phar_get_archive(phar, resource-host, host_len, NULL, 0, error TSRMLS_CC)) { @@ -405,7 +395,6 @@ phar_archive_data *phar = NULL; char *error, *arch, *entry2; int arch_len, entry_len; - char *plain_map; php_url *resource = NULL; uint host_len; @@ -443,11 +432,6 @@ host_len = strlen(resource-host); phar_request_initialize(TSRMLS_C); - if (zend_hash_find((PHAR_GLOBALS-phar_plain_map), resource-host, host_len+1, (void **)plain_map) == SUCCESS) { - php_stream_wrapper_log_error(wrapper, options TSRMLS_CC, phar error: directory \%s\ cannot be created in phar \%s\, phar is extracted in plain map, resource-path+1, resource-host); - php_url_free(resource); - return FAILURE; - } if (FAILURE == phar_get_archive(phar, resource-host, host_len, NULL, 0, error TSRMLS_CC)) { php_stream_wrapper_log_error(wrapper, options TSRMLS_CC, phar error: cannot create directory \%s\ in phar \%s\, error retrieving phar information: %s, resource-path+1, resource-host, error); @@ -530,7 +514,6 @@ phar_archive_data *phar = NULL; char *error, *arch, *entry2; int arch_len, entry_len; - char *plain_map; php_url *resource = NULL; uint host_len; @@ -568,11 +551,6 @@ host_len = strlen(resource-host); phar_request_initialize(TSRMLS_C); - if (zend_hash_find((PHAR_GLOBALS-phar_plain_map), resource-host, host_len+1, (void **)plain_map) == SUCCESS) { - php_stream_wrapper_log_error(wrapper, options TSRMLS_CC, phar error: directory \%s\ cannot be removed in phar \%s\, phar is extracted in plain map, resource-path+1, resource-host); - php_url_free(resource); - return FAILURE; - } if (FAILURE == phar_get_archive(phar, resource-host, host_len, NULL, 0, error TSRMLS_CC)) { php_stream_wrapper_log_error(wrapper, options TSRMLS_CC, phar error: cannot remove directory \%s\ in phar \%s\, error retrieving phar information: %s, resource-path+1, resource-host, error); http://cvs.php.net/viewvc.cgi/pecl/phar/phar.c?r1=1.362r2=1.363diff_format=u Index: pecl/phar/phar.c diff -u pecl/phar/phar.c:1.362 pecl/phar/phar.c:1.363 --- pecl/phar/phar.c:1.362 Wed May 7 05:13:40 2008 +++ pecl/phar/phar.cWed May 7 05:38:29 2008 @@ -17,7 +17,7 @@ +--+ */ -/* $Id: phar.c,v 1.362 2008/05/07 05:13:40 cellog Exp $ */ +/* $Id: phar.c,v 1.363 2008/05/07 05:38:29 cellog Exp $ */ #define PHAR_MAIN 1 #include phar_internal.h @@ -94,103 +94,9 @@ } /* }}}*/ -static void phar_split_extract_list(TSRMLS_D) -{ - char *tmp = estrdup(PHAR_GLOBALS-extract_list); - char *key; - char *lasts; - char *q; - int keylen; - - zend_hash_clean((PHAR_GLOBALS-phar_plain_map));
[PHP-DOC] cvs: pecl /phar phar_object.c /phar/tests dir.phpt phar_bz2.phpt phar_convert_repeated.phpt phar_convert_repeated_b.phpt phar_convert_tar.phpt phar_convert_tar2.phpt phar_convert_tar3.phpt
cellog Fri May 2 05:05:55 2008 UTC Modified files: /pecl/phar phar_object.c /pecl/phar/testsdir.phpt phar_bz2.phpt phar_convert_repeated.phpt phar_convert_repeated_b.phpt phar_convert_tar.phpt phar_convert_tar2.phpt phar_convert_tar3.phpt phar_convert_zip.phpt phar_gzip.phpt /pecl/phar/tests/tarcreate_new_and_modify.phpt dir.phpt phar_begin_setstub_commit.phpt phar_buildfromiterator4.phpt phar_buildfromiterator8.phpt phar_commitwrite.phpt phar_convert_phar.phpt phar_convert_phar2.phpt phar_convert_phar3.phpt phar_copy.phpt phar_magic.phpt tar_bz2.phpt tar_gzip.phpt tar_makebz2.phpt tar_makegz.phpt /pecl/phar/tests/zipcreate_new_and_modify.phpt dir.phpt phar_begin_setstub_commit.phpt phar_buildfromiterator4.phpt phar_buildfromiterator8.phpt phar_commitwrite.phpt phar_convert_phar.phpt phar_copy.phpt phar_magic.phpt Log: refactor isTar/isZip/isPhar into isFileFormat(int format) where format is one of Phar::TAR,, Phar::ZIP, Phar::PHAR [DOC] http://cvs.php.net/viewvc.cgi/pecl/phar/phar_object.c?r1=1.253r2=1.254diff_format=u Index: pecl/phar/phar_object.c diff -u pecl/phar/phar_object.c:1.253 pecl/phar/phar_object.c:1.254 --- pecl/phar/phar_object.c:1.253 Fri May 2 04:44:38 2008 +++ pecl/phar/phar_object.c Fri May 2 05:05:54 2008 @@ -17,7 +17,7 @@ +--+ */ -/* $Id: phar_object.c,v 1.253 2008/05/02 04:44:38 cellog Exp $ */ +/* $Id: phar_object.c,v 1.254 2008/05/02 05:05:54 cellog Exp $ */ #include phar_internal.h #include func_interceptors.h @@ -1682,36 +1682,28 @@ } /* }}} */ -/* {{{ proto bool Phar::isTar() - * Returns true if the phar archive is based on the tar file format +/* {{{ proto bool Phar::isFileFormat(int format) + * Returns true if the phar archive is based on the tar/zip/phar file format depending + * on whether Phar::TAR, Phar::ZIP or Phar::PHAR was passed in */ -PHP_METHOD(Phar, isTar) +PHP_METHOD(Phar, isFileFormat) { + long type; PHAR_ARCHIVE_OBJECT(); - - RETURN_BOOL(phar_obj-arc.archive-is_tar); -} -/* }}} */ - -/* {{{ proto bool Phar::isZip() - * Returns true if the phar archive is based on the Zip file format - */ -PHP_METHOD(Phar, isZip) -{ - PHAR_ARCHIVE_OBJECT(); - - RETURN_BOOL(phar_obj-arc.archive-is_zip); -} -/* }}} */ -/* {{{ proto bool Phar::isPhar() - * Returns true if the phar archive is based on the phar file format - */ -PHP_METHOD(Phar, isPhar) -{ - PHAR_ARCHIVE_OBJECT(); - - RETURN_BOOL(!phar_obj-arc.archive-is_tar !phar_obj-arc.archive-is_zip); + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, l, type) == FAILURE) { + RETURN_FALSE; + } + switch (type) { + case PHAR_FORMAT_TAR: + RETURN_BOOL(phar_obj-arc.archive-is_tar); + case PHAR_FORMAT_ZIP: + RETURN_BOOL(phar_obj-arc.archive-is_zip); + case PHAR_FORMAT_PHAR: + RETURN_BOOL(!phar_obj-arc.archive-is_tar !phar_obj-arc.archive-is_zip); + default: + zend_throw_exception_ex(phar_ce_PharException, 0 TSRMLS_CC, Unknown file format specified); + } } /* }}} */ @@ -4414,6 +4406,11 @@ ZEND_ARG_INFO(0, contents) ZEND_END_ARG_INFO(); +static +ZEND_BEGIN_ARG_INFO_EX(arginfo_phar_isff, 0, 0, 1) + ZEND_ARG_INFO(0, fileformat) +ZEND_END_ARG_INFO(); + #endif /* HAVE_SPL */ zend_function_entry php_archive_methods[] = { @@ -4447,10 +,8 @@ PHP_ME(Phar, hasMetadata, NULL, ZEND_ACC_PUBLIC) PHP_ME(Phar, isBuffering, NULL, ZEND_ACC_PUBLIC) PHP_ME(Phar, isCompressed, NULL, ZEND_ACC_PUBLIC) + PHP_ME(Phar, isFileFormat, arginfo_phar_isff, ZEND_ACC_PUBLIC) PHP_ME(Phar, isWritable,NULL, ZEND_ACC_PUBLIC) - PHP_ME(Phar, isPhar,NULL, ZEND_ACC_PUBLIC) - PHP_ME(Phar, isTar, NULL, ZEND_ACC_PUBLIC) - PHP_ME(Phar, isZip, NULL, ZEND_ACC_PUBLIC) PHP_ME(Phar, offsetExists, arginfo_phar_offsetExists, ZEND_ACC_PUBLIC) PHP_ME(Phar, offsetGet, arginfo_phar_offsetExists,
[PHP-DOC] cvs: pecl /phar phar_object.c /phar/tests phar_extract.phpt
cellog Sat Apr 26 05:30:59 2008 UTC Added files: /pecl/phar/testsphar_extract.phpt Modified files: /pecl/phar phar_object.c Log: add Phar::extractTo(dest_directory[, mixed files[, bool overwrite]]) this is very similar to ext/zip's extractTo and is based on that code, with the addition of the third parameter, which is used to allow overwriting existing files (disallowed by default, unlike ext/zip's implementation) [DOC] http://cvs.php.net/viewvc.cgi/pecl/phar/phar_object.c?r1=1.240r2=1.241diff_format=u Index: pecl/phar/phar_object.c diff -u pecl/phar/phar_object.c:1.240 pecl/phar/phar_object.c:1.241 --- pecl/phar/phar_object.c:1.240 Sat Apr 26 02:04:08 2008 +++ pecl/phar/phar_object.c Sat Apr 26 05:30:59 2008 @@ -17,7 +17,7 @@ +--+ */ -/* $Id: phar_object.c,v 1.240 2008/04/26 02:04:08 sfox Exp $ */ +/* $Id: phar_object.c,v 1.241 2008/04/26 05:30:59 cellog Exp $ */ #include phar_internal.h #include func_interceptors.h @@ -274,6 +274,7 @@ PHAR_G(cwd_len) = 0; if (zend_hash_add(EG(included_files), file_handle.opened_path, strlen(file_handle.opened_path)+1, (void *)dummy, sizeof(int), NULL)==SUCCESS) { if ((cwd = strrchr(entry, '/'))) { + PHAR_G(cwd_init) = 1; if (entry == cwd) { /* root directory */ PHAR_G(cwd_len) = 0; @@ -319,6 +320,7 @@ PHAR_G(cwd) = NULL; PHAR_G(cwd_len) = 0; } + PHAR_G(cwd_init) = 0; efree(name); zend_bailout(); } @@ -494,10 +496,12 @@ } carry_on: if (SUCCESS != phar_mount_entry(*pphar, actual, actual_len, path, path_len TSRMLS_CC)) { + zend_throw_exception_ex(phar_ce_PharException, 0 TSRMLS_CC, Mounting of %s to %s within phar %s failed, path, actual, arch); if (path path == entry) { efree(entry); } - zend_throw_exception_ex(phar_ce_PharException, 0 TSRMLS_CC, Mounting of %s to %s within phar %s failed, path, actual, arch); + efree(arch); + return; } if (path path == entry) { efree(entry); @@ -3453,6 +3457,238 @@ } } /* }}} */ +#if (PHP_MAJOR_VERSION 6) +#define OPENBASEDIR_CHECKPATH(filename) \ + (PG(safe_mode) (!php_checkuid(filename, NULL, CHECKUID_CHECK_FILE_AND_DIR))) || php_check_open_basedir(filename TSRMLS_CC) +#else +#define OPENBASEDIR_CHECKPATH(filename) \ + php_check_open_basedir(filename TSRMLS_CC) +#endif + +static int phar_extract_file(zend_bool overwrite, phar_entry_info *entry, char *dest, int dest_len, char **error TSRMLS_DC) +{ + php_stream_statbuf ssb; + int len; + php_stream *fp; + char *fullpath, *slash; + + len = spprintf(fullpath, 0, %s/%s, dest, entry-filename); + if (len = MAXPATHLEN) { + char *tmp; + /* truncate for error message */ + fullpath[50] = '\0'; + if (entry-filename_len 50) { + tmp = estrndup(entry-filename, 50); + spprintf(error, 4096, Cannot extract \%s...\ to \%s...\, extracted filename is too long for filesystem, tmp, fullpath); + efree(tmp); + } else { + spprintf(error, 4096, Cannot extract \%s\ to \%s...\, extracted filename is too long for filesystem, entry-filename, fullpath); + } + efree(fullpath); + return FAILURE; + } + if (!len) { + spprintf(error, 4096, Cannot extract \%s\, internal error, entry-filename); + efree(fullpath); + return FAILURE; + } + + if (OPENBASEDIR_CHECKPATH(fullpath)) { + spprintf(error, 4096, Cannot extract \%s\ to \%s\, openbasedir/safe mode restrictions in effect, entry-filename, fullpath); + efree(fullpath); + return FAILURE; + } + + /* let see if the path already exists */ + if (!overwrite SUCCESS == php_stream_stat_path(fullpath, ssb)) { + spprintf(error, 4096, Cannot extract \%s\ to \%s\, path already exists, entry-filename, fullpath); + efree(fullpath); + return FAILURE; + } + /* perform dirname */ + slash = strrchr(entry-filename, '/'); + if (slash) { +
[PHP-DOC] cvs: pecl /phar dirstream.c func_interceptors.c phar.c phar_internal.h phar_object.c stream.c util.c /phar/tests 027.phpt dir.phpt fopen.phpt fopen_edgecases.phpt mkdir.phpt opendir.phpt
cellog Fri Apr 18 04:13:12 2008 UTC Modified files: /pecl/phar dirstream.c func_interceptors.c phar.c phar_internal.h phar_object.c stream.c util.c /pecl/phar/tests027.phpt dir.phpt fopen.phpt fopen_edgecases.phpt mkdir.phpt opendir.phpt Log: COMPLETELY rework filename extension detection. Now the only requirements are: 1 - executable phars must contain '.phar' in the filename 2 - non-executable phars must not contain '.phar' and must have an extension of at least 1 character In addition, phar filenames must exist if opened for read, and the directory containing the phar must exist if opened for creation if opened for creation, the file must not already exist [DOC] http://cvs.php.net/viewvc.cgi/pecl/phar/dirstream.c?r1=1.22r2=1.23diff_format=u Index: pecl/phar/dirstream.c diff -u pecl/phar/dirstream.c:1.22 pecl/phar/dirstream.c:1.23 --- pecl/phar/dirstream.c:1.22 Mon Apr 14 16:26:00 2008 +++ pecl/phar/dirstream.c Fri Apr 18 04:13:12 2008 @@ -411,7 +411,7 @@ uint host_len; /* pre-readonly check, we need to know if this is a data phar */ - if (FAILURE == phar_split_fname(url_from, strlen(url_from), arch, arch_len, entry2, entry_len TSRMLS_CC)) { + if (FAILURE == phar_split_fname(url_from, strlen(url_from), arch, arch_len, entry2, entry_len, 2, 2 TSRMLS_CC)) { php_stream_wrapper_log_error(wrapper, options TSRMLS_CC, phar error: cannot create directory \%s\, no phar archive specified, url_from); return FAILURE; } @@ -536,8 +536,8 @@ uint host_len; /* pre-readonly check, we need to know if this is a data phar */ - if (FAILURE == phar_split_fname(url, strlen(url), arch, arch_len, entry2, entry_len TSRMLS_CC)) { - php_stream_wrapper_log_error(wrapper, options TSRMLS_CC, phar error: cannot remove directory \%s\, no phar archive specified, url); + if (FAILURE == phar_split_fname(url, strlen(url), arch, arch_len, entry2, entry_len, 2, 2 TSRMLS_CC)) { + php_stream_wrapper_log_error(wrapper, options TSRMLS_CC, phar error: cannot remove directory \%s\, no phar archive specified, or phar archive does not exist, url); return FAILURE; } if (FAILURE == phar_get_archive(phar, arch, arch_len, NULL, 0, NULL TSRMLS_CC)) { http://cvs.php.net/viewvc.cgi/pecl/phar/func_interceptors.c?r1=1.15r2=1.16diff_format=u Index: pecl/phar/func_interceptors.c diff -u pecl/phar/func_interceptors.c:1.15 pecl/phar/func_interceptors.c:1.16 --- pecl/phar/func_interceptors.c:1.15 Tue Apr 15 03:36:56 2008 +++ pecl/phar/func_interceptors.c Fri Apr 18 04:13:12 2008 @@ -16,7 +16,7 @@ +--+ */ -/* $Id: func_interceptors.c,v 1.15 2008/04/15 03:36:56 cellog Exp $ */ +/* $Id: func_interceptors.c,v 1.16 2008/04/18 04:13:12 cellog Exp $ */ #include phar_internal.h @@ -45,7 +45,7 @@ goto skip_phar; } fname_len = strlen(fname); - if (SUCCESS == phar_split_fname(fname, fname_len, arch, arch_len, entry, entry_len TSRMLS_CC)) { + if (SUCCESS == phar_split_fname(fname, fname_len, arch, arch_len, entry, entry_len, 2, 0 TSRMLS_CC)) { php_stream_context *context = NULL; php_stream *stream; char *name; @@ -109,7 +109,7 @@ goto skip_phar; } fname_len = strlen(fname); - if (SUCCESS == phar_split_fname(fname, fname_len, arch, arch_len, entry, entry_len TSRMLS_CC)) { + if (SUCCESS == phar_split_fname(fname, fname_len, arch, arch_len, entry, entry_len, 2, 0 TSRMLS_CC)) { char *name, *old; phar_archive_data **pphar; @@ -223,7 +223,7 @@ goto skip_phar; } fname_len = strlen(fname); - if (FAILURE == phar_split_fname(fname, fname_len, arch, arch_len, entry, entry_len TSRMLS_CC)) { + if (FAILURE == phar_split_fname(fname, fname_len, arch, arch_len, entry, entry_len, 2, 0 TSRMLS_CC)) { goto skip_phar; } @@ -303,7 +303,7 @@ goto skip_phar; } fname_len = strlen(fname); - if (FAILURE == phar_split_fname(fname, fname_len, arch, arch_len, entry, entry_len TSRMLS_CC)) { + if (FAILURE == phar_split_fname(fname, fname_len, arch, arch_len, entry, entry_len, 2, 0 TSRMLS_CC)) { goto skip_phar; } @@ -573,7 +573,7 @@ goto skip_phar; } fname_len = strlen(fname); - if (SUCCESS == phar_split_fname(fname, fname_len, arch,
[PHP-DOC] cvs: pecl /phar func_interceptors.c phar_internal.h /phar/tests readfile.phpt
cellog Tue Apr 15 03:36:56 2008 UTC Added files: /pecl/phar/testsreadfile.phpt Modified files: /pecl/phar func_interceptors.c phar_internal.h Log: add interception for readfile [DOC] http://cvs.php.net/viewvc.cgi/pecl/phar/func_interceptors.c?r1=1.14r2=1.15diff_format=u Index: pecl/phar/func_interceptors.c diff -u pecl/phar/func_interceptors.c:1.14 pecl/phar/func_interceptors.c:1.15 --- pecl/phar/func_interceptors.c:1.14 Mon Apr 14 17:31:00 2008 +++ pecl/phar/func_interceptors.c Tue Apr 15 03:36:56 2008 @@ -16,7 +16,7 @@ +--+ */ -/* $Id: func_interceptors.c,v 1.14 2008/04/14 17:31:00 cellog Exp $ */ +/* $Id: func_interceptors.c,v 1.15 2008/04/15 03:36:56 cellog Exp $ */ #include phar_internal.h @@ -199,6 +199,83 @@ } /* }}} */ +PHAR_FUNC(phar_readfile) /* {{{ */ +{ + char *filename; + int filename_len; + int size = 0; + zend_bool use_include_path = 0; + zval *zcontext = NULL; + php_stream *stream; + + if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS() TSRMLS_CC, s|br!, filename, filename_len, use_include_path, zcontext) == FAILURE) { + goto skip_phar; + } + if (use_include_path || (!IS_ABSOLUTE_PATH(filename, filename_len) !strstr(filename, ://))) { + char *arch, *entry, *fname; + int arch_len, entry_len, fname_len; + php_stream_context *context = NULL; + char *name; + phar_archive_data **pphar; + fname = zend_get_executed_filename(TSRMLS_C); + + if (strncasecmp(fname, phar://, 7)) { + goto skip_phar; + } + fname_len = strlen(fname); + if (FAILURE == phar_split_fname(fname, fname_len, arch, arch_len, entry, entry_len TSRMLS_CC)) { + goto skip_phar; + } + + efree(entry); + entry = filename; + /* fopen within phar, if :// is not in the url, then prepend phar://archive/ */ + entry_len = filename_len; + /* retrieving a file defaults to within the current directory, so use this if possible */ + if (FAILURE == (zend_hash_find((PHAR_GLOBALS-phar_fname_map), arch, arch_len, (void **) pphar))) { + efree(arch); + goto skip_phar; + } + if (use_include_path) { + if (!(entry = phar_find_in_include_path(entry, entry_len, NULL TSRMLS_CC))) { + /* this file is not in the phar, use the original path */ + efree(arch); + goto skip_phar; + } else { + name = entry; + } + } else { + entry = phar_fix_filepath(estrndup(entry, entry_len), entry_len, 1 TSRMLS_CC); + if (!zend_hash_exists(((*pphar)-manifest), entry + 1, entry_len - 1)) { + /* this file is not in the phar, use the original path */ + efree(entry); + efree(arch); + goto skip_phar; + } + /* auto-convert to phar:// */ + spprintf(name, 4096, phar://%s%s, arch, entry); + efree(entry); + } + + efree(arch); + context = php_stream_context_from_zval(zcontext, 0); + stream = php_stream_open_wrapper_ex(name, rb, 0 | REPORT_ERRORS, NULL, context); + efree(name); + if (stream == NULL) { + RETURN_FALSE; + } + size = php_stream_passthru(stream); + php_stream_close(stream); + RETURN_LONG(size); + } + +skip_phar: + PHAR_G(orig_readfile)(INTERNAL_FUNCTION_PARAM_PASSTHRU); + return; + +} +/* }}} */ + PHAR_FUNC(phar_fopen) /* {{{ */ { char *filename, *mode; @@ -878,6 +955,7 @@ PHAR_INTERCEPT(is_executable); PHAR_INTERCEPT(lstat); PHAR_INTERCEPT(stat); + PHAR_INTERCEPT(readfile); } /* }}} */ @@ -912,6 +990,7 @@ PHAR_RELEASE(is_executable); PHAR_RELEASE(lstat); PHAR_RELEASE(stat); + PHAR_RELEASE(readfile); } /* }}} */ http://cvs.php.net/viewvc.cgi/pecl/phar/phar_internal.h?r1=1.100r2=1.101diff_format=u Index: pecl/phar/phar_internal.h diff -u pecl/phar/phar_internal.h:1.100 pecl/phar/phar_internal.h:1.101 --- pecl/phar/phar_internal.h:1.100 Mon Apr 14 04:47:33 2008 +++ pecl/phar/phar_internal.h Tue Apr 15 03:36:56 2008 @@ -17,7 +17,7 @@
[PHP-DOC] cvs: pecl /phar phar_object.c /phar/tests phar_oo_compressed_001.phpt phar_oo_compressed_001b.phpt
cellog Fri Apr 11 12:56:53 2008 UTC Modified files: /pecl/phar phar_object.c /pecl/phar/testsphar_oo_compressed_001.phpt phar_oo_compressed_001b.phpt Log: change PharFileInfo-setUncompressed to decompress [DOC] http://cvs.php.net/viewvc.cgi/pecl/phar/phar_object.c?r1=1.200r2=1.201diff_format=u Index: pecl/phar/phar_object.c diff -u pecl/phar/phar_object.c:1.200 pecl/phar/phar_object.c:1.201 --- pecl/phar/phar_object.c:1.200 Fri Apr 11 04:20:14 2008 +++ pecl/phar/phar_object.c Fri Apr 11 12:56:52 2008 @@ -17,7 +17,7 @@ +--+ */ -/* $Id: phar_object.c,v 1.200 2008/04/11 04:20:14 cellog Exp $ */ +/* $Id: phar_object.c,v 1.201 2008/04/11 12:56:52 cellog Exp $ */ #include phar_internal.h #include func_interceptors.h @@ -3659,10 +3659,10 @@ } /* }}} */ -/* {{{ proto int PharFileInfo::setUncompressed() - * Instructs the Phar class to uncompress the current file +/* {{{ proto int PharFileInfo::decompress() + * Instructs the Phar class to decompress the current file */ -PHP_METHOD(PharFileInfo, setUncompressed) +PHP_METHOD(PharFileInfo, decompress) { char *fname, *error; int fname_len; @@ -3689,12 +3689,12 @@ } if (!phar_has_zlib) { zend_throw_exception_ex(spl_ce_BadMethodCallException, 0 TSRMLS_CC, - Cannot uncompress Gzip-compressed file, zlib extension is not enabled); + Cannot decompress Gzip-compressed file, zlib extension is not enabled); return; } if (!phar_has_bz2) { zend_throw_exception_ex(spl_ce_BadMethodCallException, 0 TSRMLS_CC, - Cannot uncompress Bzip2-compressed file, bz2 extension is not enabled); + Cannot decompress Bzip2-compressed file, bz2 extension is not enabled); return; } if (!entry_obj-ent.entry-fp) { @@ -3943,7 +3943,7 @@ PHP_ME(PharFileInfo, setCompressedBZIP2, NULL, 0) PHP_ME(PharFileInfo, setCompressedGZ,NULL, 0) PHP_ME(PharFileInfo, setMetadata,arginfo_phar_setMetadata, 0) - PHP_ME(PharFileInfo, setUncompressed,NULL, 0) + PHP_ME(PharFileInfo, decompress, NULL, 0) {NULL, NULL, NULL} }; #endif /* HAVE_SPL */ http://cvs.php.net/viewvc.cgi/pecl/phar/tests/phar_oo_compressed_001.phpt?r1=1.5r2=1.6diff_format=u Index: pecl/phar/tests/phar_oo_compressed_001.phpt diff -u pecl/phar/tests/phar_oo_compressed_001.phpt:1.5 pecl/phar/tests/phar_oo_compressed_001.phpt:1.6 --- pecl/phar/tests/phar_oo_compressed_001.phpt:1.5 Wed Feb 20 13:11:38 2008 +++ pecl/phar/tests/phar_oo_compressed_001.phpt Fri Apr 11 12:56:52 2008 @@ -29,7 +29,7 @@ var_dump($phar['c']-isCompressed()); $phar['a'] = 'new a'; -$phar['a']-setUncompressed(); +$phar['a']-decompress(); $phar['b'] = 'new b'; $phar['b']-setCompressedGZ(); $phar['d'] = 'new d'; http://cvs.php.net/viewvc.cgi/pecl/phar/tests/phar_oo_compressed_001b.phpt?r1=1.4r2=1.5diff_format=u Index: pecl/phar/tests/phar_oo_compressed_001b.phpt diff -u pecl/phar/tests/phar_oo_compressed_001b.phpt:1.4 pecl/phar/tests/phar_oo_compressed_001b.phpt:1.5 --- pecl/phar/tests/phar_oo_compressed_001b.phpt:1.4Wed Feb 20 13:11:38 2008 +++ pecl/phar/tests/phar_oo_compressed_001b.phptFri Apr 11 12:56:52 2008 @@ -29,7 +29,7 @@ var_dump($phar['c']-isCompressed()); $phar['a'] = 'new a'; -$phar['a']-setUncompressed(); +$phar['a']-decompress(); $phar['b'] = 'new b'; $phar['b']-setCompressedBZip2(); $phar['d'] = 'new d';
[PHP-DOC] cvs: pecl /phar phar_object.c /phar/tests phar_oo_compressallbz2.phpt phar_oo_compressallgz.phpt phar_oo_uncompressall.phpt
cellog Fri Apr 11 13:07:13 2008 UTC Modified files: /pecl/phar phar_object.c /pecl/phar/testsphar_oo_compressallbz2.phpt phar_oo_compressallgz.phpt phar_oo_uncompressall.phpt Log: merge PharFileInfo-isCompressed/isCompressedGZ/isCompressedBZIP2 by adding an optional parameter to isCompressed for testing specific compression algorithm [DOC] http://cvs.php.net/viewvc.cgi/pecl/phar/phar_object.c?r1=1.201r2=1.202diff_format=u Index: pecl/phar/phar_object.c diff -u pecl/phar/phar_object.c:1.201 pecl/phar/phar_object.c:1.202 --- pecl/phar/phar_object.c:1.201 Fri Apr 11 12:56:52 2008 +++ pecl/phar/phar_object.c Fri Apr 11 13:07:12 2008 @@ -17,7 +17,7 @@ +--+ */ -/* $Id: phar_object.c,v 1.201 2008/04/11 12:56:52 cellog Exp $ */ +/* $Id: phar_object.c,v 1.202 2008/04/11 13:07:12 cellog Exp $ */ #include phar_internal.h #include func_interceptors.h @@ -3297,14 +3297,30 @@ } /* }}} */ -/* {{{ proto bool PharFileInfo::isCompressed() - * Returns whether the entry is compressed +/* {{{ proto bool PharFileInfo::isCompressed([int compression_type]) + * Returns whether the entry is compressed, and whether it is compressed with Phar::GZ or Phar::BZ2 if specified */ PHP_METHOD(PharFileInfo, isCompressed) { + /* a number that is not Phar::GZ or Phar::BZ2 */ + long method = 9021976; PHAR_ENTRY_OBJECT(); - RETURN_BOOL(entry_obj-ent.entry-flags PHAR_ENT_COMPRESSION_MASK); + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, |l, method) == FAILURE) { + return; + } + + switch (method) { + case 9021976: + RETURN_BOOL(entry_obj-ent.entry-flags PHAR_ENT_COMPRESSION_MASK); + case PHAR_ENT_COMPRESSED_GZ: + RETURN_BOOL(entry_obj-ent.entry-flags PHAR_ENT_COMPRESSED_GZ); + case PHAR_ENT_COMPRESSED_BZ2: + RETURN_BOOL(entry_obj-ent.entry-flags PHAR_ENT_COMPRESSED_BZ2); + default: + zend_throw_exception_ex(spl_ce_BadMethodCallException, 0 TSRMLS_CC, \ + Unknown compression type specified); \ + } } /* }}} */ @@ -3936,9 +3952,7 @@ PHP_ME(PharFileInfo, getMetadata,NULL, 0) PHP_ME(PharFileInfo, getPharFlags, NULL, 0) PHP_ME(PharFileInfo, hasMetadata,NULL, 0) - PHP_ME(PharFileInfo, isCompressed, NULL, 0) - PHP_ME(PharFileInfo, isCompressedBZIP2, NULL, 0) - PHP_ME(PharFileInfo, isCompressedGZ, NULL, 0) + PHP_ME(PharFileInfo, isCompressed, arginfo_phar_comp, 0) PHP_ME(PharFileInfo, isCRCChecked, NULL, 0) PHP_ME(PharFileInfo, setCompressedBZIP2, NULL, 0) PHP_ME(PharFileInfo, setCompressedGZ,NULL, 0) http://cvs.php.net/viewvc.cgi/pecl/phar/tests/phar_oo_compressallbz2.phpt?r1=1.6r2=1.7diff_format=u Index: pecl/phar/tests/phar_oo_compressallbz2.phpt diff -u pecl/phar/tests/phar_oo_compressallbz2.phpt:1.6 pecl/phar/tests/phar_oo_compressallbz2.phpt:1.7 --- pecl/phar/tests/phar_oo_compressallbz2.phpt:1.6 Thu Apr 10 13:40:25 2008 +++ pecl/phar/tests/phar_oo_compressallbz2.phpt Fri Apr 11 13:07:13 2008 @@ -31,14 +31,14 @@ $phar = new Phar($fname); $phar-compressFiles(Phar::BZ2); var_dump(file_get_contents($pname . '/a')); -var_dump($phar['a']-isCompressedGZ()); -var_dump($phar['a']-isCompressedBZIP2()); +var_dump($phar['a']-isCompressed(Phar::GZ)); +var_dump($phar['a']-isCompressed(Phar::BZ2)); var_dump(file_get_contents($pname . '/b')); -var_dump($phar['b']-isCompressedGZ()); -var_dump($phar['b']-isCompressedBZIP2()); +var_dump($phar['b']-isCompressed(Phar::GZ)); +var_dump($phar['b']-isCompressed(Phar::BZ2)); var_dump(file_get_contents($pname . '/c')); -var_dump($phar['c']-isCompressedGZ()); -var_dump($phar['b']-isCompressedBZIP2()); +var_dump($phar['c']-isCompressed(Phar::GZ)); +var_dump($phar['b']-isCompressed(Phar::BZ2)); ? ===DONE=== http://cvs.php.net/viewvc.cgi/pecl/phar/tests/phar_oo_compressallgz.phpt?r1=1.6r2=1.7diff_format=u Index: pecl/phar/tests/phar_oo_compressallgz.phpt diff -u pecl/phar/tests/phar_oo_compressallgz.phpt:1.6 pecl/phar/tests/phar_oo_compressallgz.phpt:1.7 --- pecl/phar/tests/phar_oo_compressallgz.phpt:1.6 Thu Apr 10 13:40:25 2008 +++ pecl/phar/tests/phar_oo_compressallgz.phpt Fri Apr 11 13:07:13 2008 @@ -31,14 +31,14 @@ $phar = new Phar($fname); $phar-compressFiles(Phar::GZ); var_dump(file_get_contents($pname . '/a')); -var_dump($phar['a']-isCompressedGZ()); -var_dump($phar['a']-isCompressedBZIP2());
[PHP-DOC] cvs: pecl /phar phar_object.c /phar/tests phar_copy.phpt phar_oo_compressed_001.phpt phar_oo_compressed_001b.phpt phar_oo_getcontentsgz.phpt
cellog Fri Apr 11 13:26:02 2008 UTC Modified files: /pecl/phar phar_object.c /pecl/phar/testsphar_copy.phpt phar_oo_compressed_001.phpt phar_oo_compressed_001b.phpt phar_oo_getcontentsgz.phpt Log: combine PharFileInfo-setCompressedGZ/setCompressedBZIP2 into compress() with parameter Phar::GZ or Phar::BZ2 use ZEND_ACC_PUBLIC in PharFileInfo definitions, to be consistent [DOC] http://cvs.php.net/viewvc.cgi/pecl/phar/phar_object.c?r1=1.202r2=1.203diff_format=u Index: pecl/phar/phar_object.c diff -u pecl/phar/phar_object.c:1.202 pecl/phar/phar_object.c:1.203 --- pecl/phar/phar_object.c:1.202 Fri Apr 11 13:07:12 2008 +++ pecl/phar/phar_object.c Fri Apr 11 13:26:02 2008 @@ -17,7 +17,7 @@ +--+ */ -/* $Id: phar_object.c,v 1.202 2008/04/11 13:07:12 cellog Exp $ */ +/* $Id: phar_object.c,v 1.203 2008/04/11 13:26:02 cellog Exp $ */ #include phar_internal.h #include func_interceptors.h @@ -3305,7 +3305,7 @@ /* a number that is not Phar::GZ or Phar::BZ2 */ long method = 9021976; PHAR_ENTRY_OBJECT(); - + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, |l, method) == FAILURE) { return; } @@ -3324,28 +3324,6 @@ } /* }}} */ -/* {{{ proto bool PharFileInfo::isCompressedGZ() - * Returns whether the entry is compressed using gz - */ -PHP_METHOD(PharFileInfo, isCompressedGZ) -{ - PHAR_ENTRY_OBJECT(); - - RETURN_BOOL(entry_obj-ent.entry-flags PHAR_ENT_COMPRESSED_GZ); -} -/* }}} */ - -/* {{{ proto bool PharFileInfo::isCompressedBZIP2() - * Returns whether the entry is compressed using bzip2 - */ -PHP_METHOD(PharFileInfo, isCompressedBZIP2) -{ - PHAR_ENTRY_OBJECT(); - - RETURN_BOOL(entry_obj-ent.entry-flags PHAR_ENT_COMPRESSED_BZ2); -} -/* }}} */ - /* {{{ proto int PharFileInfo::getCRC32() * Returns CRC32 code or throws an exception if not CRC checked */ @@ -3572,14 +3550,19 @@ } /* }}} */ -/* {{{ proto int PharFileInfo::setCompressedGZ() - * Instructs the Phar class to compress the current file using zlib +/* {{{ proto int PharFileInfo::compress(int compression_type) + * Instructs the Phar class to compress the current file using zlib or bzip2 compression */ -PHP_METHOD(PharFileInfo, setCompressedGZ) +PHP_METHOD(PharFileInfo, compress) { + long method = 9021976; char *error; PHAR_ENTRY_OBJECT(); + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, l, method) == FAILURE) { + return; + } + if (entry_obj-ent.entry-is_tar) { zend_throw_exception_ex(spl_ce_BadMethodCallException, 0 TSRMLS_CC, Cannot compress with Gzip compression, not possible with tar-based phar archives); @@ -3590,10 +3573,6 @@ Phar entry is a directory, cannot set compression); \ return; } - if (entry_obj-ent.entry-flags PHAR_ENT_COMPRESSED_GZ) { - RETURN_TRUE; - return; - } if (PHAR_G(readonly) !entry_obj-ent.entry-phar-is_data) { zend_throw_exception_ex(spl_ce_BadMethodCallException, 0 TSRMLS_CC, Phar is readonly, cannot change compression); @@ -3604,65 +3583,64 @@ Cannot compress deleted file); return; } - if (!phar_has_zlib) { - zend_throw_exception_ex(spl_ce_BadMethodCallException, 0 TSRMLS_CC, - Cannot compress with Gzip compression, zlib extension is not enabled); - return; - } - entry_obj-ent.entry-old_flags = entry_obj-ent.entry-flags; - entry_obj-ent.entry-flags = ~PHAR_ENT_COMPRESSION_MASK; - entry_obj-ent.entry-flags |= PHAR_ENT_COMPRESSED_GZ; - entry_obj-ent.entry-phar-is_modified = 1; - entry_obj-ent.entry-is_modified = 1; - phar_flush(entry_obj-ent.entry-phar, 0, 0, 0, error TSRMLS_CC); - if (error) { - zend_throw_exception_ex(phar_ce_PharException, 0 TSRMLS_CC, error); - efree(error); + switch (method) { + case PHAR_ENT_COMPRESSED_GZ: + if (entry_obj-ent.entry-flags PHAR_ENT_COMPRESSED_GZ) { + RETURN_TRUE; + return; + } + if ((entry_obj-ent.entry-flags PHAR_ENT_COMPRESSED_BZ2) != 0) { + if (!phar_has_bz2) { + zend_throw_exception_ex(spl_ce_BadMethodCallException, 0 TSRMLS_CC, + Cannot compress with gzip compression, file is already compressed with bzip2 compression and bz2 extension is not enabled, cannot decompress); +
[PHP-DOC] cvs: pecl /phar phar_object.c /phar/tests/tar tar_makebz2.phpt tar_makegz.phpt
cellog Fri Apr 11 13:41:58 2008 UTC Modified files: /pecl/phar phar_object.c /pecl/phar/tests/tartar_makebz2.phpt tar_makegz.phpt Log: restore Phar-compress/decompress() to simplify $phar-convertToExecutable(NULL, Phar::GZ) to $phar-compress(Phar::GZ) [DOC] http://cvs.php.net/viewvc.cgi/pecl/phar/phar_object.c?r1=1.204r2=1.205diff_format=u Index: pecl/phar/phar_object.c diff -u pecl/phar/phar_object.c:1.204 pecl/phar/phar_object.c:1.205 --- pecl/phar/phar_object.c:1.204 Fri Apr 11 13:26:35 2008 +++ pecl/phar/phar_object.c Fri Apr 11 13:41:58 2008 @@ -17,7 +17,7 @@ +--+ */ -/* $Id: phar_object.c,v 1.204 2008/04/11 13:26:35 cellog Exp $ */ +/* $Id: phar_object.c,v 1.205 2008/04/11 13:41:58 cellog Exp $ */ #include phar_internal.h #include func_interceptors.h @@ -2541,6 +2541,115 @@ } /* }}} */ +/* {{{ proto object Phar::compress(int method[, string extension]) + * Compress a .tar, or .phar.tar with whole-file compression + * The parameter can be one of Phar::GZ or Phar::BZ2 to specify + * the kind of compression desired + */ +PHP_METHOD(Phar, compress) +{ + long method = 0; + char *ext = NULL; + int ext_len; + php_uint32 flags; + zval *ret; + PHAR_ARCHIVE_OBJECT(); + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, l|s, method, ext, ext_len) == FAILURE) { + return; + } + + if (PHAR_G(readonly) !phar_obj-arc.archive-is_data) { + zend_throw_exception_ex(spl_ce_UnexpectedValueException, 0 TSRMLS_CC, + Cannot compress phar archive, phar is read-only); + return; + } + + if (phar_obj-arc.archive-is_zip) { + zend_throw_exception_ex(spl_ce_UnexpectedValueException, 0 TSRMLS_CC, + Cannot compress zipbased archives with whole-archive compression); + return; + } + + switch (method) { + case 0: + flags = PHAR_FILE_COMPRESSED_NONE; + break; + case PHAR_ENT_COMPRESSED_GZ: + if (!phar_has_zlib) { + zend_throw_exception_ex(spl_ce_BadMethodCallException, 0 TSRMLS_CC, + Cannot compress entire archive with gzip, enable ext/zlib in php.ini); + return; + } + flags = PHAR_FILE_COMPRESSED_GZ; + break; + + case PHAR_ENT_COMPRESSED_BZ2: + if (!phar_has_bz2) { + zend_throw_exception_ex(spl_ce_BadMethodCallException, 0 TSRMLS_CC, + Cannot compress entire archive with bz2, enable ext/bz2 in php.ini); + return; + } + flags = PHAR_FILE_COMPRESSED_BZ2; + break; + default: + zend_throw_exception_ex(spl_ce_BadMethodCallException, 0 TSRMLS_CC, + Unknown compression specified, please pass one of Phar::GZ or Phar::BZ2); + return; + } + + if (phar_obj-arc.archive-is_tar) { + ret = phar_convert_to_other(phar_obj-arc.archive, PHAR_FORMAT_TAR, ext, flags TSRMLS_CC); + } else { + ret = phar_convert_to_other(phar_obj-arc.archive, PHAR_FORMAT_PHAR, ext, flags TSRMLS_CC); + } + if (ret) { + RETURN_ZVAL(ret, 1, 1); + } else { + RETURN_NULL(); + } +} +/* }}} */ + +/* {{{ proto object Phar::decompress([string extension]) + * Decompress a .tar, or .phar.tar with whole-file compression + */ +PHP_METHOD(Phar, decompress) +{ + char *ext = NULL; + int ext_len; + zval *ret; + PHAR_ARCHIVE_OBJECT(); + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, |s, ext, ext_len) == FAILURE) { + return; + } + + if (PHAR_G(readonly) !phar_obj-arc.archive-is_data) { + zend_throw_exception_ex(spl_ce_UnexpectedValueException, 0 TSRMLS_CC, + Cannot compress phar archive, phar is read-only); + return; + } + + if (phar_obj-arc.archive-is_zip) { + zend_throw_exception_ex(spl_ce_UnexpectedValueException, 0 TSRMLS_CC, + Cannot compress zipbased archives with whole-archive compression); + return; + } + + if (phar_obj-arc.archive-is_tar) { + ret = phar_convert_to_other(phar_obj-arc.archive, PHAR_FORMAT_TAR, ext, PHAR_FILE_COMPRESSED_NONE TSRMLS_CC); + } else { + ret = phar_convert_to_other(phar_obj-arc.archive, PHAR_FORMAT_PHAR, ext, PHAR_FILE_COMPRESSED_NONE
[PHP-DOC] cvs: pecl /phar phar_internal.h phar_object.c /phar/tests phar_convert_repeated.phpt phar_convert_repeated_b.phpt phar_convert_tar.phpt phar_convert_tar2.phpt phar_convert_tar3.phpt phar_co
cellog Fri Apr 11 04:20:14 2008 UTC Modified files: /pecl/phar phar_internal.h phar_object.c /pecl/phar/testsphar_convert_repeated.phpt phar_convert_repeated_b.phpt phar_convert_tar.phpt phar_convert_tar2.phpt phar_convert_tar3.phpt phar_convert_zip.phpt /pecl/phar/tests/tarphar_convert_phar.phpt phar_convert_phar2.phpt phar_convert_phar3.phpt tar_makebz2.phpt tar_makegz.phpt /pecl/phar/tests/zipphar_convert_phar.phpt Log: refactor compress/convertToTar/convertToPhar/convertToZip/convertToExecutable/convertToData into 2 methods: convertToExecutable/convertToData. Both methods accept 3 optional parameters 1 archive type, Phar::PHAR, Phar::TAR, or Phar::ZIP 2 compression Phar::NONE, Phar::GZ, or Phar::BZ2 3 file extension. Default is format.compression where .phar.tar is executable .tar convertToExecutable always returns a Phar object convertToData always returns a PharData object also added Phar::PHAR, Phar::TAR, and Phar::ZIP class constants [DOC] http://cvs.php.net/viewvc.cgi/pecl/phar/phar_internal.h?r1=1.98r2=1.99diff_format=u Index: pecl/phar/phar_internal.h diff -u pecl/phar/phar_internal.h:1.98 pecl/phar/phar_internal.h:1.99 --- pecl/phar/phar_internal.h:1.98 Mon Mar 24 01:33:29 2008 +++ pecl/phar/phar_internal.h Fri Apr 11 04:20:14 2008 @@ -17,7 +17,7 @@ +--+ */ -/* $Id: phar_internal.h,v 1.98 2008/03/24 01:33:29 cellog Exp $ */ +/* $Id: phar_internal.h,v 1.99 2008/04/11 04:20:14 cellog Exp $ */ #ifdef HAVE_CONFIG_H #include config.h @@ -121,6 +121,10 @@ #define PHAR_ENT_PERM_DEF_FILE0x01B6 #define PHAR_ENT_PERM_DEF_DIR 0x01FF +#define PHAR_FORMAT_PHAR0 +#define PHAR_FORMAT_TAR 1 +#define PHAR_FORMAT_ZIP 2 + #define TAR_FILE'0' #define TAR_LINK'1' #define TAR_SYMLINK '2' http://cvs.php.net/viewvc.cgi/pecl/phar/phar_object.c?r1=1.199r2=1.200diff_format=u Index: pecl/phar/phar_object.c diff -u pecl/phar/phar_object.c:1.199 pecl/phar/phar_object.c:1.200 --- pecl/phar/phar_object.c:1.199 Thu Apr 10 13:41:28 2008 +++ pecl/phar/phar_object.c Fri Apr 11 04:20:14 2008 @@ -17,7 +17,7 @@ +--+ */ -/* $Id: phar_object.c,v 1.199 2008/04/10 13:41:28 cellog Exp $ */ +/* $Id: phar_object.c,v 1.200 2008/04/11 04:20:14 cellog Exp $ */ #include phar_internal.h #include func_interceptors.h @@ -1744,10 +1744,10 @@ phar-is_data = source-is_data; switch (convert) { - case 1 : + case PHAR_FORMAT_TAR : phar-is_tar = 1; break; - case 2 : + case PHAR_FORMAT_ZIP : phar-is_zip = 1; break; default : @@ -1822,110 +1822,65 @@ } /* }}} */ -/* {{{ proto object Phar::convertToTar([string file_ext]) - * Convert a phar or phar.zip archive to the tar file format. The first - * parameter can be one of Phar::GZ or Phar::BZ2 to specify whole-file - * compression. The second parameter allows the user to determine the new - * filename extension (default is phar.tar/phar.tar.bz2/phar.tar.gz). - * Both parameters are optional. - */ -PHP_METHOD(Phar, convertToTar) -{ - char *ext = NULL; - int ext_len = 0, save; - zval *ret; - PHAR_ARCHIVE_OBJECT(); - - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, |s, ext, ext_len) == FAILURE) { - return; - } - - if (phar_obj-arc.archive-is_tar) { - RETURN_TRUE; - } - if (PHAR_G(readonly)) { - save = phar_obj-arc.archive-is_data; - phar_obj-arc.archive-is_data = 1; - } - - ret = phar_convert_to_other(phar_obj-arc.archive, 1, ext, phar_obj-arc.archive-flags TSRMLS_CC); - phar_obj-arc.archive-is_data = save; - if (ret) { - RETURN_ZVAL(ret, 1, 1); - } else { - RETURN_NULL(); - } -} -/* }}} */ - -/* {{{ proto object Phar::convertToZip([string file_ext]) - * Convert a phar or phar.tar archive to the zip file format. The single - * optional argument allows the user to determine the new filename extension - * (default is phar.zip). +/* {{{ proto object Phar::convertToExecutable([int format[, int compression [, string file_ext]]]) + * Convert a phar.tar or phar.zip archive to the phar file format. The + * optional parameter allows the user to determine the new + * filename extension (default is phar). */ -PHP_METHOD(Phar, convertToZip) +PHP_METHOD(Phar, convertToExecutable) { char *ext = NULL; - int ext_len = 0, save; + int is_data, ext_len = 0; + php_uint32 flags; zval
[PHP-DOC] cvs: pecl /phar dirstream.c phar_object.c util.c /phar/tests addfuncs.phpt dir.phpt /phar/tests/tar 033.phpt 033a.phpt dir.phpt /phar/tests/zip 033.phpt 033a.phpt dir.phpt
cellog Wed Apr 9 19:23:30 2008 UTC Added files: /pecl/phar/testsaddfuncs.phpt Modified files: /pecl/phar dirstream.c phar_object.c util.c /pecl/phar/testsdir.phpt /pecl/phar/tests/tar033.phpt 033a.phpt dir.phpt /pecl/phar/tests/zip033.phpt 033a.phpt dir.phpt Log: add addFile/addFromString/addEmptyDir. API is identical to ext/zip [DOC] http://cvs.php.net/viewvc.cgi/pecl/phar/dirstream.c?r1=1.13r2=1.14diff_format=u Index: pecl/phar/dirstream.c diff -u pecl/phar/dirstream.c:1.13 pecl/phar/dirstream.c:1.14 --- pecl/phar/dirstream.c:1.13 Mon Mar 24 03:01:29 2008 +++ pecl/phar/dirstream.c Wed Apr 9 19:23:30 2008 @@ -471,7 +471,7 @@ return FAILURE; } - if ((e = phar_get_entry_info_dir(phar, resource-path + 1, strlen(resource-path + 1), 1, error TSRMLS_CC))) { + if ((e = phar_get_entry_info_dir(phar, resource-path + 1, strlen(resource-path + 1), 2, error TSRMLS_CC))) { /* directory exists, or is a subdirectory of an existing file */ efree(e-filename); efree(e); @@ -485,6 +485,18 @@ php_url_free(resource); return FAILURE; } + if ((e = phar_get_entry_info_dir(phar, resource-path + 1, strlen(resource-path + 1), 0, error TSRMLS_CC))) { + /* entry exists as a file */ + php_stream_wrapper_log_error(wrapper, options TSRMLS_CC, phar error: cannot create directory \%s\ in phar \%s\, file already exists, resource-path+1, resource-host); + php_url_free(resource); + return FAILURE; + } + if (error) { + php_stream_wrapper_log_error(wrapper, options TSRMLS_CC, phar error: cannot create directory \%s\ in phar \%s\, %s, resource-path+1, resource-host, error); + efree(error); + php_url_free(resource); + return FAILURE; + } memset((void *) entry, 0, sizeof(phar_entry_info)); @@ -582,7 +594,7 @@ return FAILURE; } - if (!(entry = phar_get_entry_info_dir(phar, resource-path + 1, strlen(resource-path + 1), 1, error TSRMLS_CC))) { + if (!(entry = phar_get_entry_info_dir(phar, resource-path + 1, strlen(resource-path + 1), 2, error TSRMLS_CC))) { if (error) { php_stream_wrapper_log_error(wrapper, options TSRMLS_CC, phar error: cannot remove directory \%s\ in phar \%s\, %s, resource-path+1, resource-host, error); efree(error); http://cvs.php.net/viewvc.cgi/pecl/phar/phar_object.c?r1=1.195r2=1.196diff_format=u Index: pecl/phar/phar_object.c diff -u pecl/phar/phar_object.c:1.195 pecl/phar/phar_object.c:1.196 --- pecl/phar/phar_object.c:1.195 Wed Apr 9 18:12:40 2008 +++ pecl/phar/phar_object.c Wed Apr 9 19:23:30 2008 @@ -17,7 +17,7 @@ +--+ */ -/* $Id: phar_object.c,v 1.195 2008/04/09 18:12:40 cellog Exp $ */ +/* $Id: phar_object.c,v 1.196 2008/04/09 19:23:30 cellog Exp $ */ #include phar_internal.h #include func_interceptors.h @@ -2827,7 +2827,7 @@ return; } - if (!phar_get_entry_info_dir(phar_obj-arc.archive, fname, fname_len, 2, error TSRMLS_CC)) { + if (!phar_get_entry_info_dir(phar_obj-arc.archive, fname, fname_len, 1, error TSRMLS_CC)) { zend_throw_exception_ex(spl_ce_BadMethodCallException, 0 TSRMLS_CC, Entry %s does not exist%s%s, fname, error?, :, error?error:); } else { fname_len = spprintf(fname, 0, phar://%s/%s, phar_obj-arc.archive-fname, fname); @@ -2840,44 +2840,21 @@ } /* }}} */ -/* {{{ proto int Phar::offsetSet(string entry, string value) - * set the contents of an internal file to those of an external file +/* {{{ add a file within the phar archive from a string or resource */ -PHP_METHOD(Phar, offsetSet) +static void phar_add_file(phar_archive_data *phar, char *filename, int filename_len, char *cont_str, int cont_len, zval *zresource TSRMLS_DC) { - char *fname, *cont_str = NULL, *error; - int fname_len, cont_len; - zval *zresource; + char *error; long contents_len; phar_entry_data *data; php_stream *contents_file; - PHAR_ARCHIVE_OBJECT(); - - if (PHAR_G(readonly) !phar_obj-arc.archive-is_data) { - zend_throw_exception_ex(spl_ce_BadMethodCallException, 0 TSRMLS_CC, Write operations disabled by INI setting); - return; - } - - if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS() TSRMLS_CC, sr, fname, fname_len, zresource) == FAILURE -zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, ss, fname, fname_len, cont_str, cont_len) == FAILURE) { - return; - } - if ((phar_obj-arc.archive-is_tar ||
[PHP-DOC] cvs: pecl /phar phar_object.c /phar/tests phar_oo_iswriteable.phpt
cellog Thu Apr 10 03:32:09 2008 UTC Modified files: /pecl/phar phar_object.c /pecl/phar/testsphar_oo_iswriteable.phpt Log: add Phar-isWritable() for detecting whether a phar archive can be written to based on phar.readonly combined with actual file permissions [DOC] http://cvs.php.net/viewvc.cgi/pecl/phar/phar_object.c?r1=1.196r2=1.197diff_format=u Index: pecl/phar/phar_object.c diff -u pecl/phar/phar_object.c:1.196 pecl/phar/phar_object.c:1.197 --- pecl/phar/phar_object.c:1.196 Wed Apr 9 19:23:30 2008 +++ pecl/phar/phar_object.c Thu Apr 10 03:32:09 2008 @@ -17,7 +17,7 @@ +--+ */ -/* $Id: phar_object.c,v 1.196 2008/04/09 19:23:30 cellog Exp $ */ +/* $Id: phar_object.c,v 1.197 2008/04/10 03:32:09 cellog Exp $ */ #include phar_internal.h #include func_interceptors.h @@ -2094,6 +2094,28 @@ } /* }}} */ +/* {{{ proto bool Phar::isWritable() + * Returns true if phar.readonly=0 or phar is a PharData AND the actual file is writable. + */ +PHP_METHOD(Phar, isWritable) +{ + php_stream_statbuf ssb; + PHAR_ARCHIVE_OBJECT(); + + if (!phar_obj-arc.archive-is_writeable) { + RETURN_FALSE; + } + if (SUCCESS != php_stream_stat_path(phar_obj-arc.archive-fname, ssb)) { + if (phar_obj-arc.archive-is_brandnew) { + /* assume it works if the file doesn't exist yet */ + RETURN_TRUE; + } + RETURN_FALSE; + } + RETURN_BOOL((ssb.sb.st_mode (S_IWOTH | S_IWGRP | S_IWUSR)) != 0); +} +/* }}} */ + /* {{{ proto bool Phar::delete(string entry) * Deletes a named file within the archive. */ @@ -3925,6 +3947,7 @@ PHP_ME(Phar, hasMetadata, NULL, ZEND_ACC_PUBLIC) PHP_ME(Phar, isBuffering, NULL, ZEND_ACC_PUBLIC) PHP_ME(Phar, isCompressed, NULL, ZEND_ACC_PUBLIC) + PHP_ME(Phar, isWritable,NULL, ZEND_ACC_PUBLIC) PHP_ME(Phar, isPhar,NULL, ZEND_ACC_PUBLIC) PHP_ME(Phar, isTar, NULL, ZEND_ACC_PUBLIC) PHP_ME(Phar, isZip, NULL, ZEND_ACC_PUBLIC) http://cvs.php.net/viewvc.cgi/pecl/phar/tests/phar_oo_iswriteable.phpt?r1=1.1r2=1.2diff_format=u Index: pecl/phar/tests/phar_oo_iswriteable.phpt diff -u pecl/phar/tests/phar_oo_iswriteable.phpt:1.1 pecl/phar/tests/phar_oo_iswriteable.phpt:1.2 --- pecl/phar/tests/phar_oo_iswriteable.phpt:1.1Thu Apr 10 03:12:07 2008 +++ pecl/phar/tests/phar_oo_iswriteable.phptThu Apr 10 03:32:09 2008 @@ -8,6 +8,7 @@ --FILE-- ?php $fname = dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.1.phar.php'; +$fname2 = dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.tar'; $pname = 'phar://hio'; $file = '?php include ' . $pname . '/a.php; __HALT_COMPILER(); ?'; @@ -17,6 +18,9 @@ $hasdir = 1; include 'files/phar_test.inc'; $a = new Phar($fname); +$b = new PharData($fname2); +$b['test'] = 'hi'; + var_dump($a['a.php']-isWritable()); var_dump($a['a.php']-isReadable()); $a['a.php']-chmod(000); @@ -34,10 +38,26 @@ var_dump($a['a.php']-isWritable()); var_dump($a['a.php']-isReadable()); ? +archive +?php +ini_set('phar.readonly',0); +clearstatcache(); +var_dump($a-isWritable()); +var_dump($b-isWritable()); +ini_set('phar.readonly',1); +clearstatcache(); +var_dump($a-isWritable()); +var_dump($b-isWritable()); +chmod($fname2, 000); +clearstatcache(); +var_dump($a-isWritable()); +var_dump($b-isWritable()); +? ===DONE=== --CLEAN-- ?php unlink(dirname(__FILE__) . '/' . basename(__FILE__, '.clean.php') . '.1.phar.php'); +unlink(dirname(__FILE__) . '/' . basename(__FILE__, '.clean.php') . '.tar'); ? --EXPECT-- bool(true) @@ -50,4 +70,11 @@ bool(true) bool(true) bool(true) +archive +bool(true) +bool(true) +bool(false) +bool(true) +bool(false) +bool(false) ===DONE===
[PHP-DOC] cvs: pecl /phar TODO package.php phar.c phar_internal.h phar_object.c tar.c /phar/tests/tar tar_gzip.phpt
cellog Wed Jan 9 07:09:03 2008 UTC Added files: /pecl/phar/tests/tartar_gzip.phpt Modified files: /pecl/phar TODO package.php phar.c phar_internal.h phar_object.c tar.c Log: implement whole-file compression of phars for phar/tar-based phars still not 100% working, add failing test add Phar::isCompressed(), which returns either 0, Phar::GZ, or Phar::BZ2 [DOC] http://cvs.php.net/viewvc.cgi/pecl/phar/TODO?r1=1.49r2=1.50diff_format=u Index: pecl/phar/TODO diff -u pecl/phar/TODO:1.49 pecl/phar/TODO:1.50 --- pecl/phar/TODO:1.49 Wed Jan 9 03:53:41 2008 +++ pecl/phar/TODO Wed Jan 9 07:09:03 2008 @@ -68,6 +68,5 @@ X Phar::copy($from, $to); [Greg] X Phar::delete($what) [Greg] X Phar::buildFromIterator(Iterator $it[, string $base_directory]) [Greg] - * Layout: Option to compress all content rather than single files. - That excludes stub and manifest haeder. (tar only) + X Layout: Option to compress all content rather than single files. (tar/phar only) [Greg] X clean crap paths like phar://blah.phar/file//../to\\here.php [Greg] http://cvs.php.net/viewvc.cgi/pecl/phar/package.php?r1=1.29r2=1.30diff_format=u Index: pecl/phar/package.php diff -u pecl/phar/package.php:1.29 pecl/phar/package.php:1.30 --- pecl/phar/package.php:1.29 Wed Jan 9 03:53:41 2008 +++ pecl/phar/package.php Wed Jan 9 07:09:03 2008 @@ -9,6 +9,7 @@ * include/fopen with include_path all work unmodified within a phar [Greg] * paths with . and .. work (phar://blah.phar/a/../b.php = phar://blah.phar/b.php) [Greg] * add support for mkdir()/rmdir() and support for empty directories to phar file format [Greg] + * add option to compress the entire phar file for phar/tar file format [Greg] * implement Phar::copy(string $from, string $to) [Greg] * implement Phar::buildFromIterator(Iterator $it[, string $base_directory]) [Greg] * add mapping of include/require from within a phar to location within phar [Greg] http://cvs.php.net/viewvc.cgi/pecl/phar/phar.c?r1=1.258r2=1.259diff_format=u Index: pecl/phar/phar.c diff -u pecl/phar/phar.c:1.258 pecl/phar/phar.c:1.259 --- pecl/phar/phar.c:1.258 Wed Jan 9 03:47:21 2008 +++ pecl/phar/phar.cWed Jan 9 07:09:03 2008 @@ -17,7 +17,7 @@ +--+ */ -/* $Id: phar.c,v 1.258 2008/01/09 03:47:21 cellog Exp $ */ +/* $Id: phar.c,v 1.259 2008/01/09 07:09:03 cellog Exp $ */ #define PHAR_MAIN 1 #include phar_internal.h @@ -979,7 +979,7 @@ * This is used by phar_open_filename to process the manifest, but can be called * directly. */ -int phar_open_file(php_stream *fp, char *fname, int fname_len, char *alias, int alias_len, long halt_offset, phar_archive_data** pphar, char **error TSRMLS_DC) /* {{{ */ +int phar_open_file(php_stream *fp, char *fname, int fname_len, char *alias, int alias_len, long halt_offset, phar_archive_data** pphar, php_uint32 compression, char **error TSRMLS_DC) /* {{{ */ { char b32[4], *buffer, *endbuffer, *savebuf; phar_archive_data *mydata = NULL; @@ -1066,7 +1066,11 @@ PHAR_GET_32(buffer, manifest_flags); - manifest_flags = ~PHAR_HDR_COMPRESSION_MASK; + manifest_flags = ~PHAR_HDR_COMPRESSION_MASK; + + manifest_flags = ~PHAR_FILE_COMPRESSION_MASK; + /* remember whether this entire phar was compressed with gz/bzip2 */ + manifest_flags |= compression; /* The lowest nibble contains the phar wide flags. The compression flags can */ /* be ignored on reading because it is being generated anyways. */ @@ -1624,14 +1628,14 @@ { const char token[] = __HALT_COMPILER();; const char zip_magic[] = PK\x03\x04; + const char gz_magic[] = \x1f\x8b\x08; + const char bz_magic[] = BZh; char *pos, buffer[1024 + sizeof(token)], test = '\0'; const long readsize = sizeof(buffer) - sizeof(token); const long tokenlen = sizeof(token) - 1; long halt_offset; size_t got; - - /* Maybe it's better to compile the file instead of just searching, */ - /* but we only want the offset. So we want a .re scanner to find it. */ + php_uint32 compression = PHAR_FILE_COMPRESSED_NONE; if (error) { *error = NULL; @@ -1643,6 +1647,9 @@ buffer[sizeof(buffer)-1] = '\0'; memset(buffer, 32, sizeof(token)); halt_offset = 0; + + /* Maybe it's better to compile the file instead of just searching, */ + /* but we only want the offset. So we want a .re scanner to find it. */ while(!php_stream_eof(fp)) { if ((got = php_stream_read(fp, buffer+tokenlen, readsize)) (size_t) tokenlen) { MAPPHAR_ALLOC_FAIL(internal corruption of phar \%s\ (truncated entry)) @@ -1650,19 +1657,85 @@ if (!test) { test = '\1';
[PHP-DOC] cvs: pecl /phar phar.c phar_internal.h phar_object.c
cellog Fri Jan 4 04:57:10 2008 UTC Modified files: /pecl/phar phar.c phar_internal.h phar_object.c Log: replace crappy $_SERVER munging with explicit munging via Phar::mungServer(). This static method takes an array with one of these 4 indices (case-sensitive): 'PHP_SELF', 'SCRIPT_NAME', 'SCRIPT_FILENAME', 'REQUEST_URI' and removes any reference to the actual path on the server. This allows older apps to function unmodified inside a phar. the variables are re-registered as PHAR_PHP_SELF and company to allow access from clever script files [DOC] http://cvs.php.net/viewvc.cgi/pecl/phar/phar.c?r1=1.241r2=1.242diff_format=u Index: pecl/phar/phar.c diff -u pecl/phar/phar.c:1.241 pecl/phar/phar.c:1.242 --- pecl/phar/phar.c:1.241 Fri Jan 4 01:45:36 2008 +++ pecl/phar/phar.cFri Jan 4 04:57:10 2008 @@ -17,7 +17,7 @@ +--+ */ -/* $Id: phar.c,v 1.241 2008/01/04 01:45:36 cellog Exp $ */ +/* $Id: phar.c,v 1.242 2008/01/04 04:57:10 cellog Exp $ */ #define PHAR_MAIN #include phar_internal.h @@ -4866,6 +4866,7 @@ zend_hash_init((PHAR_GLOBALS-phar_fname_map), sizeof(phar_archive_data*), zend_get_hash_value, destroy_phar_data, 0); zend_hash_init((PHAR_GLOBALS-phar_alias_map), sizeof(phar_archive_data*), zend_get_hash_value, NULL, 0); zend_hash_init((PHAR_GLOBALS-phar_plain_map), sizeof(const char *), zend_get_hash_value, NULL, 0); + zend_hash_init((PHAR_GLOBALS-phar_SERVER_mung_list), sizeof(const char *), zend_get_hash_value, NULL, 0); phar_split_extract_list(TSRMLS_C); if (SUCCESS == zend_hash_find(CG(function_table), fopen, 6, (void **)orig)) { PHAR_G(orig_fopen) = orig-internal_function.handler; @@ -4890,6 +4891,8 @@ PHAR_GLOBALS-phar_fname_map.arBuckets = NULL; zend_hash_destroy((PHAR_GLOBALS-phar_plain_map)); PHAR_GLOBALS-phar_plain_map.arBuckets = NULL; + zend_hash_destroy((PHAR_GLOBALS-phar_SERVER_mung_list)); + PHAR_GLOBALS-phar_SERVER_mung_list.arBuckets = NULL; PHAR_GLOBALS-request_init = 0; } PHAR_GLOBALS-request_done = 1; @@ -4903,7 +4906,7 @@ php_info_print_table_header(2, Phar: PHP Archive support, enabled); php_info_print_table_row(2, Phar EXT version, PHAR_EXT_VERSION_STR); php_info_print_table_row(2, Phar API version, PHAR_API_VERSION_STR); - php_info_print_table_row(2, CVS revision, $Revision: 1.241 $); + php_info_print_table_row(2, CVS revision, $Revision: 1.242 $); php_info_print_table_row(2, Phar-based phar archives, enabled); php_info_print_table_row(2, Tar-based phar archives, http://cvs.php.net/viewvc.cgi/pecl/phar/phar_internal.h?r1=1.51r2=1.52diff_format=u Index: pecl/phar/phar_internal.h diff -u pecl/phar/phar_internal.h:1.51 pecl/phar/phar_internal.h:1.52 --- pecl/phar/phar_internal.h:1.51 Thu Jan 3 04:44:59 2008 +++ pecl/phar/phar_internal.h Fri Jan 4 04:57:10 2008 @@ -17,7 +17,7 @@ +--+ */ -/* $Id: phar_internal.h,v 1.51 2008/01/03 04:44:59 cellog Exp $ */ +/* $Id: phar_internal.h,v 1.52 2008/01/04 04:57:10 cellog Exp $ */ #ifdef HAVE_CONFIG_H #include config.h @@ -119,6 +119,7 @@ HashTable phar_fname_map; HashTable phar_alias_map; HashTable phar_plain_map; + HashTable phar_SERVER_mung_list; char* extract_list; int readonly; zend_bool readonly_orig; http://cvs.php.net/viewvc.cgi/pecl/phar/phar_object.c?r1=1.96r2=1.97diff_format=u Index: pecl/phar/phar_object.c diff -u pecl/phar/phar_object.c:1.96 pecl/phar/phar_object.c:1.97 --- pecl/phar/phar_object.c:1.96Fri Jan 4 01:45:36 2008 +++ pecl/phar/phar_object.c Fri Jan 4 04:57:10 2008 @@ -17,7 +17,7 @@ +--+ */ -/* $Id: phar_object.c,v 1.96 2008/01/04 01:45:36 cellog Exp $ */ +/* $Id: phar_object.c,v 1.97 2008/01/04 04:57:10 cellog Exp $ */ #include phar_internal.h @@ -88,7 +88,82 @@ } /* }}} */ -static int phar_file_action(phar_entry_data *phar, char *mime_type, int code, char *entry, int entry_len, char *arch, int arch_len TSRMLS_DC) +static void phar_mung_server_vars(char *fname, char *entry, char *basename, int basename_len TSRMLS_DC) +{ + zval **_SERVER, **stuff; + char *path_info; + + /* tweak $_SERVER variables requested in earlier call to Phar::mungServer() */ + if (!zend_hash_num_elements((PHAR_GLOBALS-phar_SERVER_mung_list))) { + return; + } + if (SUCCESS != zend_hash_find(EG(symbol_table), _SERVER, sizeof(_SERVER), (void **) _SERVER)) { + return; + } +#define
[PHP-DOC] cvs: pecl /phar phar.c phar_internal.h phar_object.c /phar/tests frontcontroller1.phpt frontcontroller2.phpt frontcontroller3.phpt
cellog Sun Dec 23 21:12:41 2007 UTC Added files: /pecl/phar/testsfrontcontroller2.phpt frontcontroller3.phpt Modified files: /pecl/phar phar.c phar_internal.h phar_object.c /pecl/phar/testsfrontcontroller1.phpt Log: complete re-factoring of front controller. Now it is done with Phar-webPhar(): ?php Phar::webPhar(); __HALT_COMPILER(); With the above stub, the default front controller will kick in. An array of mime type overrides, and another array mapping phar file entry - redirected entry can be used to further customize [DOC] http://cvs.php.net/viewvc.cgi/pecl/phar/phar.c?r1=1.234r2=1.235diff_format=u Index: pecl/phar/phar.c diff -u pecl/phar/phar.c:1.234 pecl/phar/phar.c:1.235 --- pecl/phar/phar.c:1.234 Sat Dec 22 07:46:52 2007 +++ pecl/phar/phar.cSun Dec 23 21:12:41 2007 @@ -17,7 +17,7 @@ +--+ */ -/* $Id: phar.c,v 1.234 2007/12/22 07:46:52 cellog Exp $ */ +/* $Id: phar.c,v 1.235 2007/12/23 21:12:41 cellog Exp $ */ #define PHAR_MAIN #include phar_internal.h @@ -185,11 +185,6 @@ */ static void phar_destroy_phar_data(phar_archive_data *data TSRMLS_DC) /* {{{ */ { - if (!PHAR_G(request_ends)) { - if (zend_hash_num_elements((PHAR_GLOBALS-phar_web_map))) { - zend_hash_del((PHAR_GLOBALS-phar_web_map), data-fname, data-fname_len); - } - } if (data-alias data-alias != data-fname) { efree(data-alias); data-alias = NULL; @@ -504,7 +499,7 @@ * appended, truncated, or read. For read, if the entry is marked unmodified, it is * assumed that the file pointer, if present, is opened for reading */ -static int phar_get_entry_data(phar_entry_data **ret, char *fname, int fname_len, char *path, int path_len, char *mode, char **error TSRMLS_DC) /* {{{ */ +int phar_get_entry_data(phar_entry_data **ret, char *fname, int fname_len, char *path, int path_len, char *mode, char **error TSRMLS_DC) /* {{{ */ { phar_archive_data *phar; phar_entry_info *entry; @@ -1334,13 +1329,6 @@ mydata-sig_len = sig_len; mydata-signature = signature; phar_request_initialize(TSRMLS_C); - if ((manifest_flags PHAR_HDR_WEB) != 0) { - mydata-is_web = 1; - if (!zend_hash_num_elements((PHAR_GLOBALS-phar_mimes))) { - phar_init_mime_list(TSRMLS_C); - } - zend_hash_add((PHAR_GLOBALS-phar_web_map), mydata-fname, fname_len, (void*)mydata, sizeof(void*), NULL); - } zend_hash_add((PHAR_GLOBALS-phar_fname_map), mydata-fname, fname_len, (void*)mydata, sizeof(phar_archive_data*), NULL); if (register_alias) { mydata-is_explicit_alias = 1; @@ -2780,13 +2768,8 @@ manifest_len = offset + archive-alias_len + sizeof(manifest) + main_metadata_str.len; phar_set_32(manifest, manifest_len); phar_set_32(manifest+4, new_manifest_count); - if (archive-is_web) { - *(manifest + 8) = (unsigned char) (((PHAR_API_VERSION_NOWEB) 8) 0xFF); - *(manifest + 9) = (unsigned char) (((PHAR_API_VERSION_NOWEB) 0xF0)); - } else { - *(manifest + 8) = (unsigned char) (((PHAR_API_VERSION) 8) 0xFF); - *(manifest + 9) = (unsigned char) (((PHAR_API_VERSION) 0xF0)); - } + *(manifest + 8) = (unsigned char) (((PHAR_API_VERSION) 8) 0xFF); + *(manifest + 9) = (unsigned char) (((PHAR_API_VERSION) 0xF0)); phar_set_32(manifest+10, global_flags); phar_set_32(manifest+14, archive-alias_len); @@ -3867,159 +3850,6 @@ } /* }}} */ -static void phar_init_mime_list(TSRMLS_D) -{ - phar_mime_type mime; -#define PHAR_SET_MIME(mimetype, ret, ...) \ - mime.mime = mimetype; \ - mime.len = sizeof((mimetype))+1; \ - mime.type = ret; \ - { \ - char mimes[][5] = {__VA_ARGS__, \0}; \ - int i = 0; \ - for (; mimes[i][0]; i++) { \ - zend_hash_add((PHAR_GLOBALS-phar_mimes), mimes[i], strlen(mimes[i]), (void *)mime, sizeof(phar_mime_type), NULL); \ - } \ - } - - PHAR_SET_MIME(text/html, PHAR_MIME_PHPS, phps) - PHAR_SET_MIME(text/plain, PHAR_MIME_OTHER, c, cc, cpp, c++, dtd, h, log, rng, txt, xsd) - PHAR_SET_MIME(, PHAR_MIME_PHP, php, inc) - PHAR_SET_MIME(video/avi, PHAR_MIME_OTHER, avi) - PHAR_SET_MIME(image/bmp, PHAR_MIME_OTHER, bmp) - PHAR_SET_MIME(text/css, PHAR_MIME_OTHER, css) - PHAR_SET_MIME(image/gif, PHAR_MIME_OTHER, gif) - PHAR_SET_MIME(text/html, PHAR_MIME_OTHER, htm, html, htmls) - PHAR_SET_MIME(image/x-ico, PHAR_MIME_OTHER, ico) - PHAR_SET_MIME(image/jpeg, PHAR_MIME_OTHER, jpe, jpg, jpeg) - PHAR_SET_MIME(application/x-javascript,
[PHP-DOC] cvs: pecl /phar phar.c phar_internal.h phar_object.c /phar/tests 001.phpt create_path_error.phpt phar_test.inc
cellog Sat Dec 22 07:46:52 2007 UTC Modified files: /pecl/phar phar.c phar_internal.h phar_object.c /pecl/phar/tests001.phpt create_path_error.phpt phar_test.inc Log: first attempt at major new feature: default front controller for web Currently, an entire phar entry is leaked for no obvious reason, otherwise it works. Sample code: The phar has to be created using Phar-useFrontController(); and the stub performs actual resolution of which file to load: ?php Phar::mapPhar(); include 'phar://' . __FILE__ . '/' . substr($_SERVER['REQUEST_URI'], strlen(basename(__FILE__))); __HALT_COMPILER(); ? Phar automatically determines mime type from the file extension and either parses or displays the file. Modification of REQUEST_URI and other variables should happen in the stub [DOC] http://cvs.php.net/viewvc.cgi/pecl/phar/phar.c?r1=1.233r2=1.234diff_format=u Index: pecl/phar/phar.c diff -u pecl/phar/phar.c:1.233 pecl/phar/phar.c:1.234 --- pecl/phar/phar.c:1.233 Fri Dec 21 04:49:24 2007 +++ pecl/phar/phar.cSat Dec 22 07:46:52 2007 @@ -17,7 +17,7 @@ +--+ */ -/* $Id: phar.c,v 1.233 2007/12/21 04:49:24 cellog Exp $ */ +/* $Id: phar.c,v 1.234 2007/12/22 07:46:52 cellog Exp $ */ #define PHAR_MAIN #include phar_internal.h @@ -185,6 +185,11 @@ */ static void phar_destroy_phar_data(phar_archive_data *data TSRMLS_DC) /* {{{ */ { + if (!PHAR_G(request_ends)) { + if (zend_hash_num_elements((PHAR_GLOBALS-phar_web_map))) { + zend_hash_del((PHAR_GLOBALS-phar_web_map), data-fname, data-fname_len); + } + } if (data-alias data-alias != data-fname) { efree(data-alias); data-alias = NULL; @@ -390,6 +395,12 @@ *error = NULL; } + if (!path_len !dir) { + if (error) { + spprintf(error, 0, phar error: invalid path \%s\ must not be empty, path); + } + return NULL; + } if (phar_path_check(path, path_len, pcr_error) pcr_is_ok) { if (error) { spprintf(error, 0, phar error: invalid path \%s\ contains %s, path, pcr_error); @@ -414,6 +425,9 @@ uint keylen; ulong unused; + if (!path_len) { + path = /; + } manifest = phar-manifest; zend_hash_internal_pointer_reset(manifest); while (FAILURE != zend_hash_has_more_elements(manifest)) { @@ -515,6 +529,12 @@ if (FAILURE == phar_get_archive(phar, fname, fname_len, NULL, 0, error TSRMLS_CC)) { return FAILURE; } + if (!path_len) { + if (error) { + spprintf(error, 0, phar error: file \\ cannot be empty); + } + return FAILURE; + } if ((entry = phar_get_entry_info(phar, path, path_len, for_create !PHAR_G(readonly) ? NULL : error TSRMLS_CC)) == NULL) { if (for_create !PHAR_G(readonly)) { return SUCCESS; @@ -1314,6 +1334,13 @@ mydata-sig_len = sig_len; mydata-signature = signature; phar_request_initialize(TSRMLS_C); + if ((manifest_flags PHAR_HDR_WEB) != 0) { + mydata-is_web = 1; + if (!zend_hash_num_elements((PHAR_GLOBALS-phar_mimes))) { + phar_init_mime_list(TSRMLS_C); + } + zend_hash_add((PHAR_GLOBALS-phar_web_map), mydata-fname, fname_len, (void*)mydata, sizeof(void*), NULL); + } zend_hash_add((PHAR_GLOBALS-phar_fname_map), mydata-fname, fname_len, (void*)mydata, sizeof(phar_archive_data*), NULL); if (register_alias) { mydata-is_explicit_alias = 1; @@ -1564,9 +1591,12 @@ static int php_check_dots(const char *element, int n) { - while (n-- 0) if (element[n] != '.') break; - - return (n != -1); + for(n--; n = 0; --n) { + if (element[n] != '.') { + return 1; + } + } + return 0; } #define IS_DIRECTORY_UP(element, len) \ @@ -1631,7 +1661,7 @@ efree(free_path); - if (path[path_length-1] == '/') { + if (path[path_length-1] == '/' new_phar_len 1) { new_phar = (char*)erealloc(new_phar, new_phar_len + 2); new_phar[new_phar_len++] = '/'; new_phar[new_phar_len] = 0; @@ -1694,7 +1724,7 @@ #ifdef PHP_WIN32 phar_unixify_path_separators(*entry, *entry_len); #endif - *entry = phar_fix_filepath(*entry, entry_len); + *entry = phar_fix_filepath(*entry, entry_len); } else { *entry_len = 1; *entry = estrndup(/, 1); @@ -2264,7 +2294,7 @@
[PHP-DOC] cvs: pecl /phar phar_object.c /phar/tests phar_buildfromiterator9.phpt
cellog Fri Dec 14 19:45:21 2007 UTC Added files: /pecl/phar/testsphar_buildfromiterator9.phpt Modified files: /pecl/phar phar_object.c Log: Phar-buildFromIterator now can also accept a stream handle as a value in addition to a file path (string) or SplFileInfo object [DOC] http://cvs.php.net/viewvc.cgi/pecl/phar/phar_object.c?r1=1.77r2=1.78diff_format=u Index: pecl/phar/phar_object.c diff -u pecl/phar/phar_object.c:1.77 pecl/phar/phar_object.c:1.78 --- pecl/phar/phar_object.c:1.77Fri Dec 14 04:10:13 2007 +++ pecl/phar/phar_object.c Fri Dec 14 19:45:21 2007 @@ -17,7 +17,7 @@ +--+ */ -/* $Id: phar_object.c,v 1.77 2007/12/14 04:10:13 cellog Exp $ */ +/* $Id: phar_object.c,v 1.78 2007/12/14 19:45:21 cellog Exp $ */ #include phar_internal.h @@ -310,7 +310,7 @@ { zval **value; zend_uchar key_type; - zend_bool is_splfileinfo = 0; + zend_bool is_splfileinfo = 0, close_fp = 1; ulong int_key; struct _t { phar_archive_object *p; @@ -326,6 +326,7 @@ char *fname, *error, *str_key, *base = p_obj-b, *opened, *save = NULL; zend_class_entry *ce = p_obj-c; phar_archive_object *phar_obj = p_obj-p; + char *str = [stream]; iter-funcs-get_current_data(iter, value TSRMLS_CC); if (EG(exception)) { @@ -338,6 +339,30 @@ switch (Z_TYPE_PP(value)) { case IS_STRING : break; + case IS_RESOURCE : + php_stream_from_zval_no_verify(fp, value); + if (!fp) { + zend_throw_exception_ex(spl_ce_BadMethodCallException, 0 TSRMLS_CC, Iterator %s returned an invalid stream handle, ce-name); + return ZEND_HASH_APPLY_STOP; + } + if (iter-funcs-get_current_key) { + key_type = iter-funcs-get_current_key(iter, str_key, str_key_len, int_key TSRMLS_CC); + if (EG(exception)) { + return ZEND_HASH_APPLY_STOP; + } + if (key_type == HASH_KEY_IS_LONG) { + zend_throw_exception_ex(spl_ce_UnexpectedValueException, 0 TSRMLS_CC, Iterator %s returned an invalid key (must return a string), ce-name); + return ZEND_HASH_APPLY_STOP; + } + save = str_key; + if (str_key[str_key_len - 1] == '\0') str_key_len--; + } else { + zend_throw_exception_ex(spl_ce_UnexpectedValueException, 0 TSRMLS_CC, Iterator %s returned an invalid key (must return a string), ce-name); + return ZEND_HASH_APPLY_STOP; + } + close_fp = 0; + opened = (char *) estrndup(str, sizeof([stream]) + 1); + goto after_open_fp; case IS_OBJECT : if (instanceof_function(Z_OBJCE_PP(value), spl_ce_SplFileInfo TSRMLS_CC)) { char *test = NULL; @@ -443,13 +468,16 @@ return ZEND_HASH_APPLY_STOP; } +after_open_fp: if (!(data = phar_get_or_create_entry_data(phar_obj-arc.archive-fname, phar_obj-arc.archive-fname_len, str_key, str_key_len, w+b, error TSRMLS_CC))) { zend_throw_exception_ex(spl_ce_BadMethodCallException, 0 TSRMLS_CC, Entry %s cannot be created: %s, str_key, error); efree(error); if (save) { efree(save); } - php_stream_close(fp); + if (close_fp) { + php_stream_close(fp); + } return ZEND_HASH_APPLY_STOP; } else { if (error) { @@ -457,7 +485,9 @@ } contents_len = php_stream_copy_to_stream(fp, data-fp, PHP_STREAM_COPY_ALL); } - php_stream_close(fp); + if (close_fp) { + php_stream_close(fp); + } add_assoc_string(p_obj-ret, str_key, opened, 0); if (save) { http://cvs.php.net/viewvc.cgi/pecl/phar/tests/phar_buildfromiterator9.phpt?view=markuprev=1.1 Index: pecl/phar/tests/phar_buildfromiterator9.phpt +++ pecl/phar/tests/phar_buildfromiterator9.phpt --TEST-- Phar::buildFromIterator() iterator, 1 file resource passed in --SKIPIF-- ?php if (!extension_loaded(phar)) print skip; ? --INI-- phar.require_hash=0 phar.readonly=0 --FILE-- ?php class myIterator implements Iterator { var $a; function __construct(array $a) { $this-a = $a; } function
[PHP-DOC] cvs: pecl /phar TODO package.php package.xml phar.phar phar_object.c
cellog Wed Dec 12 18:01:39 2007 UTC Modified files: /pecl/phar TODO package.php package.xml phar.phar phar_object.c Log: implement Phar::buildFromIterator() first argument is an iterator that returns as values paths to files to add to the phar archive the key should be the path that the file should be saved as within the phar archive if the optional second parameter is passed, then the key is ignored and substr(value, strlen(base_directory)) is used as the save path within the phar archive [DOC] http://cvs.php.net/viewvc.cgi/pecl/phar/TODO?r1=1.44r2=1.45diff_format=u Index: pecl/phar/TODO diff -u pecl/phar/TODO:1.44 pecl/phar/TODO:1.45 --- pecl/phar/TODO:1.44 Sat Aug 25 01:32:34 2007 +++ pecl/phar/TODO Wed Dec 12 18:01:39 2007 @@ -70,8 +70,7 @@ or foreach ($p-match('mime-type', 'image/jpeg') as $file) * Phar::copy($from, $to); X Phar::delete($what) [Greg] - * Phar::buildFromIterator($filename, Iterator $it, array $addinfo = null); - $addinfo = array('alias','flags','metadata','stub'...) + X Phar::buildFromIterator(Iterator $it[, string $base_directory]) [Greg] * Layout: Option to compress all content rather than single files. That excludes stub and manifest haeder. * stream context option for cleaning crap paths like phar://blah.phar/file//to\\here.php http://cvs.php.net/viewvc.cgi/pecl/phar/package.php?r1=1.23r2=1.24diff_format=u Index: pecl/phar/package.php diff -u pecl/phar/package.php:1.23 pecl/phar/package.php:1.24 --- pecl/phar/package.php:1.23 Tue Dec 11 03:12:41 2007 +++ pecl/phar/package.php Wed Dec 12 18:01:39 2007 @@ -1,6 +1,7 @@ ?php $notes = ' + * implement Phar::buildFromIterator(Iterator $it[, string $base_directory]) [Greg] * add mapping of include/require from within a phar to location within phar [Greg] solves the include_path issue without code munging * add Phar::delete() [Greg] http://cvs.php.net/viewvc.cgi/pecl/phar/package.xml?r1=1.39r2=1.40diff_format=u Index: pecl/phar/package.xml diff -u pecl/phar/package.xml:1.39 pecl/phar/package.xml:1.40 --- pecl/phar/package.xml:1.39 Tue Nov 20 15:55:36 2007 +++ pecl/phar/package.xml Wed Dec 12 18:01:39 2007 @@ -1,5 +1,5 @@ ?xml version=1.0 encoding=UTF-8? -package packagerversion=1.6.2 version=2.0 xmlns=http://pear.php.net/dtd/package-2.0; xmlns:tasks=http://pear.php.net/dtd/tasks-1.0; xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance; xsi:schemaLocation=http://pear.php.net/dtd/tasks-1.0 http://pear.php.net/dtd/tasks-1.0.xsd http://pear.php.net/dtd/package-2.0 http://pear.php.net/dtd/package-2.0.xsd; +package packagerversion=1.7.0RC1 version=2.0 xmlns=http://pear.php.net/dtd/package-2.0; xmlns:tasks=http://pear.php.net/dtd/tasks-1.0; xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance; xsi:schemaLocation=http://pear.php.net/dtd/tasks-1.0 http://pear.php.net/dtd/tasks-1.0.xsd http://pear.php.net/dtd/package-2.0 http://pear.php.net/dtd/package-2.0.xsd; namephar/name channelpecl.php.net/channel summaryallows running of complete applications out of .phar files (like Java .jar files)/summary @@ -29,10 +29,10 @@ email[EMAIL PROTECTED]/email activeyes/active /lead - date2007-08-24/date - time20:06:43/time + date2007-12-12/date + time11:56:58/time version - release1.2.1/release + release1.3.0/release api1.1.0/api /version stability @@ -42,18 +42,10 @@ license uri=http://www.php.net/license;PHP License/license notes - * add Phar::setAlias() [Greg] - * fix too many open file handles issue [Greg] - * fix rename [Greg] - * add Phar::getAlias() [Marcus] - * Made -a optional in pack subcommand of phar.phar [Marcus] - * Fix issue with apache module and extracted archives [Marcus] - * Send all error messages to stderr in phar.phar [Marcus] - * Added new subcommands add and delete to phar.phar [Marcus] - * Made Phar::loadPhar() and Phar::mapPhar() ignore extracted archives [Marcus] - * Fix issue with compressed entries and uncompressing entries [Marcus] - * Verify stubs before writing [Marcus] - * Always use longest stub end to avoid issues with length field [Marcus] + * implement Phar::buildFromIterator(Iterator $it[, string $base_directory]) [Greg] + * add mapping of include/require from within a phar to location within phar [Greg] + solves the include_path issue without code munging + * add Phar::delete() [Greg] /notes contents @@ -66,7 +58,6 @@ file name=phar.inc role=src / file name=phar.php role=src / file name=pharcommand.inc role=src / -file name=phar.phar role=php / /dir !-- /phar -- dir name=tests file name=001.phpt role=test / @@ -113,6 +104,7 @@ file name=create_new_phar_b.phpt role=test / file name=create_new_phar_c.phpt role=test / file name=create_path_error.phpt role=test / +file name=delete.phpt role=test / file name=delete_in_phar.phpt role=test / file name=delete_in_phar_b.phpt role=test / file
[PHP-DOC] cvs: pecl /phar phar_object.c /phar/tests phar_buildfromiterator8.phpt
cellog Thu Dec 13 05:22:05 2007 UTC Added files: /pecl/phar/testsphar_buildfromiterator8.phpt Modified files: /pecl/phar phar_object.c Log: new test now, SplDirectoryIterator can be used directly with Phar-buildFromIterator() in order to populate the files in a phar archive. When combined with a RegexIterator and other filters, it becomes very easy to create a phar archive with 1 line of code [DOC] http://cvs.php.net/viewvc.cgi/pecl/phar/phar_object.c?r1=1.74r2=1.75diff_format=u Index: pecl/phar/phar_object.c diff -u pecl/phar/phar_object.c:1.74 pecl/phar/phar_object.c:1.75 --- pecl/phar/phar_object.c:1.74Thu Dec 13 01:16:55 2007 +++ pecl/phar/phar_object.c Thu Dec 13 05:22:05 2007 @@ -17,7 +17,7 @@ +--+ */ -/* $Id: phar_object.c,v 1.74 2007/12/13 01:16:55 cellog Exp $ */ +/* $Id: phar_object.c,v 1.75 2007/12/13 05:22:05 cellog Exp $ */ #include phar_internal.h @@ -310,6 +310,7 @@ { zval **value; zend_uchar key_type; + zend_bool is_splfileinfo = 0; ulong int_key; struct _t { phar_archive_object *p; @@ -318,11 +319,11 @@ uint l; zval *ret; } *p_obj = (struct _t*) puser; - uint str_key_len, base_len = p_obj-l; + uint str_key_len, base_len = p_obj-l, fname_len; phar_entry_data *data; php_stream *fp; long contents_len; - char *fname, *error, *str_key, *base = p_obj-b, *opened, *save; + char *fname, *error, *str_key, *base = p_obj-b, *opened, *save = NULL; zend_class_entry *ce = p_obj-c; phar_archive_object *phar_obj = p_obj-p; @@ -334,27 +335,70 @@ /* failure in get_current_data */ zend_throw_exception_ex(spl_ce_UnexpectedValueException, 0 TSRMLS_CC, Iterator %s returned no value, ce-name); } - if (Z_TYPE_PP(value) != IS_STRING) { - zend_throw_exception_ex(spl_ce_UnexpectedValueException, 0 TSRMLS_CC, Iterator %s returned an invalid value (must return a string), ce-name); - return ZEND_HASH_APPLY_STOP; + switch (Z_TYPE_PP(value)) { + case IS_STRING : + break; + case IS_OBJECT : + if (instanceof_function(Z_OBJCE_PP(value), spl_ce_SplFileInfo)) { + char *test; + zval dummy; + spl_filesystem_object *intern = (spl_filesystem_object*)zend_object_store_get_object(*value TSRMLS_CC); + + if (!base_len) { + zend_throw_exception_ex(spl_ce_BadMethodCallException, 0 TSRMLS_CC, Iterator %s returns an SplFileInfo object, so base directory must be specified, ce-name); + return ZEND_HASH_APPLY_STOP; + } + switch (intern-type) { + case SPL_FS_DIR: + fname_len = spprintf(fname, 0, %s%c%s, intern-path, DEFAULT_SLASH, intern-u.dir.entry.d_name); + php_stat(fname, fname_len, FS_IS_DIR, dummy TSRMLS_CC); + if (Z_BVAL(dummy)) { + /* ignore directories */ + efree(fname); + return ZEND_HASH_APPLY_KEEP; + } + test = expand_filepath(fname, test TSRMLS_CC); + if (test) { + efree(fname); + fname = test; + fname_len = strlen(fname); + } + save = fname; + is_splfileinfo = 1; + goto phar_spl_fileinfo; + case SPL_FS_INFO: + case SPL_FS_FILE: + return ZEND_HASH_APPLY_KEEP; + } + } + /* fall-through */ + default : + zend_throw_exception_ex(spl_ce_UnexpectedValueException, 0 TSRMLS_CC, Iterator %s returned an invalid value (must return a string), ce-name); + return ZEND_HASH_APPLY_STOP; } fname = Z_STRVAL_PP(value); + fname_len
[PHP-DOC] cvs: phpdoc /en/reference/phar ini.xml
cellog Thu Aug 30 03:28:24 2007 UTC Modified files: /phpdoc/en/reference/phar ini.xml Log: fix incorrect documentation on phar.extract_list http://cvs.php.net/viewvc.cgi/phpdoc/en/reference/phar/ini.xml?r1=1.4r2=1.5diff_format=u Index: phpdoc/en/reference/phar/ini.xml diff -u phpdoc/en/reference/phar/ini.xml:1.4 phpdoc/en/reference/phar/ini.xml:1.5 --- phpdoc/en/reference/phar/ini.xml:1.4Thu Aug 2 15:07:22 2007 +++ phpdoc/en/reference/phar/ini.xmlThu Aug 30 03:28:24 2007 @@ -1,5 +1,5 @@ ?xml version=1.0 encoding=iso-8859-1? -!-- $Revision: 1.4 $ -- +!-- $Revision: 1.5 $ -- section xml:id=phar.configuration xmlns=http://docbook.org/ns/docbook; reftitle.runtime; extension.runtime; @@ -101,14 +101,18 @@ /term listitem para - Allows mappings from fixed name to literalpath/to/archive.phar/literal. - The format of the parameter is literalname=archive:name2=archive2/literal. + Allows mappings from a full path to a phar archive or its alias to + the location of its extracted files. + The format of the parameter is literalname=archive,name2=archive2/literal. + This allows extraction of phar files to disk, and allows phar to act as a + kind of mapper to extracted disk files. This is often done for performance + reasons, or to assist with debugging a phar. example titlephar.extract_list usage example/title programlisting role=php ![CDATA[ in php.ini: -phar.extract_list = archive=path/to/archive1.phar:arch2=path/to/archive2.phar +phar.extract_list = archive=/full/path/to/archive/,arch2=/full/path/to/arch2 ?php include phar://archive/content.php; include phar://arch2/foo.php;
[PHP-DOC] cvs: pecl /phar TODO phar.c phar_internal.h phar_object.c
cellog Mon Mar 26 00:00:55 2007 UTC Modified files: /pecl/phar TODO phar.c phar_internal.h phar_object.c Log: [DOC] implement setSignatureAlgorithm() and add class constants Phar::MD5, Phar::SHA1, Phar::SHA256, Phar::SHA512, Phar::PGP http://cvs.php.net/viewvc.cgi/pecl/phar/TODO?r1=1.31r2=1.32diff_format=u Index: pecl/phar/TODO diff -u pecl/phar/TODO:1.31 pecl/phar/TODO:1.32 --- pecl/phar/TODO:1.31 Sun Mar 25 21:43:48 2007 +++ pecl/phar/TODO Mon Mar 26 00:00:55 2007 @@ -40,6 +40,8 @@ * [optional] Phar-rollback() to abort a write transaction * implement GPG signing X add SHA-2 (256, 512) support [Marcus] + X setSignatureAlgorithm() and Phar::MD5 Phar::SHA1 Phar::SHA256 Phar::SHA512 Phar::PGP to + choose the kind of signature to use (PGP falls back to SHA1) [Greg] * ability to match files containing a metadata key opendir('phar://a.phar/?mime-type=image/jpeg') or foreach ($p-match('mime-type', 'image/jpeg') as $file) * Phar::copy($from, $to); http://cvs.php.net/viewvc.cgi/pecl/phar/phar.c?r1=1.185r2=1.186diff_format=u Index: pecl/phar/phar.c diff -u pecl/phar/phar.c:1.185 pecl/phar/phar.c:1.186 --- pecl/phar/phar.c:1.185 Sun Mar 25 23:42:48 2007 +++ pecl/phar/phar.cMon Mar 26 00:00:55 2007 @@ -17,7 +17,7 @@ +--+ */ -/* $Id: phar.c,v 1.185 2007/03/25 23:42:48 cellog Exp $ */ +/* $Id: phar.c,v 1.186 2007/03/26 00:00:55 cellog Exp $ */ #define PHAR_MAIN #include phar_internal.h @@ -2522,9 +2522,7 @@ efree(archive-signature); } - switch(PHAR_SIG_USE) { - case PHAR_SIG_PGP: - /* TODO: currently fall back to sha1,later do both */ + switch(archive-sig_flags) { #if HAVE_HASH_EXT case PHAR_SIG_SHA512: { unsigned char digest[64]; @@ -2566,6 +2564,8 @@ } return EOF; #endif + case PHAR_SIG_PGP: + /* TODO: currently fall back to sha1,later do both */ default: case PHAR_SIG_SHA1: { unsigned char digest[20]; @@ -3376,7 +3376,7 @@ php_info_print_table_header(2, Phar: PHP Archive support, enabled); php_info_print_table_row(2, Phar EXT version, PHAR_EXT_VERSION_STR); php_info_print_table_row(2, Phar API version, PHAR_API_VERSION_STR); - php_info_print_table_row(2, CVS revision, $Revision: 1.185 $); + php_info_print_table_row(2, CVS revision, $Revision: 1.186 $); php_info_print_table_row(2, gzip compression, #if HAVE_ZLIB enabled); http://cvs.php.net/viewvc.cgi/pecl/phar/phar_internal.h?r1=1.26r2=1.27diff_format=u Index: pecl/phar/phar_internal.h diff -u pecl/phar/phar_internal.h:1.26 pecl/phar/phar_internal.h:1.27 --- pecl/phar/phar_internal.h:1.26 Sun Mar 25 21:43:48 2007 +++ pecl/phar/phar_internal.h Mon Mar 26 00:00:55 2007 @@ -17,7 +17,7 @@ +--+ */ -/* $Id: phar_internal.h,v 1.26 2007/03/25 21:43:48 helly Exp $ */ +/* $Id: phar_internal.h,v 1.27 2007/03/26 00:00:55 cellog Exp $ */ #ifdef HAVE_CONFIG_H #include config.h @@ -83,8 +83,6 @@ #define PHAR_SIG_SHA512 0x0004 #define PHAR_SIG_PGP 0x0010 -#define PHAR_SIG_USE PHAR_SIG_SHA1 - /* flags byte for each file adheres to these bitmasks. All unused values are reserved */ #define PHAR_ENT_COMPRESSION_MASK 0xF000 http://cvs.php.net/viewvc.cgi/pecl/phar/phar_object.c?r1=1.43r2=1.44diff_format=u Index: pecl/phar/phar_object.c diff -u pecl/phar/phar_object.c:1.43 pecl/phar/phar_object.c:1.44 --- pecl/phar/phar_object.c:1.43Sun Mar 25 21:43:48 2007 +++ pecl/phar/phar_object.c Mon Mar 26 00:00:55 2007 @@ -17,7 +17,7 @@ +--+ */ -/* $Id: phar_object.c,v 1.43 2007/03/25 21:43:48 helly Exp $ */ +/* $Id: phar_object.c,v 1.44 2007/03/26 00:00:55 cellog Exp $ */ #include phar_internal.h @@ -350,6 +350,51 @@ } /* }}} */ +/* {{{ proto array Phar::setSignatureAlgorithm(int sigtype) + * set the signature algorithm for a phar and apply it. The + * signature algorithm must be one of Phar::MD5, Phar::SHA1, + * Phar::SHA256 or Phar::SHA512 + */ +PHP_METHOD(Phar, setSignatureAlgorithm) +{ + long algo; + char *error; + PHAR_ARCHIVE_OBJECT(); + + if (PHAR_G(readonly)) { + zend_throw_exception_ex(spl_ce_UnexpectedValueException, 0 TSRMLS_CC, + Cannot change stub, phar is read-only); + } + + if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS() TSRMLS_CC, l, algo) != SUCCESS) { + return; + } + + switch (algo) { + case PHAR_SIG_SHA256 : +
[PHP-DOC] cvs: phpdoc /en/reference/phar/functions phar-commit.xml phar-isflushingtophar.xml phar-startbuffering.xml
cellog Thu Mar 22 17:06:13 2007 UTC Added files: /phpdoc/en/reference/phar/functions phar-startbuffering.xml Removed files: /phpdoc/en/reference/phar/functions phar-commit.xml phar-isflushingtophar.xml Log: rename begin/isFlushingToPhar/commit to startBuffering/isBuffering/stopBuffering for simpler conception http://cvs.php.net/viewvc.cgi/phpdoc/en/reference/phar/functions/phar-startbuffering.xml?view=markuprev=1.1 Index: phpdoc/en/reference/phar/functions/phar-startbuffering.xml +++ phpdoc/en/reference/phar/functions/phar-startbuffering.xml ?xml version=1.0 encoding=iso-8859-1? !-- $Revision: 1.1 $ -- refentry id=function.phar-startbuffering refnamediv refnamePhar-gt;startBuffering/refname refpurposeStart buffering Phar write operations, do not modify the Phar object on disk/refpurpose /refnamediv refsect1 role=description reftitle.description; methodsynopsis typevoid/typemethodnamePhar-gt;startBuffering/methodname void/ /methodsynopsis para Although technically unnecessary, the functionstartBuffering/function method can provide a significant performance boost when creating or modifying a Phar archive with a large number of files. Ordinarily, every time a file within a Phar archive is created or modified in any way, the entire Phar archive will be recreated with the changes. In this way, the archive will be up-to-date with the activity performed on it. /para para However, this can be unnecessary when simply creating a new Phar archive, when it would make more sense to write the entire archive out at once. Similarly, it is often necessary to make a series of changes and to ensure that they all are possible before making any changes on disk, similar to the relational database concept of transactions. the functionstartBuffering/function/functionstopBuffering/function pair of methods is provided for this purpose. /para para Phar write buffering is per-archive, buffering active for the literalfoo.phar/literal Phar archive does not affect changes to the literalbar.phar/literal Phar archive. /para /refsect1 refsect1 role=examples reftitle.examples; para example titleA functionPhar-gt;startBuffering/function example/title para /para programlisting role=php ![CDATA[ ?php // make sure it doesn't exist @unlink('brandnewphar.phar'); try { $p = new Phar(dirname(__FILE__) . '/brandnewphar.phar', 0, 'brandnewphar.phar'); } catch (Exception $e) { echo 'Could not create phar:', $e; } echo 'The new phar has ' . $p-count() . entries\n; $p-startBuffering(); $p['file.txt'] = 'hi'; $p['file2.txt'] = 'there'; $p['file2.txt']-setCompressedGZ(); $p['file3.txt'] = 'babyface'; $p['file3.txt']-setMetaData(42); $p-setStub(?php function __autoload($class) { include 'phar://myphar.phar/' . str_replace('_', '/', $class) . '.php'; } Phar::mapPhar('myphar.phar'); include 'phar://myphar.phar/startup.php'; __HALT_COMPILER();); $p-stopBuffering(); ? ]] /programlisting /example /para /refsect1 refsect1 role=seealso reftitle.seealso; para simplelist memberlink linkend=function.phar-stopbufferingfunctionPhar-gt;stopBuffering/function/link/member memberlink linkend=function.phar-isbufferingfunctionPhar-gt;isBuffering/function/link/member /simplelist /para /refsect1 /refentry !-- Keep this comment at the end of the file Local variables: mode: sgml sgml-omittag:t sgml-shorttag:t sgml-minimize-attributes:nil sgml-always-quote-attributes:t sgml-indent-step:1 sgml-indent-data:t indent-tabs-mode:nil sgml-parent-document:nil sgml-default-dtd-file:../../../../manual.ced sgml-exposed-tags:nil sgml-local-catalogs:nil sgml-local-ecat-files:nil End: vim600: syn=xml fen fdm=syntax fdl=2 si vim: et tw=78 syn=sgml vi: ts=1 sw=1 --
[PHP-DOC] cvs: phpdoc /en/reference/phar/functions phar-isbuffering.xml phar-stopbuffering.xml
cellog Thu Mar 22 17:06:38 2007 UTC Added files: /phpdoc/en/reference/phar/functions phar-isbuffering.xml phar-stopbuffering.xml Log: rename begin/isFlushingToPhar/commit to startBuffering/isBuffering/stopBuffering for simpler conception http://cvs.php.net/viewvc.cgi/phpdoc/en/reference/phar/functions/phar-isbuffering.xml?view=markuprev=1.1 Index: phpdoc/en/reference/phar/functions/phar-isbuffering.xml +++ phpdoc/en/reference/phar/functions/phar-isbuffering.xml ?xml version=1.0 encoding=iso-8859-1? !-- $Revision: 1.1 $ -- refentry id=function.phar-isbuffering refnamediv refnamePhar-gt;isBuffering/refname refpurposeUsed to determine whether Phar write operations are being buffered, or are flushing directly to disk/refpurpose /refnamediv refsect1 role=description reftitle.description; methodsynopsis typevoid/typemethodnamePhar-gt;isBuffering/methodname void/ /methodsynopsis para This method can be used to determine whether a Phar will save changes to disk immediately, or whether a call to functionPhar-gt;stopBuffering/function is needed to enable saving changes. /para para Phar write buffering is per-archive, buffering active for the literalfoo.phar/literal Phar archive does not affect changes to the literalbar.phar/literal Phar archive. /para /refsect1 refsect1 role=examples reftitle.examples; para example titleA functionPhar-gt;isBuffering/function example/title para /para programlisting role=php ![CDATA[ ?php $p = new Phar(dirname(__FILE__) . '/brandnewphar.phar', 0, 'brandnewphar.phar'); $p2 = new Phar('existingphar.phar'); $p['file1.txt'] = 'hi'; var_dump($p-isBuffering()); var_dump($p2-isBuffering()); ? =2= ?php $p-startBuffering(); var_dump($p-isBuffering()); var_dump($p2-isBuffering()); $p-stopBuffering(); ? =3= ?php var_dump($p-isBuffering()); var_dump($p2-isBuffering()); ? ]] /programlisting example.outputs; screen ![CDATA[ bool(false) bool(false) =2= bool(true) bool(false) =3= bool(false) bool(false) ]] /screen /example /para /refsect1 refsect1 role=seealso reftitle.seealso; para simplelist memberlink linkend=function.phar-startbufferingfunctionPhar-gt;startBuffering/function/link/member memberlink linkend=function.phar-stopbufferingfunctionPhar-gt;stopBuffering/function/link/member /simplelist /para /refsect1 /refentry !-- Keep this comment at the end of the file Local variables: mode: sgml sgml-omittag:t sgml-shorttag:t sgml-minimize-attributes:nil sgml-always-quote-attributes:t sgml-indent-step:1 sgml-indent-data:t indent-tabs-mode:nil sgml-parent-document:nil sgml-default-dtd-file:../../../../manual.ced sgml-exposed-tags:nil sgml-local-catalogs:nil sgml-local-ecat-files:nil End: vim600: syn=xml fen fdm=syntax fdl=2 si vim: et tw=78 syn=sgml vi: ts=1 sw=1 -- http://cvs.php.net/viewvc.cgi/phpdoc/en/reference/phar/functions/phar-stopbuffering.xml?view=markuprev=1.1 Index: phpdoc/en/reference/phar/functions/phar-stopbuffering.xml +++ phpdoc/en/reference/phar/functions/phar-stopbuffering.xml ?xml version=1.0 encoding=iso-8859-1? !-- $Revision: 1.1 $ -- refentry id=function.phar-stopbuffering refnamediv refnamePhar-gt;stopBuffering/refname refpurposeStop buffering write requests to the Phar archive, and save changes to disk/refpurpose /refnamediv refsect1 role=description reftitle.description; methodsynopsis typevoid/typemethodnamePhar-gt;stopBuffering/methodname void/ /methodsynopsis para functionstopBuffering/function is used in conjunction with the functionstartBuffering/function method. functionstartBuffering/function can provide a significant performance boost when creating or modifying a Phar archive with a large number of files. Ordinarily, every time a file within a Phar archive is created or modified in any way, the entire Phar archive will be recreated with the changes. In this way, the archive will be up-to-date with the activity performed on it. /para para However, this can be unnecessary when simply creating a new Phar archive, when it would make more sense to write the entire archive out at once. Similarly, it is often necessary to make a series of changes and to ensure that they all are possible before making any changes on disk, similar to the relational database concept of transactions. The functionstartBuffering/function/functionstopBuffering/function pair of methods is provided for this purpose. /para para Phar write buffering is per-archive, buffering active for the literalfoo.phar/literal Phar archive does not affect changes to the literalbar.phar/literal Phar archive. /para /refsect1 refsect1 role=errors reftitle.errors; para classnamePharException/classname is thrown if any problems are encountered flushing changes to disk. /para /refsect1 refsect1 role=examples
[PHP-DOC] cvs: phpdoc /en/reference/phar/functions phar-begin.xml
cellog Thu Mar 22 17:09:57 2007 UTC Removed files: /phpdoc/en/reference/phar/functions phar-begin.xml Log: rename begin/isFlushingToPhar/commit to startBuffering/isBuffering/stopBuffering for simpler conception
[PHP-DOC] cvs: phpdoc /en/language operators.xml
cellog Fri Feb 16 05:39:30 2007 UTC Modified files: /phpdoc/en/language operators.xml Log: improve instanceof docs add explicit PHP examples for each kind of usage, plus note about how to use it with dynamic class references http://cvs.php.net/viewvc.cgi/phpdoc/en/language/operators.xml?r1=1.110r2=1.111diff_format=u Index: phpdoc/en/language/operators.xml diff -u phpdoc/en/language/operators.xml:1.110 phpdoc/en/language/operators.xml:1.111 --- phpdoc/en/language/operators.xml:1.110 Thu Feb 15 08:12:19 2007 +++ phpdoc/en/language/operators.xmlFri Feb 16 05:39:30 2007 @@ -1,5 +1,5 @@ ?xml version=1.0 encoding=iso-8859-1? -!-- $Revision: 1.110 $ -- +!-- $Revision: 1.111 $ -- chapter id=language.operators titleOperators/title simpara @@ -1157,41 +1157,157 @@ sect1 id=language.operators.type titleType Operators/title para -PHP has a single type operator: literalinstanceof/literal is used to -determine whether a given object, his parents or their implemented link -linkend=language.oop5.interfacesinterfaces/link are of a specified -link linkend=language.oop5.basic.classobject class/link. - /para - simpara -The literalinstanceof/literal operator was introduced in PHP 5. -Before this time functionis_a/function was used but -functionis_a/function has since been deprecated in favor of -literalinstanceof/literal. - /simpara - informalexample -programlisting role=php +literalinstanceof/literal is used to determine whether a PHP variable +is an instantiated object of a certain +link linkend=language.oop5.basic.classclass/link: +example + titleUsing instanceof with classes/title + programlisting role=php + ![CDATA[ +?php +class MyClass +{ +} +class NotMyClass +{ +} +$a = new MyClass; + +var_dump($a instanceof MyClass); +var_dump($a instanceof NotMyClass); +? + ]] +/programlisting +example.outputs; +screen ![CDATA[ +bool(true) +bool(false) +]] + /screen +/example +literalinstanceof/literal can also be used to determine whether a variable +is an instantiated object of a class that inherits from a parent class: +example + titleUsing instanceof with inherited classes/title + programlisting role=php + ![CDATA[ ?php -class A { } -class B { } +class ParentClass +{ +} +class MyClass extends ParentClass +{ +} +$a = new MyClass; -$thing = new A; +var_dump($a instanceof MyClass); +var_dump($a instanceof ParentClass); +? + ]] +/programlisting +example.outputs; +screen +![CDATA[ +bool(true) +bool(true) +]] + /screen +/example +Lastly, literalinstanceof/literal can also be used to determine whether +a variable is an instantiated object of a class that implements an +link linkend=language.oop5.interfacesinterface/link: +example + titleUsing instanceof for class/title + programlisting role=php + ![CDATA[ +?php +interface MyInterface +{ +} +class MyClass implements MyInterface +{ +} +$a = new MyClass; -if ($thing instanceof A) { -echo 'A'; +var_dump($a instanceof MyClass); +var_dump($a instanceof MyInterface); +? + ]] +/programlisting +example.outputs; +screen +![CDATA[ +bool(true) +bool(true) +]] + /screen +/example + /para + para +Although literalinstanceof/literal is usually used with a literal classname, +it can also be used with another object or a string variable: +example + titleUsing instanceof with other variables/title + programlisting role=php + ![CDATA[ +?php +interface MyInterface +{ } -if ($thing instanceof B) { -echo 'B'; +class MyClass implements MyInterface +{ } +$a = new MyClass; +$b = new MyClass; +$c = 'MyClass'; +$d = 'NotMyClass'; +var_dump($a instanceof $b); // $b is an object of class MyClass +var_dump($a instanceof $c); // $c is a string 'MyClass' +var_dump($a instanceof $d); // $d is a string 'NotMyClass' ? + ]] +/programlisting +example.outputs; +screen +![CDATA[ +bool(true) +bool(true) +bool(false) ]] + /screen +/example + /para + para +There are a few pitfalls to be aware of. Before PHP version 5.1.0, +literalinstanceof/literal would call link linkend=language.oop5.autoload__autoload()/link +if the class name did not exist. In addition, if the class was not loaded, +a fatal error would occur. This can be worked around by using a literaldynamic +class reference/literal, or a string variable containing the class name: +example + titleAvoiding classname lookups and fatal errors with instanceof in PHP 5.0/title + programlisting role=php + ![CDATA[ +?php +$d = 'NotMyClass'; +var_dump($a instanceof $d); // no fatal error here +? + ]] /programlisting -simpara - As varname$thing/varname is an typeobject/type of type A, but - not B, only the block dependent on the A type will be executed: -/simpara -
[PHP-DOC] cvs: phpdoc /en/reference/phar/functions phar-cancompress.xml
cellog Wed Feb 7 00:39:13 2007 UTC Modified files: /phpdoc/en/reference/phar/functions phar-cancompress.xml Log: update params for pending release http://cvs.php.net/viewvc.cgi/phpdoc/en/reference/phar/functions/phar-cancompress.xml?r1=1.2r2=1.3diff_format=u Index: phpdoc/en/reference/phar/functions/phar-cancompress.xml diff -u phpdoc/en/reference/phar/functions/phar-cancompress.xml:1.2 phpdoc/en/reference/phar/functions/phar-cancompress.xml:1.3 --- phpdoc/en/reference/phar/functions/phar-cancompress.xml:1.2 Tue Feb 6 05:46:41 2007 +++ phpdoc/en/reference/phar/functions/phar-cancompress.xml Wed Feb 7 00:39:13 2007 @@ -1,5 +1,5 @@ ?xml version=1.0 encoding=iso-8859-1? -!-- $Revision: 1.2 $ -- +!-- $Revision: 1.3 $ -- refentry id=function.phar-cancompress refnamediv refnamePhar::canCompress/refname @@ -9,18 +9,30 @@ reftitle.description; methodsynopsis typebool/typemethodnamePhar::canCompress/methodname - void/ + methodparam choice=opttypeint/typeparametertype/parameter/methodparam /methodsynopsis para This should be used to test whether compression is possible prior to loading a phar archive containing compressed files. /para - /refsect1 + refsect1 role=parameters reftitle.parameters; para + variablelist +varlistentry + termparametertype/parameter/term + listitem + para + Either literalPhar::GZ/literal or literalPhar::BZ2/literal can be + used to test whether compression is possible with a specific compression + algorithm (zlib or bzip2). + /para + /listitem +/varlistentry + /variablelist /para /refsect1 refsect1 role=returnvalues
[PHP-DOC] cvs: phpdoc /en/reference/phar reference.xml /en/reference/phar/functions Phar-apiVersion.xml Phar-begin.xml Phar-canCompress.xml Phar-canWrite.xml Phar-commit.xml Phar-compressAllFilesBZIP
cellog Sat Feb 3 04:03:09 2007 UTC Added files: /phpdoc/en/reference/phar/functions Phar-apiVersion.xml Phar-canCompress.xml Phar-canWrite.xml Phar-isFlushingToPhar.xml Phar-setStub.xml Removed files: /phpdoc/en/reference/phar/functions apiVersion.xml canCompress.xml canWrite.xml Modified files: /phpdoc/en/reference/phar reference.xml /phpdoc/en/reference/phar/functions Phar-begin.xml Phar-commit.xml Phar-compressAllFilesBZIP2.xml Phar-compressAllFilesGZ.xml Phar-count.xml Phar-getMetaData.xml Phar-getStub.xml Phar-loadPhar.xml Phar-mapPhar.xml Phar-offsetExists.xml Phar-offsetGet.xml Phar-offsetSet.xml Phar-offsetUnset.xml Phar-setMetaData.xml Phar-uncompressAllFiles.xml PharFileInfo-getCRC32.xml PharFileInfo-getCompressedSize.xml PharFileInfo-getMetaData.xml PharFileInfo-getPharFlags.xml PharFileInfo-isCRCChecked.xml PharFileInfo-isCompressed.xml PharFileInfo-isCompressedBZIP2.xml PharFileInfo-isCompressedGZ.xml PharFileInfo-setCompressedBZIP2.xml PharFileInfo-setCompressedGZ.xml PharFileInfo-setMetaData.xml PharFileInfo-setUncompressed.xml Log: update docs to current CVS, fix a few mistakes discovered encourage best practices in the examples for Phar objects. These will match the first release of the phar extension, to occur this week some time, so any cleaning that needs to be done can be done now. http://cvs.php.net/viewvc.cgi/phpdoc/en/reference/phar/reference.xml?r1=1.4r2=1.5diff_format=u Index: phpdoc/en/reference/phar/reference.xml diff -u phpdoc/en/reference/phar/reference.xml:1.4 phpdoc/en/reference/phar/reference.xml:1.5 --- phpdoc/en/reference/phar/reference.xml:1.4 Sun Jan 28 21:45:44 2007 +++ phpdoc/en/reference/phar/reference.xml Sat Feb 3 04:03:09 2007 @@ -1,5 +1,5 @@ ?xml version = '1.0' encoding = 'iso-8859-1'? -!-- $Revision: 1.4 $ -- +!-- $Revision: 1.5 $ -- !-- Purpose: -- !-- Membership: pecl -- reference id=ref.phar @@ -72,6 +72,9 @@ member classnamePharFileInfo/classname /member + member + classnamePharException/classname + /member /simplelist /section reference.phar.using; http://cvs.php.net/viewvc.cgi/phpdoc/en/reference/phar/functions/Phar-begin.xml?r1=1.2r2=1.3diff_format=u Index: phpdoc/en/reference/phar/functions/Phar-begin.xml diff -u phpdoc/en/reference/phar/functions/Phar-begin.xml:1.2 phpdoc/en/reference/phar/functions/Phar-begin.xml:1.3 --- phpdoc/en/reference/phar/functions/Phar-begin.xml:1.2 Sun Jan 28 21:52:56 2007 +++ phpdoc/en/reference/phar/functions/Phar-begin.xml Sat Feb 3 04:03:09 2007 @@ -1,5 +1,5 @@ ?xml version=1.0 encoding=iso-8859-1? -!-- $Revision: 1.2 $ -- +!-- $Revision: 1.3 $ -- refentry id=function.Phar-begin refnamediv refnamePhar-gt;begin/refname @@ -50,7 +50,7 @@ // make sure it doesn't exist @unlink('brandnewphar.phar'); try { -$p = new Phar('brandnewphar.phar'); +$p = new Phar(dirname(__FILE__) . '/brandnewphar.phar', 0, 'brandnewphar.phar'); } catch (Exception $e) { echo 'Could not create phar:', $e; } @@ -61,7 +61,7 @@ $p['file2.txt']-setCompressedGZ(); $p['file3.txt'] = 'babyface'; $p['file3.txt']-setMetaData(42); -$p-commit(?php +$p-setStub(?php function __autoload($class) { include 'phar://' . str_replace('_', '/', $class); @@ -69,6 +69,7 @@ Phar::mapPhar('myphar.phar'); include 'phar://myphar.phar/startup.php'; __HALT_COMPILER();); +$p-commit(); ? ]] /programlisting http://cvs.php.net/viewvc.cgi/phpdoc/en/reference/phar/functions/Phar-commit.xml?r1=1.2r2=1.3diff_format=u Index: phpdoc/en/reference/phar/functions/Phar-commit.xml diff -u phpdoc/en/reference/phar/functions/Phar-commit.xml:1.2
[PHP-DOC] cvs: phpdoc /en/reference/phar/functions PharFileInfo-isCRCChecked.xml
cellog Sat Feb 3 04:10:00 2007 UTC Modified files: /phpdoc/en/reference/phar/functions PharFileInfo-isCRCChecked.xml Log: consistency - use - for all non-static methods http://cvs.php.net/viewvc.cgi/phpdoc/en/reference/phar/functions/PharFileInfo-isCRCChecked.xml?r1=1.3r2=1.4diff_format=u Index: phpdoc/en/reference/phar/functions/PharFileInfo-isCRCChecked.xml diff -u phpdoc/en/reference/phar/functions/PharFileInfo-isCRCChecked.xml:1.3 phpdoc/en/reference/phar/functions/PharFileInfo-isCRCChecked.xml:1.4 --- phpdoc/en/reference/phar/functions/PharFileInfo-isCRCChecked.xml:1.3 Sat Feb 3 04:03:09 2007 +++ phpdoc/en/reference/phar/functions/PharFileInfo-isCRCChecked.xmlSat Feb 3 04:10:00 2007 @@ -1,14 +1,14 @@ ?xml version=1.0 encoding=iso-8859-1? -!-- $Revision: 1.3 $ -- +!-- $Revision: 1.4 $ -- refentry id=function.PharFileInfo-isCRCChecked refnamediv - refnamePharFileInfo::isCRCChecked/refname + refnamePharFileInfo-gt;isCRCChecked/refname refpurposeReturns whether file entry has had its CRC verified/refpurpose /refnamediv refsect1 role=description reftitle.description; methodsynopsis - typebool/typemethodnamePharFileInfo::isCRCChecked/methodname + typebool/typemethodnamePharFileInfo-gt;isCRCChecked/methodname void/ /methodsynopsis
[PHP-DOC] cvs: phpdoc /en/reference/phar/functions Phar-construct.xml
cellog Sat Feb 3 04:16:13 2007 UTC Modified files: /phpdoc/en/reference/phar/functions Phar-construct.xml Log: remove weird irrelevant trailing clause http://cvs.php.net/viewvc.cgi/phpdoc/en/reference/phar/functions/Phar-construct.xml?r1=1.1r2=1.2diff_format=u Index: phpdoc/en/reference/phar/functions/Phar-construct.xml diff -u phpdoc/en/reference/phar/functions/Phar-construct.xml:1.1 phpdoc/en/reference/phar/functions/Phar-construct.xml:1.2 --- phpdoc/en/reference/phar/functions/Phar-construct.xml:1.1 Thu Jan 18 00:24:34 2007 +++ phpdoc/en/reference/phar/functions/Phar-construct.xml Sat Feb 3 04:16:12 2007 @@ -1,5 +1,5 @@ ?xml version=1.0 encoding=iso-8859-1? -!-- $Revision: 1.1 $ -- +!-- $Revision: 1.2 $ -- refentry id=function.Phar-construct refnamediv refnamePhar::__construct/refname @@ -23,9 +23,7 @@ termparameterfname/parameter/term listitem para - Path to an existing Phar archive, or if the - link linkend=ini.phar.readonlyphar.readonly/link INI - variable is set to quot;0quot;, + Path to an existing Phar archive /para /listitem /varlistentry
[PHP-DOC] cvs: phpdoc /en/reference/phar/functions Phar-begin.xml Phar-beginWrite.xml Phar-commit.xml Phar-commitWrite.xml Phar-compressAllFilesBZIP2.xml Phar-compressAllFilesGZ.xml Phar-getStub.xml P
cellog Sun Jan 28 20:08:52 2007 UTC Added files: /phpdoc/en/reference/phar/functions Phar-begin.xml Phar-commit.xml Phar-compressAllFilesBZIP2.xml Phar-compressAllFilesGZ.xml Phar-uncompressAllFiles.xml Removed files: /phpdoc/en/reference/phar/functions Phar-beginWrite.xml Phar-commitWrite.xml Modified files: /phpdoc/en/reference/phar/functions Phar-getStub.xml PharFileInfo-setCompressedBZIP2.xml PharFileInfo-setCompressedGZ.xml PharFileInfo-setUncompressed.xml Log: update docs to current cvs http://cvs.php.net/viewvc.cgi/phpdoc/en/reference/phar/functions/Phar-getStub.xml?r1=1.1r2=1.2diff_format=u Index: phpdoc/en/reference/phar/functions/Phar-getStub.xml diff -u phpdoc/en/reference/phar/functions/Phar-getStub.xml:1.1 phpdoc/en/reference/phar/functions/Phar-getStub.xml:1.2 --- phpdoc/en/reference/phar/functions/Phar-getStub.xml:1.1 Sun Jan 28 05:31:52 2007 +++ phpdoc/en/reference/phar/functions/Phar-getStub.xml Sun Jan 28 20:08:52 2007 @@ -1,5 +1,5 @@ ?xml version=1.0 encoding=iso-8859-1? -!-- $Revision: 1.1 $ -- +!-- $Revision: 1.2 $ -- refentry id=function.Phar-getStub refnamediv refnamePhar-gt;getStub/refname @@ -81,8 +81,8 @@ reftitle.seealso; para simplelist -memberlink linkend=function.Phar-commitWritefunctionPhar-gt;commitWrite/function/link/member -memberlink linkend=function.Phar-beginWritefunctionPhar-gt;beginWrite/function/link/member +memberlink linkend=function.Phar-commitfunctionPhar-gt;commit/function/link/member +memberlink linkend=function.Phar-beginfunctionPhar-gt;begin/function/link/member /simplelist /para /refsect1 http://cvs.php.net/viewvc.cgi/phpdoc/en/reference/phar/functions/PharFileInfo-setCompressedBZIP2.xml?r1=1.1r2=1.2diff_format=u Index: phpdoc/en/reference/phar/functions/PharFileInfo-setCompressedBZIP2.xml diff -u phpdoc/en/reference/phar/functions/PharFileInfo-setCompressedBZIP2.xml:1.1 phpdoc/en/reference/phar/functions/PharFileInfo-setCompressedBZIP2.xml:1.2 --- phpdoc/en/reference/phar/functions/PharFileInfo-setCompressedBZIP2.xml:1.1 Sun Jan 28 05:31:52 2007 +++ phpdoc/en/reference/phar/functions/PharFileInfo-setCompressedBZIP2.xml Sun Jan 28 20:08:52 2007 @@ -1,5 +1,5 @@ ?xml version=1.0 encoding=iso-8859-1? -!-- $Revision: 1.1 $ -- +!-- $Revision: 1.2 $ -- refentry id=function.PharFileInfo-setCompressedBZIP2 refnamediv refnamePharFileInfo-gt;setCompressedBZIP2/refname @@ -17,7 +17,7 @@ The link linkend=ref.bzip2bzip2/link extension must be enabled to take advantage of this feature. In addition, if the file is already compressed using gzip compression, the link linkend=ref.zlibzlib/link extension must be enabled in order - to decompress the file As with all functionality that modifies the contents of + to decompress the file. As with all functionality that modifies the contents of a phar, the link linkend=ini.phar.readonlyphar.readonly/link INI variable must be off in order to succeed. /para @@ -70,6 +70,7 @@ memberlink linkend=function.PharFileInfo-isCompressedfunctionPharFileInfo-gt;isCompressed/function/link/member memberlink linkend=function.PharFileInfo-setCompressedGZfunctionPharFileInfo-gt;isCompressedGZ/function/link/member memberlink linkend=function.PharFileInfo-setUncompressedfunctionPharFileInfo-gt;isCompressed/function/link/member +memberlink linkend=function.Phar-compressAllFilesBZIP2functionPhar-gt;compressAllFilesBZIP2/function/link/member /simplelist /para /refsect1 http://cvs.php.net/viewvc.cgi/phpdoc/en/reference/phar/functions/PharFileInfo-setCompressedGZ.xml?r1=1.1r2=1.2diff_format=u Index: phpdoc/en/reference/phar/functions/PharFileInfo-setCompressedGZ.xml diff -u phpdoc/en/reference/phar/functions/PharFileInfo-setCompressedGZ.xml:1.1 phpdoc/en/reference/phar/functions/PharFileInfo-setCompressedGZ.xml:1.2 --- phpdoc/en/reference/phar/functions/PharFileInfo-setCompressedGZ.xml:1.1 Sun Jan 28 05:31:52 2007 +++ phpdoc/en/reference/phar/functions/PharFileInfo-setCompressedGZ.xml Sun Jan 28 20:08:52 2007 @@ -1,5 +1,5 @@ ?xml version=1.0 encoding=iso-8859-1? -!-- $Revision: 1.1 $ -- +!-- $Revision: 1.2 $ -- refentry id=function.PharFileInfo-setCompressedGZ refnamediv refnamePharFileInfo-gt;setCompressedGZ/refname @@ -70,6 +70,7 @@ memberlink linkend=function.PharFileInfo-isCompressedfunctionPharFileInfo-gt;isCompressed/function/link/member memberlink linkend=function.PharFileInfo-setCompressedBZIP2functionPharFileInfo-gt;isCompressedBZIP2/function/link/member memberlink
[PHP-DOC] cvs: phpdoc /en/reference/phar reference.xml using.xml /en/reference/phar/functions Phar-getMetaData.xml Phar-setMetaData.xml
cellog Sun Jan 28 21:45:44 2007 UTC Added files: /phpdoc/en/reference/phar using.xml /phpdoc/en/reference/phar/functions Phar-getMetaData.xml Phar-setMetaData.xml Modified files: /phpdoc/en/reference/phar reference.xml Log: docs are complete now for phar http://cvs.php.net/viewvc.cgi/phpdoc/en/reference/phar/reference.xml?r1=1.3r2=1.4diff_format=u Index: phpdoc/en/reference/phar/reference.xml diff -u phpdoc/en/reference/phar/reference.xml:1.3 phpdoc/en/reference/phar/reference.xml:1.4 --- phpdoc/en/reference/phar/reference.xml:1.3 Sun Jan 28 05:31:51 2007 +++ phpdoc/en/reference/phar/reference.xml Sun Jan 28 21:45:44 2007 @@ -1,5 +1,5 @@ ?xml version = '1.0' encoding = 'iso-8859-1'? -!-- $Revision: 1.3 $ -- +!-- $Revision: 1.4 $ -- !-- Purpose: -- !-- Membership: pecl -- reference id=ref.phar @@ -74,6 +74,7 @@ /member /simplelist /section + reference.phar.using; reference.phar.fileformat; /partintro reference.phar.functions; http://cvs.php.net/viewvc.cgi/phpdoc/en/reference/phar/using.xml?view=markuprev=1.1 Index: phpdoc/en/reference/phar/using.xml +++ phpdoc/en/reference/phar/using.xml ?xml version=1.0 encoding=iso-8859-1? !-- $Revision: 1.1 $ -- section id=phar.using.basics titleUsing Phar Archives: Introduction/title para Phar archives are similar in concept to Java JAR archives, but are tailored to the needs and to the flexibility of PHP applications. A Phar archive is used to distribute a complete PHP application or library in a single file. Unlike Java's implementation of JAR archives, no external tool is required to process or run a PHP Phar archive. A Phar archive application is processed exactly like any other PHP application: /para screen ![CDATA[ php coolapplication.phar ]] /screen para Using a Phar archive library is identical to using any other PHP library: /para programlisting role=php ![CDATA[ ?php include 'coollibrary.phar'; ? ]] /programlisting para What makes Phar archives incredibly useful is the literalphar/literal stream wrapper, which is explained in depth link linkend=phar.using.streamhere/link. Using this stream wrapper, it is possible to access individual files within a phar as if the phar were its own filesystem. The literalphar/literal stream wrapper supports all read/write operations on files, and functionopendir/function on directories. /para programlisting role=php ![CDATA[ ?php include 'phar://coollibrary.phar/internal/file.php'; header('Content-type: image/jpeg'); // phars can be accessed by full path or by alias echo file_get_contents('phar:///fullpath/to/coollibrary.phar/images/wow.jpg'); ? ]] /programlisting para Also provided with the Phar extension is the classnamePhar/classname class, which allows accessing the files of the Phar archive as if it were an associative array, and other functionality. The Phar class is explained link linkend=phar.using.objecthere/link. /para programlisting role=php ![CDATA[ ?php try { // open an existing phar $p = new Phar('coollibrary.phar'); foreach ($p as $file) { // $file is a PharFileInfo class, and inherits from SplFileInfo echo $file-getFileName() . \n; echo $file . \n; // display contents; } if (isset($p['internal/file.php'])) { var_dump($p['internal/file.php']-getMetaData()); } // create a new phar - phar.readonly must be 0 in php.ini // phar.readonly is enabled by default for security reasons. // On production servers, Phars need never be created, // only executed. if (Phar::canWrite()) { $p = new Phar(dirname(__FILE__) . '/newphar.phar', 0, 'newphar.phar'); // create transaction - nothing is written to disk until commit() is called $p-begin(); // add a new file, set its contents $p['file1.txt'] = 'Information'; $fp = fopen('hugefile.dat', 'rb'); // copy from the stream $p['data/hugefile.dat'] = $fp; if (Phar::canCompress()) { $p['data/hugefile.dat']-setCompressedGZ(); } $p['images/wow.jpg'] = file_get_contents('images/wow.jpg'); // any value can be saved as file-specific meta-data $p['images/wow.jpg']-setMetaData(array('mime-type' = 'image/jpeg')); $p['index.php'] = file_get_contents('index.php'); $p-setMetaData(array('bootstrap' = 'index.php')); // save the Phar, and set the loader stub $p-commit('?php $p = new Phar(__FILE__); $m = $p-getMetaData(); require phar:// . __FILE__ . / . $m[bootstrap]; __HALT_COMPILER();'); } } catch (BadMethodCallException $e) { echo 'Could not open Phar: ', $e; } ? ]] /programlisting /section section id=phar.using.stream titleUsing Phar Archives: the phar stream wrapper/title para The Phar stream wrapper fully supports functionfopen/function for
[PHP-DOC] cvs: phpdoc /en/reference/phar fileformat.xml /en/reference/phar/functions Phar-begin.xml Phar-commit.xml Phar-getStub.xml Phar-mapPhar.xml
cellog Sun Jan 28 21:52:56 2007 UTC Modified files: /phpdoc/en/reference/phar fileformat.xml /phpdoc/en/reference/phar/functions Phar-begin.xml Phar-commit.xml Phar-getStub.xml Phar-mapPhar.xml Log: don't encourage \ ?\ after __HALT_COMPILER(); http://cvs.php.net/viewvc.cgi/phpdoc/en/reference/phar/fileformat.xml?r1=1.2r2=1.3diff_format=u Index: phpdoc/en/reference/phar/fileformat.xml diff -u phpdoc/en/reference/phar/fileformat.xml:1.2 phpdoc/en/reference/phar/fileformat.xml:1.3 --- phpdoc/en/reference/phar/fileformat.xml:1.2 Fri Jan 26 20:59:14 2007 +++ phpdoc/en/reference/phar/fileformat.xml Sun Jan 28 21:52:55 2007 @@ -1,5 +1,5 @@ ?xml version=1.0 encoding=iso-8859-1? -!-- $Revision: 1.2 $ -- +!-- $Revision: 1.3 $ -- section id=phar.fileformat titlePhar file format/title para @@ -42,7 +42,6 @@ Phar::mapPhar(); include 'phar://myphar.phar/index.php'; __HALT_COMPILER(); -? ]] /programlisting /para http://cvs.php.net/viewvc.cgi/phpdoc/en/reference/phar/functions/Phar-begin.xml?r1=1.1r2=1.2diff_format=u Index: phpdoc/en/reference/phar/functions/Phar-begin.xml diff -u phpdoc/en/reference/phar/functions/Phar-begin.xml:1.1 phpdoc/en/reference/phar/functions/Phar-begin.xml:1.2 --- phpdoc/en/reference/phar/functions/Phar-begin.xml:1.1 Sun Jan 28 20:08:52 2007 +++ phpdoc/en/reference/phar/functions/Phar-begin.xml Sun Jan 28 21:52:56 2007 @@ -1,5 +1,5 @@ ?xml version=1.0 encoding=iso-8859-1? -!-- $Revision: 1.1 $ -- +!-- $Revision: 1.2 $ -- refentry id=function.Phar-begin refnamediv refnamePhar-gt;begin/refname @@ -68,8 +68,7 @@ } Phar::mapPhar('myphar.phar'); include 'phar://myphar.phar/startup.php'; -__HALT_COMPILER(); -?); +__HALT_COMPILER();); ? ]] /programlisting http://cvs.php.net/viewvc.cgi/phpdoc/en/reference/phar/functions/Phar-commit.xml?r1=1.1r2=1.2diff_format=u Index: phpdoc/en/reference/phar/functions/Phar-commit.xml diff -u phpdoc/en/reference/phar/functions/Phar-commit.xml:1.1 phpdoc/en/reference/phar/functions/Phar-commit.xml:1.2 --- phpdoc/en/reference/phar/functions/Phar-commit.xml:1.1 Sun Jan 28 20:08:52 2007 +++ phpdoc/en/reference/phar/functions/Phar-commit.xml Sun Jan 28 21:52:56 2007 @@ -1,5 +1,5 @@ ?xml version=1.0 encoding=iso-8859-1? -!-- $Revision: 1.1 $ -- +!-- $Revision: 1.2 $ -- refentry id=function.Phar-commit refnamediv refnamePhar-gt;commit/refname @@ -58,8 +58,7 @@ } Phar::mapPhar('brandnewphar.phar'); include 'phar://brandnewphar.phar/startup.php'; -__HALT_COMPILER(); -?); +__HALT_COMPILER();); var_dump($p-getStub()); ? ]] @@ -68,15 +67,14 @@ screen ![CDATA[ string(24) ?php __HALT_COMPILER(); -string(198) ?php +string(195) ?php function __autoload($class) { include 'phar://' . str_replace('_', '/', $class); } Phar::mapPhar('brandnewphar.phar'); include 'phar://brandnewphar.phar/startup.php'; -__HALT_COMPILER(); -? +__HALT_COMPILER(); ]] /screen /example http://cvs.php.net/viewvc.cgi/phpdoc/en/reference/phar/functions/Phar-getStub.xml?r1=1.2r2=1.3diff_format=u Index: phpdoc/en/reference/phar/functions/Phar-getStub.xml diff -u phpdoc/en/reference/phar/functions/Phar-getStub.xml:1.2 phpdoc/en/reference/phar/functions/Phar-getStub.xml:1.3 --- phpdoc/en/reference/phar/functions/Phar-getStub.xml:1.2 Sun Jan 28 20:08:52 2007 +++ phpdoc/en/reference/phar/functions/Phar-getStub.xml Sun Jan 28 21:52:56 2007 @@ -1,5 +1,5 @@ ?xml version=1.0 encoding=iso-8859-1? -!-- $Revision: 1.2 $ -- +!-- $Revision: 1.3 $ -- refentry id=function.Phar-getStub refnamediv refnamePhar-gt;getStub/refname @@ -52,8 +52,7 @@ } Phar::mapPhar('myphar.phar'); include 'phar://myphar.phar/startup.php'; -__HALT_COMPILER(); -?); +__HALT_COMPILER();); echo $p-getStub(); ]] /programlisting @@ -70,7 +69,6 @@ Phar::mapPhar('myphar.phar'); include 'phar://myphar.phar/startup.php'; __HALT_COMPILER(); -? ]] /screen /example http://cvs.php.net/viewvc.cgi/phpdoc/en/reference/phar/functions/Phar-mapPhar.xml?r1=1.3r2=1.4diff_format=u Index: phpdoc/en/reference/phar/functions/Phar-mapPhar.xml diff -u phpdoc/en/reference/phar/functions/Phar-mapPhar.xml:1.3 phpdoc/en/reference/phar/functions/Phar-mapPhar.xml:1.4 --- phpdoc/en/reference/phar/functions/Phar-mapPhar.xml:1.3 Thu Jan 18 08:49:59 2007 +++ phpdoc/en/reference/phar/functions/Phar-mapPhar.xml Sun Jan 28 21:52:56 2007 @@ -1,5 +1,5 @@ ?xml version=1.0 encoding=iso-8859-1? -!-- $Revision: 1.3 $ -- +!-- $Revision: 1.4 $ -- refentry id=function.Phar-mapPhar refnamediv refnamePhar::mapPhar/refname @@ -71,7 +71,6 @@ Phar::mapPhar('me.phar'); include 'phar://me.phar/startup.php'; __HALT_COMPILER(); -? ]] /programlisting /example
[PHP-DOC] cvs: phpdoc /en/reference/phar fileformat.xml
cellog Mon Jan 29 03:17:36 2007 UTC Modified files: /phpdoc/en/reference/phar fileformat.xml Log: update to include Phar metadata http://cvs.php.net/viewvc.cgi/phpdoc/en/reference/phar/fileformat.xml?r1=1.3r2=1.4diff_format=u Index: phpdoc/en/reference/phar/fileformat.xml diff -u phpdoc/en/reference/phar/fileformat.xml:1.3 phpdoc/en/reference/phar/fileformat.xml:1.4 --- phpdoc/en/reference/phar/fileformat.xml:1.3 Sun Jan 28 21:52:55 2007 +++ phpdoc/en/reference/phar/fileformat.xml Mon Jan 29 03:17:36 2007 @@ -1,5 +1,5 @@ ?xml version=1.0 encoding=iso-8859-1? -!-- $Revision: 1.3 $ -- +!-- $Revision: 1.4 $ -- section id=phar.fileformat titlePhar file format/title para @@ -107,6 +107,14 @@ entryPhar alias (length based on previous)/entry /row row + entry4 bytes/entry + entryLength of Phar metadata (literal0/literal for none)/entry +/row +row + entry??/entry + entrySerialized Phar Meta-data, stored in functionserialize/function format/entry +/row +row entryat least 24 * number of entries bytes/entry entryentries for each file/entry /row @@ -201,11 +209,11 @@ /row row entry4 bytes/entry - entrySerialized Meta-data length (0 for none)/entry + entrySerialized File Meta-data length (literal0/literal for none)/entry /row row entry??/entry - entrySerialized Meta-data, stored in functionserialize/function format/entry + entrySerialized File Meta-data, stored in functionserialize/function format/entry /row /tbody /tgroup
[PHP-DOC] cvs: phpdoc /en/reference/phar/functions Phar-commitWrite.xml
cellog Sun Jan 28 05:36:47 2007 UTC Modified files: /phpdoc/en/reference/phar/functions Phar-commitWrite.xml Log: fix doc example http://cvs.php.net/viewvc.cgi/phpdoc/en/reference/phar/functions/Phar-commitWrite.xml?r1=1.1r2=1.2diff_format=u Index: phpdoc/en/reference/phar/functions/Phar-commitWrite.xml diff -u phpdoc/en/reference/phar/functions/Phar-commitWrite.xml:1.1 phpdoc/en/reference/phar/functions/Phar-commitWrite.xml:1.2 --- phpdoc/en/reference/phar/functions/Phar-commitWrite.xml:1.1 Sun Jan 28 05:31:52 2007 +++ phpdoc/en/reference/phar/functions/Phar-commitWrite.xml Sun Jan 28 05:36:47 2007 @@ -1,5 +1,5 @@ ?xml version=1.0 encoding=iso-8859-1? -!-- $Revision: 1.1 $ -- +!-- $Revision: 1.2 $ -- refentry id=function.Phar-commitWrite refnamediv refnamePhar-gt;commitWrite/refname @@ -52,9 +52,9 @@ $p-commitWrite(); var_dump($p-getStub()); $p-commitWrite(?php -function __autoload($class) +function __autoload(\$class) { -include 'phar://' . str_replace('_', '/', $class); +include 'phar://' . str_replace('_', '/', \$class); } Phar::mapPhar('brandnewphar.phar'); include 'phar://brandnewphar.phar/startup.php';
[PHP-DOC] cvs: phpdoc /en/reference/phar/functions Phar-commitWrite.xml
cellog Sun Jan 28 05:37:51 2007 UTC Modified files: /phpdoc/en/reference/phar/functions Phar-commitWrite.xml Log: fix doc example screen output http://cvs.php.net/viewvc.cgi/phpdoc/en/reference/phar/functions/Phar-commitWrite.xml?r1=1.2r2=1.3diff_format=u Index: phpdoc/en/reference/phar/functions/Phar-commitWrite.xml diff -u phpdoc/en/reference/phar/functions/Phar-commitWrite.xml:1.2 phpdoc/en/reference/phar/functions/Phar-commitWrite.xml:1.3 --- phpdoc/en/reference/phar/functions/Phar-commitWrite.xml:1.2 Sun Jan 28 05:36:47 2007 +++ phpdoc/en/reference/phar/functions/Phar-commitWrite.xml Sun Jan 28 05:37:51 2007 @@ -1,5 +1,5 @@ ?xml version=1.0 encoding=iso-8859-1? -!-- $Revision: 1.2 $ -- +!-- $Revision: 1.3 $ -- refentry id=function.Phar-commitWrite refnamediv refnamePhar-gt;commitWrite/refname @@ -69,12 +69,12 @@ ![CDATA[ string(24) ?php __HALT_COMPILER(); string(186) ?php -function __autoload() +function __autoload($class) { -include 'phar://' . str_replace('_', '/', ); +include 'phar://' . str_replace('_', '/', $class); } -Phar::mapPhar('brandnewphar.phar'); -include 'phar://brandnewphar.phar/startup.php'; +Phar::mapPhar('myphar.phar'); +include 'phar://myphar.phar/startup.php'; __HALT_COMPILER(); ? ]]
[PHP-DOC] cvs: phpdoc /en/reference/phar fileformat.xml reference.xml
cellog Wed Jan 24 04:37:45 2007 UTC Added files: /phpdoc/en/reference/phar fileformat.xml Modified files: /phpdoc/en/reference/phar reference.xml Log: add documentation on the Phar file format http://cvs.php.net/viewvc.cgi/phpdoc/en/reference/phar/reference.xml?r1=1.1r2=1.2diff_format=u Index: phpdoc/en/reference/phar/reference.xml diff -u phpdoc/en/reference/phar/reference.xml:1.1 phpdoc/en/reference/phar/reference.xml:1.2 --- phpdoc/en/reference/phar/reference.xml:1.1 Thu Jan 18 00:24:34 2007 +++ phpdoc/en/reference/phar/reference.xml Wed Jan 24 04:37:45 2007 @@ -1,5 +1,5 @@ ?xml version = '1.0' encoding = 'iso-8859-1'? -!-- $Revision: 1.1 $ -- +!-- $Revision: 1.2 $ -- !-- Purpose: -- !-- Membership: pecl -- reference id=ref.phar @@ -16,19 +16,31 @@ well as iterating over their contents. /para para -PHP Archive files are special collections of files that can be transparently +PHP Archive files (Phars) are special collections of files that can be transparently run right out of the file, similar to Java's jar archive files. Using a phar archive, -it is possible to distribute a complete PHP application in a single file. Phar +it is possible to distribute a complete PHP application in a single file that will +run out of the file without modification or extraction. Phar archives can also be used to store files for extraction similar to tar or zip -archive files. +archive files. Phars support compression using gzip if the +link linkend=ref.zlibzlib/link extension is present, and using bzip2 if +the link linkend=ref.bzip2bz2/link extension is present. In addition, +iteration and other features are available if the link linkend=ref.splSPL/link +extension is available. Phar signature verification using md5 or sha1 is natively +supported if the link linkend=ref.hashhash/link extension is available. + /para + para +The original implementation for Phar archives was in the PEAR package +ulink url=http://pear.php.net/PHP_Archive;PHP_Archive/ulink, and +the implementation details are very similar. /para /section section id=phar.requirements reftitle.required; para -Phar requires PHP 5.2.0 or newer, and requires that the -link linkend=ref.splSPL/link extension -be built into PHP. +Phar requires PHP 5.2.0 or newer. Additional features require the +link linkend=ref.splSPL/link extension in order to take advantage +of iteration and array access to a Phar's file contents. The literalphar/literal +stream does not require any additional extensions to function. /para para You may optionally wish to enable the link linkend=ref.zlib zlib/link @@ -46,19 +58,23 @@ section id=phar.resources reftitle.resources; para - +The Phar extension provides the literalphar/literal stream, which +allows accessing files contained within a phar transparently. The +file format of a Phar is described link linkend=phar.fileformathere/link /para -no.resource; /section section -titleClasses/title +reftitle.classes; simplelist member classnamePhar/classname + /member + member classnamePharFileInfo/classname /member /simplelist /section + reference.phar.fileformat; /partintro reference.phar.functions; /reference http://cvs.php.net/viewvc.cgi/phpdoc/en/reference/phar/fileformat.xml?view=markuprev=1.1 Index: phpdoc/en/reference/phar/fileformat.xml +++ phpdoc/en/reference/phar/fileformat.xml ?xml version=1.0 encoding=iso-8859-1? !-- $Revision: 1.1 $ -- section id=phar.fileformat titlePhar file format/title para All Phar files contain three to four sections: orderedlist listitem paraa stub/para /listitem listitem paraa manifest describing the contents/para /listitem listitem parathe file contents/para /listitem listitem para[optional] a signature for verifying Phar integrity/para /listitem /orderedlist /para /section section titlePhar file stub/title para A Phar's stub is a simple PHP file. The smallest possible stub follows: /para para programlisting role=php ![CDATA[?php __HALT_COMPILER();]] /programlisting /para para A stub must contain as a minimum, the literal__HALT_COMPILER();/literal token at its conclusion. Typically, a stub will contain loader functionality like so: /para para programlisting role=php ![CDATA[ ?php Phar::mapPhar(); include 'phar://myphar.phar/index.php'; __HALT_COMPILER(); ? ]] /programlisting /para para There are no restrictions on the contents of a Phar stub, except for the requirement that it conclude with literal__HALT_COMPILER();/literal. The closing PHP tag literal![CDATA[?]]/literal may be included or omitted, but there can be no more than 1 space between the literal;/literal and
[PHP-DOC] cvs: phpdoc /en/reference/phar .cvsignore functions.xml
cellog Thu Jan 18 00:25:44 2007 UTC Added files: /phpdoc/en/reference/phar .cvsignore Removed files: /phpdoc/en/reference/phar functions.xml Log: remove functions.xml, add .cvsignore http://cvs.php.net/viewvc.cgi/phpdoc/en/reference/phar/.cvsignore?view=markuprev=1.1 Index: phpdoc/en/reference/phar/.cvsignore +++ phpdoc/en/reference/phar/.cvsignore functions.xml functions.xml
[PHP-DOC] Re: cvs: phpdoc /en/reference/tokenizer constants.xml reference.xml /en/reference/tokenizer/functions token-get-all.xml
Ken Tossell wrote: kennyt Wed Jan 7 18:15:48 2004 EDT Modified files: /phpdoc/en/reference/tokenizer constants.xml reference.xml /phpdoc/en/reference/tokenizer/functions token-get-all.xml Log: Noted that T_ML_COMMENT = T_COMMENT in PHP 5. (#25659) T_ML_COMMENT is T_DOC_COMMENT in PHP 5 try this to verify: var_dump(T_DOC_COMMENT, T_COMMENT, token_get_all(?php /**\n * test\n */\n// normal comment ?)); Greg
[PHP-DOC] bug in configure with cygwin found
Hi, I isolated the problem, and fixed it. Notice that it wasn't detecting PHP in the output below. Line 1320 of configure was the problem: if test yes = `echo '?php echo phpversion()3?yes:no; ?' | $PHP -q`; then Apprently, cygwin doesn't support piping fully, as this generates no output at all when I run it independently: $echo '?php echo phpversion()3?yes:no; ?' | php -q [EMAIL PROTECTED] ~/peardoc $ However, if I save the contents into a small file testphpver.php, and change line 1320 to: if test yes = `$PHP -q testphpver.php`; then it works as expected and successfully configures. Regards, Greg Greg Beaver wrote: Hello, Thanks. Here is the complete output. It turns out that the .infig.status is the result of .in overwriting the current line. I discovered this through a ./configure out 2 out2. Here is the full output: $./configure checking for php... /cygdrive/c/PHP4.3.2/php checking php version... ./configure: line 1320: test: yes: unary operator expected PHP 4.3.2 (cli) (built: May 28 2003 15:10:38) Copyright (c) 1997-2003 The PHP Group Zend Engine v1.3.0, Copyright (c) 1998-2003 Zend Technologies with Zend Optimizer v2.1.0, Copyright (c) 1998-2003, by Zend Technologies configure: WARNING: PHP version 4.0.0 or newer needed checking for docbook.dsl... autodetected: ../phpdoc-tools/dsssl checking for docbook.xsl... checking for PHP source path... ../php4 checking for language... en (default) checking for openjade... no checking for jade... no checking for jade in phpdoc-tools... yes checking for onsgmls... /usr/local/bin/onsgmls configure: creating ./config.status config.status: creating \ config.status: error: cannot find input file: \ .in I appreciate any pointers on mistakes I am making here. Regards, Greg Moshe Doron wrote: please send the whole output Greg Beaver [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Hi, I'm trying to build peardoc/ in cygwin. I've got ./configure to work, but I'm getting a strange bug in config.status config.status: creating \ .infig.status: error: cannot find input file: \ a quick text search of config.status reveals no presence of infig Where do I start to debug this one? Regards, Greg -- PHP Documentation Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DOC] bug in configure with cygwin found
Hi, I checked out *peardoc* yesterday afternoon. I will report this bug on the pear.doc list. Greg Gabor Hojtsy wrote: I isolated the problem, and fixed it. Notice that it wasn't detecting PHP in the output below. Line 1320 of configure was the problem: if test yes = `echo '?php echo phpversion()3?yes:no; ?' | $PHP -q`; then Apprently, cygwin doesn't support piping fully, as this generates no output at all when I run it independently: $echo '?php echo phpversion()3?yes:no; ?' | php -q [EMAIL PROTECTED] ~/peardoc $ However, if I save the contents into a small file testphpver.php, and change line 1320 to: if test yes = `$PHP -q testphpver.php`; then it works as expected and successfully configures. This is what we have already done a very long time ago. You are using a *very* old phpdoc checkout. The current configure script first prints debug information, version numbers, environment values and then starts its work. If you update the phpdoc checkout, everything will work well. Goba -- PHP Documentation Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DOC] cygwin and configure error
Hi, I'm trying to build peardoc/ in cygwin. I've got ./configure to work, but I'm getting a strange bug in config.status config.status: creating \ .infig.status: error: cannot find input file: \ a quick text search of config.status reveals no presence of infig Where do I start to debug this one? Regards, Greg -- PHP Documentation Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DOC] Re: cygwin and configure error
Hello, Thanks. Here is the complete output. It turns out that the .infig.status is the result of .in overwriting the current line. I discovered this through a ./configure out 2 out2. Here is the full output: $./configure checking for php... /cygdrive/c/PHP4.3.2/php checking php version... ./configure: line 1320: test: yes: unary operator expected PHP 4.3.2 (cli) (built: May 28 2003 15:10:38) Copyright (c) 1997-2003 The PHP Group Zend Engine v1.3.0, Copyright (c) 1998-2003 Zend Technologies with Zend Optimizer v2.1.0, Copyright (c) 1998-2003, by Zend Technologies configure: WARNING: PHP version 4.0.0 or newer needed checking for docbook.dsl... autodetected: ../phpdoc-tools/dsssl checking for docbook.xsl... checking for PHP source path... ../php4 checking for language... en (default) checking for openjade... no checking for jade... no checking for jade in phpdoc-tools... yes checking for onsgmls... /usr/local/bin/onsgmls configure: creating ./config.status config.status: creating \ config.status: error: cannot find input file: \ .in I appreciate any pointers on mistakes I am making here. Regards, Greg Moshe Doron wrote: please send the whole output Greg Beaver [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Hi, I'm trying to build peardoc/ in cygwin. I've got ./configure to work, but I'm getting a strange bug in config.status config.status: creating \ .infig.status: error: cannot find input file: \ a quick text search of config.status reveals no presence of infig Where do I start to debug this one? Regards, Greg -- PHP Documentation Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DOC] Re: [PHP] phpDocumentor website issues
Miguel and others Sorry about the OSX problem and Opera 6 issue, I am not responsible for the web design, but will pass this on to the web designer. You can also directly view the sourceforge project at http://www.sourceforge.net/projects/phpdocu which will probably work in OSX IE 5. However, I am not a web designer for sourceforge either and can take no responsibility for any errors in display. Certainly, none of the issues you experience are intentional on the part of the web designer for phpdoc.org, as you can probably imagine. In defense of the web designer, he spent an entire day's work making the page work with all browsers he had access to, including IE 5 for PC, IE 6 for PC, Mozilla 1, Netscape 6.2, and Netscape 4.7. As I said, I've notified him of the issues involved, and he plans to take care of them in his free time. Thank you, Greg Beaver phpDocumentor team http://www.phpdoc.org -- works with most browsers http://www.sourceforge.net/projects/phpdocu -- probably works with all browsers - Original Message - From: Miguel Cruz [EMAIL PROTECTED] To: Greg Beaver [EMAIL PROTECTED] Cc: [EMAIL PROTECTED]; [EMAIL PROTECTED]; [EMAIL PROTECTED] Sent: Monday, June 10, 2002 12:29 AM Subject: Re: [PHP] phpDocumentor version 1.1.0rc1 RELEASE ANNOUNCEMENT On Sun, 9 Jun 2002, Greg Beaver wrote: June 9, 2002 RELEASE ANNOUNCEMENT phpDocumentor version 1.1.0rc1 http://www.phpdoc.org Best of all, with OSX IE 5.14, the page comes up completely blank. miguel
[PHP-DOC] phpDocumentor version 1.1.0rc1 RELEASE ANNOUNCEMENT
June 9, 2002 RELEASE ANNOUNCEMENT phpDocumentor version 1.1.0rc1 http://www.phpdoc.org Download: http://phpdocu.sourceforge.net/downloads.php The phpDocumentor Development team would like to announce the release of phpDocumentor version 1.1.0rc1. This is a release candidate for 1.1.0 to ensure that all bugs have been fixed before release phpDocumentor is the most advanced auto-documentation system available for PHP. Similar to the auto-documentor included with PEAR, phpDocumentor parses documentation comments in the PHP source to create hyperlinked API references for projects. Unlike the PEAR auto-documentor, phpDocumentor is extremely fast, has excellent documentation included, and the ability to parse any legal PHP syntax. phpDocumentor is the only auto-documentor written specifically for PHP that supports output to formats other than HTML. With 1.1.0rc1 comes a pre- alpha PDF Converter to demonstrate the facility. Through the use of Converters similar to JavaDoc's doclets, phpDocumentor can interface parsing output to any template with minimal coding. In addition, 6 HTML templates come standard with phpDocumentor. Other features include: --fully 25% faster than version 1.0.0 --able to directly parse a CVS repository --parses any php file, with multiple classes and functions in the same file --fully compliant with even the most esoteric php syntax ($string = EOF, for example) --greatly improved ease of Converter programming --parsing of global and static variables --documentation of name conflicts between packages --auto-linking to elements in any package --error/warnings by line number and file to allow for debugging of documentation tags --extensive documentation of the package, including a detailed specification for tags and templates --open source, GPL phpDocumentor is fast becoming the standard auto-documentor, and is used by several PHP projects including PostNuke Content Management (http://www.postnuke.com), phpRPC (http://phprpc.sourceforge.net/), and XMap (http://opensource.under.com.br/xmap/docs/) To Download, go to http://phpdocu.sourceforge.net/downloads.php The phpDocumentor development team Joshua Eichorn Gregory Beaver