Re: [PHP-DOC] Moving function index and default to book TOC?

2008-04-25 Thread Hannes Magnusson
On Thu, Apr 24, 2008 at 11:17 PM, Philip Olson [EMAIL PROTECTED] wrote:

  On 22 Apr 2008, at 13:26, Hannes Magnusson wrote:
  I think the redirecting to ext-intro page for php.net/extname may have
  been a mistake, it probably should be the book TOC page (i.e
  www.php.net/book.dom rather than www.php.net/intro.dom) like it was
  originally.
 

  I agree book.foo should be the first.

Fixed in both the sqlite indexer and the manual search.

-Hannes


Re: [PHP-DOC] Moving function index and default to book TOC?

2008-04-25 Thread Jani Taskinen
On Thu, 2008-04-24 at 14:17 -0700, Philip Olson wrote:
 On 22 Apr 2008, at 13:26, Hannes Magnusson wrote:
  Hei!
 
  The index
  (http://docs.php.net/manual/en/indexes.php) should be found a bit  
  easier,
  IMO, it's not just one appendice.. :)
 
  Move it to the PHP Manual listing at the top maybe?
 
 One problem is this isn't an index of the PHP manual. It's based on  
 php-src/ and part of pecl/ both of which contain a decent amount of  
 undocumented and strange information. And it only contains functions.  
 So until we discuss what we want the index to be, I move we leave it  
 where it's at because it's not worth promoting in its current state.

Gotta agree, don't promote crap please. :)

  I think the redirecting to ext-intro page for php.net/extname may have
  been a mistake, it probably should be the book TOC page (i.e
  www.php.net/book.dom rather than www.php.net/intro.dom) like it was
  originally.
 
 I agree book.foo should be the first.

Yup, definately. One thing about these manual pages, example shows it
the best: http://docs.php.net/manual/en/zlib.setup.php
Is it really necessary to split this to 3 different pages..? 
(Installation, Runtime Configuration, Resources types) 

And btw. That Runtime there is VERY misleading. Not every ini option
is modifiable during runtime. Just make it Configuration options or
something as vague as that. :)

 I also like them consistent however we can make a few adjustments like  
 be sure every topic is in the TOC (like Requirements). And one option  
 that I've not fully thought about but will say anyways is adding a  
 page to each section that lists everything. So a user clicks on I  
 want everything please and sees config/install/constants/function  
 list/etc... this may be crazy but brain storming often is.

Even more pages? Everything right now, yes please. That's not a crazy
idea at all, IMO.

--Jani




Re: [PHP-DOC] Moving function index and default to book TOC?

2008-04-25 Thread Jani Taskinen
On Fri, 2008-04-25 at 08:51 +0200, Hannes Magnusson wrote:
 On Thu, Apr 24, 2008 at 11:17 PM, Philip Olson [EMAIL PROTECTED] wrote:
 
   On 22 Apr 2008, at 13:26, Hannes Magnusson wrote:
   I think the redirecting to ext-intro page for php.net/extname may have
   been a mistake, it probably should be the book TOC page (i.e
   www.php.net/book.dom rather than www.php.net/intro.dom) like it was
   originally.
  
 
   I agree book.foo should be the first.
 
 Fixed in both the sqlite indexer and the manual search.

Does that mean it should work now? As 'php.net/extname' goes to the
function list now..

--Jani





[PHP-DOC] Never seen before! Gucci Prada Chanel, Bally, Dsquared, Sold for less than cost�WOW

2008-04-25 Thread phpdoc
Ladies and Gentlemen, Get Ready for..
 
Thought I would let you know about the Fashion Footwear SPRING Sale!
Men and Women Designer Shoes, Heels, Sandals and Boots, All Half-OFF,
Buy Direct, Forget Department Store Prices, Get Exclusive 2008  DG, Gucci, 
Versace, Prada, Chanel, Christian Dior, Dsquared, Uggs and More!
FREE International Shipping on all Orders!

http://bluepoppynpineridge.com/sale/




Re: [PHP-DOC] Moving function index and default to book TOC?

2008-04-25 Thread Hannes Magnusson
On Fri, Apr 25, 2008 at 10:41 AM, Jani Taskinen [EMAIL PROTECTED] wrote:

 On Fri, 2008-04-25 at 08:51 +0200, Hannes Magnusson wrote:
   On Thu, Apr 24, 2008 at 11:17 PM, Philip Olson [EMAIL PROTECTED] wrote:
   
 On 22 Apr 2008, at 13:26, Hannes Magnusson wrote:
 I think the redirecting to ext-intro page for php.net/extname may have
 been a mistake, it probably should be the book TOC page (i.e
 www.php.net/book.dom rather than www.php.net/intro.dom) like it was
 originally.

   
 I agree book.foo should be the first.
  
   Fixed in both the sqlite indexer and the manual search.

  Does that mean it should work now? As 'php.net/extname' goes to the
  function list now..

As soon as mirrors have rsync it should be fixed (i.e. within the
hour), same applies to the index.php bug.

-Hannes


[PHP-DOC] cvs: pecl /phar phar_object.c util.c

2008-04-25 Thread Steph Fox
sfoxFri Apr 25 21:37:40 2008 UTC

  Modified files:  
/pecl/phar  phar_object.c util.c 
  Log:
  - implemented Phar::buildFromDirectory
  
  @Greg: There are two (identical) recurring memleaks I can't seem to kill, 
both marked FIXME. Would you please take a look?
  
  [DOC] $phar-buildFromDirectory(dirname[, regex]). Return value is an array 
pairing each file in the archive index with the original path on the filesystem.
  
http://cvs.php.net/viewvc.cgi/pecl/phar/phar_object.c?r1=1.237r2=1.238diff_format=u
Index: pecl/phar/phar_object.c
diff -u pecl/phar/phar_object.c:1.237 pecl/phar/phar_object.c:1.238
--- pecl/phar/phar_object.c:1.237   Fri Apr 25 16:50:20 2008
+++ pecl/phar/phar_object.c Fri Apr 25 21:37:40 2008
@@ -17,7 +17,7 @@
   +--+
 */
 
-/* $Id: phar_object.c,v 1.237 2008/04/25 16:50:20 cellog Exp $ */
+/* $Id: phar_object.c,v 1.238 2008/04/25 21:37:40 sfox Exp $ */
 
 #include phar_internal.h
 #include func_interceptors.h
@@ -1382,7 +1382,11 @@
goto phar_spl_fileinfo;
case SPL_FS_INFO:
case SPL_FS_FILE:
-   return ZEND_HASH_APPLY_KEEP;
+   /* FIXME: memleak here */
+   fname = 
expand_filepath(intern-file_name, NULL TSRMLS_CC);
+   fname_len = strlen(fname);
+   is_splfileinfo = 1;
+   goto phar_spl_fileinfo;
}
}
/* fall-through */
@@ -1396,6 +1400,9 @@
 
 phar_spl_fileinfo:
if (base_len) {
+   /* FIXME: memleak here */
+   base = expand_filepath(base, NULL TSRMLS_CC);
+   base_len = strlen(base);
if (strstr(fname, base)) {
str_key_len = fname_len - base_len;
if (str_key_len = 0) {
@@ -1489,6 +1496,101 @@
 }
 /* }}} */
 
+/* {{{ proto array Phar::buildFromDirectory(string directory[, string regex])
+ * Construct a phar archive from an existing directory, recursively.
+ * Optional second parameter is a regular expression for filtering directory 
contents.
+ * 
+ * Return value is an array mapping phar index to actual files added.
+ */
+PHP_METHOD(Phar, buildFromDirectory)
+{
+   char *dir, *regex, *error;
+   int dir_len, regex_len;
+   zend_bool apply_reg = 0;
+   zval arg, arg2, *iter, *iteriter, *regexiter = NULL;
+   struct {
+   phar_archive_object *p;
+   zend_class_entry *c;
+   char *b;
+   uint l;
+   zval *ret;
+   } pass;
+
+   PHAR_ARCHIVE_OBJECT();
+
+   if (PHAR_G(readonly)  !phar_obj-arc.archive-is_data) {
+   zend_throw_exception_ex(spl_ce_UnexpectedValueException, 0 
TSRMLS_CC,
+   Cannot write to archive - write operations restricted 
by INI setting);
+   return;
+   }
+
+   if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, s|s, dir, 
dir_len, regex, regex_len) == FAILURE) {
+   RETURN_FALSE;
+   }
+
+   MAKE_STD_ZVAL(iter);
+
+   if (SUCCESS != object_init_ex(iter, spl_ce_RecursiveDirectoryIterator)) 
{
+   zval_dtor(iter);
+   zend_throw_exception_ex(spl_ce_BadMethodCallException, 0 
TSRMLS_CC, Unable to instantiate directory iterator for %s, 
phar_obj-arc.archive-fname);
+   RETURN_FALSE;
+   }
+
+   INIT_PZVAL(arg);
+   ZVAL_STRINGL(arg, dir, dir_len, 0);
+
+   zend_call_method_with_1_params(iter, 
spl_ce_RecursiveDirectoryIterator, 
+   spl_ce_RecursiveDirectoryIterator-constructor, 
__construct, NULL, arg);
+
+   MAKE_STD_ZVAL(iteriter);
+
+   if (SUCCESS != object_init_ex(iteriter, 
spl_ce_RecursiveIteratorIterator)) {
+   zval_dtor(iteriter);
+   zend_throw_exception_ex(spl_ce_BadMethodCallException, 0 
TSRMLS_CC, Unable to instantiate directory iterator for %s, 
phar_obj-arc.archive-fname);
+   RETURN_FALSE;
+   }
+
+   zend_call_method_with_1_params(iteriter, 
spl_ce_RecursiveIteratorIterator, 
+   spl_ce_RecursiveIteratorIterator-constructor, 
__construct, NULL, iter);
+
+   zval_ptr_dtor(iter);
+
+   if (regex_len  0) {
+   apply_reg = 1;
+   MAKE_STD_ZVAL(regexiter);
+
+   if (SUCCESS != object_init_ex(regexiter, spl_ce_RegexIterator)) 
{
+   zval_dtor(regexiter);
+   zend_throw_exception_ex(spl_ce_BadMethodCallException, 
0 TSRMLS_CC, Unable to instantiate regex iterator for %s, 

[PHP-DOC] cvs: pecl /phar phar_object.c /phar/tests phar_extract.phpt

2008-04-25 Thread Greg Beaver
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) {
+