[PHP-CVS-DAILY] cvs: php-src / ChangeLog

2008-05-15 Thread changelog
changelog   Fri May 16 01:31:54 2008 UTC

  Modified files:  
/php-srcChangeLog 
  Log:
  ChangeLog update
  
http://cvs.php.net/viewvc.cgi/php-src/ChangeLog?r1=1.3047r2=1.3048diff_format=u
Index: php-src/ChangeLog
diff -u php-src/ChangeLog:1.3047 php-src/ChangeLog:1.3048
--- php-src/ChangeLog:1.3047Thu May 15 01:31:47 2008
+++ php-src/ChangeLog   Fri May 16 01:31:52 2008
@@ -1,3 +1,116 @@
+2008-05-15  Greg Beaver  [EMAIL PROTECTED]
+
+* ext/phar/phar_object.c
+  ext/phar/tar.c
+  ext/phar/tests/badparameters.phpt
+  ext/phar/tests/pharfileinfo_setmetadata.phpt
+  ext/phar/tests/tar/all.phpt:
+  MFB: add full metadata support for tar-based archives and test
+
+* ext/phar/tests/tar/all.phpt
+  ext/phar/tests/tar/all.phpt:
+  
+  file all.phpt was initially added on branch PHP_5_3.
+
+* (PHP_5_3)
+  ext/phar/phar_object.c
+  ext/phar/tar.c
+  ext/phar/tests/badparameters.phpt
+  ext/phar/tests/pharfileinfo_setmetadata.phpt:
+  add full metadata support for tar-based archives and test
+
+2008-05-15  Etienne Kneuss  [EMAIL PROTECTED]
+
+* ext/spl/spl_directory.c:
+  Replace the iterator correctly after being cloned (related to #44964)
+
+* ext/spl/spl_heap.c
+  ext/spl/tests/pqueue_001.phpt:
+  Implement SplPriorityQueue::getExtractFlags()
+
+2008-05-15  Greg Beaver  [EMAIL PROTECTED]
+
+* ext/phar/dirstream.c
+  ext/phar/phar_internal.h
+  ext/phar/phar_object.c
+  ext/phar/stream.c
+  ext/phar/util.c
+  ext/phar/tests/030.phpt
+  ext/phar/tests/addfuncs.phpt
+  ext/phar/tests/mkdir.phpt
+  ext/phar/tests/mounteddir.phpt
+  ext/phar/tests/phar_buildfromiterator4.phpt
+  ext/phar/tests/phar_copy.phpt
+  ext/phar/tests/phar_extract2.phpt
+  ext/phar/tests/phar_offset_check.phpt
+  ext/phar/tests/phar_offset_get_error.phpt
+  ext/phar/tests/zf_test.phpt
+  ext/phar/tests/tar/dir.phpt
+  ext/phar/tests/tar/tar_003.phpt:
+  MFB: plug security hole of unfettered creation access to .phar magic
+  directory
+
+* (PHP_5_3)
+  ext/phar/dirstream.c
+  ext/phar/phar_internal.h
+  ext/phar/phar_object.c
+  ext/phar/stream.c
+  ext/phar/util.c
+  ext/phar/tests/030.phpt
+  ext/phar/tests/addfuncs.phpt
+  ext/phar/tests/mkdir.phpt
+  ext/phar/tests/mounteddir.phpt
+  ext/phar/tests/phar_buildfromiterator4.phpt
+  ext/phar/tests/phar_copy.phpt
+  ext/phar/tests/phar_extract2.phpt
+  ext/phar/tests/phar_offset_check.phpt
+  ext/phar/tests/phar_offset_get_error.phpt
+  ext/phar/tests/zf_test.phpt
+  ext/phar/tests/tar/dir.phpt
+  ext/phar/tests/tar/tar_003.phpt:
+  fix potentially major security hole: modification/creation of files in
+  .phar directory enabled in many locations
+  which then allows easy creation of tar/zip-based phar archives with a
+  simple rename even when phar.readonly=1.  Plug the hole very tightly,
+  allowing read access to
+  files, and also excluding them from opendir() output
+
+* (PHP_5_3)
+  ext/phar/tests/phar_extract2.phpt:
+  make test OS-agnostic
+
+2008-05-15  Zoe Slattery  [EMAIL PROTECTED]
+
+* ext/dom/tests/DOMDocument_createAttribute_basic.phpt
+  ext/dom/tests/DOMDocument_createAttribute_error.phpt
+  ext/dom/tests/DOMDocument_createAttribute_error1.phpt
+  ext/dom/tests/DOMDocument_createAttribute_variation.phpt:
+  Tests from Testfest 2008
+
+2008-05-15  Steph Fox  [EMAIL PROTECTED]
+
+* ext/phar/tests/phar_extract2.phpt
+  ext/phar/tests/phar_extract2.phpt
+  ext/phar/tests/phar_offset_check.phpt
+  ext/phar/tests/phar_offset_check.phpt
+  ext/phar/tests/tar/phar_convert_phar3.phpt:
+  
+  file phar_extract2.phpt was initially added on branch PHP_5_3.
+
+2008-05-15  Zoe Slattery  [EMAIL PROTECTED]
+
+* ext/dom/DOMDocument_createAttribute_basic.phpt
+  ext/dom/DOMDocument_createAttribute_basic.phpt
+  ext/dom/DOMDocument_createAttribute_error.phpt
+  ext/dom/DOMDocument_createAttribute_error.phpt
+  ext/dom/DOMDocument_createAttribute_error1.phpt
+  ext/dom/DOMDocument_createAttribute_error1.phpt
+  ext/dom/DOMDocument_createAttribute_variation.phpt
+  ext/dom/DOMDocument_createAttribute_variation.phpt:
+  
+  file DOMDocument_createAttribute_basic.phpt was initially added on branch
+  PHP_5_3.
+
 2008-05-14  Ilia Alshanetsky  [EMAIL PROTECTED]
 
 * (PHP_5_2)




Re: [PHP-CVS] cvs: php-src(PHP_5_3) /ext/phar dirstream.c

2008-05-15 Thread Antony Dovgal

On 15.05.2008 01:29, Steph Fox wrote:

sfoxWed May 14 21:29:51 2008 UTC

  Modified files:  (Branch: PHP_5_3)


Steph, could you take a look at this test plz?

# cat ext/phar/tests/tar/phar_convert_phar3.diff
002+ int(6659)
002- int(6651)
008+ int(6659)
008- int(6651)
011+ int(6659)
011- int(6651)

--
Wbr, 
Antony Dovgal


--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-CVS] cvs: php-src(PHP_5_3) /ext/dom DOMDocument_createAttribute_basic.phpt DOMDocument_createAttribute_error.phpt DOMDocument_createAttribute_error1.phpt DOMDocument_createAttribute_variation.php

2008-05-15 Thread Zoe Slattery
zoe Thu May 15 12:23:47 2008 UTC

  Added files: (Branch: PHP_5_3)
/php-src/ext/domDOMDocument_createAttribute_basic.phpt 
DOMDocument_createAttribute_error1.phpt 
DOMDocument_createAttribute_error.phpt 
DOMDocument_createAttribute_variation.phpt 
  Log:
  Tests from London test fest 2008
  

http://cvs.php.net/viewvc.cgi/php-src/ext/dom/DOMDocument_createAttribute_basic.phpt?view=markuprev=1.1
Index: php-src/ext/dom/DOMDocument_createAttribute_basic.phpt
+++ php-src/ext/dom/DOMDocument_createAttribute_basic.phpt

http://cvs.php.net/viewvc.cgi/php-src/ext/dom/DOMDocument_createAttribute_error1.phpt?view=markuprev=1.1
Index: php-src/ext/dom/DOMDocument_createAttribute_error1.phpt
+++ php-src/ext/dom/DOMDocument_createAttribute_error1.phpt

http://cvs.php.net/viewvc.cgi/php-src/ext/dom/DOMDocument_createAttribute_error.phpt?view=markuprev=1.1
Index: php-src/ext/dom/DOMDocument_createAttribute_error.phpt
+++ php-src/ext/dom/DOMDocument_createAttribute_error.phpt

http://cvs.php.net/viewvc.cgi/php-src/ext/dom/DOMDocument_createAttribute_variation.phpt?view=markuprev=1.1
Index: php-src/ext/dom/DOMDocument_createAttribute_variation.phpt
+++ php-src/ext/dom/DOMDocument_createAttribute_variation.phpt



-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-CVS] cvs: php-src(PHP_5_3) /ext/phar/tests phar_extract2.phpt phar_offset_check.phpt /ext/phar/tests/tar phar_convert_phar3.phpt

2008-05-15 Thread Steph Fox
sfoxThu May 15 12:37:45 2008 UTC

  Added files: (Branch: PHP_5_3)
/php-src/ext/phar/tests phar_extract2.phpt phar_offset_check.phpt 

  Modified files:  
/php-src/ext/phar/tests/tar phar_convert_phar3.phpt 
  Log:
  - Fix test, add a couple of new ones
  
  @Greg: it seems we covered it already ;)
  
http://cvs.php.net/viewvc.cgi/php-src/ext/phar/tests/tar/phar_convert_phar3.phpt?r1=1.11r2=1.11.2.1diff_format=u
Index: php-src/ext/phar/tests/tar/phar_convert_phar3.phpt
diff -u php-src/ext/phar/tests/tar/phar_convert_phar3.phpt:1.11 
php-src/ext/phar/tests/tar/phar_convert_phar3.phpt:1.11.2.1
--- php-src/ext/phar/tests/tar/phar_convert_phar3.phpt:1.11 Fri May  2 
05:05:54 2008
+++ php-src/ext/phar/tests/tar/phar_convert_phar3.phpt  Thu May 15 12:37:45 2008
@@ -49,14 +49,14 @@
 ?
 --EXPECT--
 bool(false)
-int(6651)
+int(6659)
 bool(true)
 string(60) ?php // tar-based phar archive stub file
 __HALT_COMPILER();
 bool(true)
 int(8192)
-int(6651)
+int(6659)
 bool(true)
 bool(true)
-int(6651)
+int(6659)
 ===DONE===

http://cvs.php.net/viewvc.cgi/php-src/ext/phar/tests/phar_extract2.phpt?view=markuprev=1.1
Index: php-src/ext/phar/tests/phar_extract2.phpt
+++ php-src/ext/phar/tests/phar_extract2.phpt

http://cvs.php.net/viewvc.cgi/php-src/ext/phar/tests/phar_offset_check.phpt?view=markuprev=1.1
Index: php-src/ext/phar/tests/phar_offset_check.phpt
+++ php-src/ext/phar/tests/phar_offset_check.phpt



-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-CVS] cvs: php-src /ext/dom/tests DOMDocument_createAttribute_basic.phpt DOMDocument_createAttribute_error.phpt DOMDocument_createAttribute_error1.phpt DOMDocument_createAttribute_variation.phpt

2008-05-15 Thread Zoe Slattery
zoe Thu May 15 12:50:29 2008 UTC

  Added files: 
/php-src/ext/dom/tests  DOMDocument_createAttribute_variation.phpt 
DOMDocument_createAttribute_basic.phpt 
DOMDocument_createAttribute_error.phpt 
DOMDocument_createAttribute_error1.phpt 
  Log:
  Tests from Testfest 2008
  

http://cvs.php.net/viewvc.cgi/php-src/ext/dom/tests/DOMDocument_createAttribute_variation.phpt?view=markuprev=1.1
Index: php-src/ext/dom/tests/DOMDocument_createAttribute_variation.phpt
+++ php-src/ext/dom/tests/DOMDocument_createAttribute_variation.phpt
--TEST--
Test DOMDocument::createAttribute() for expected return value
--FILE--
?php
$dom = new DOMDocument();

$attr = $dom-createAttribute('string');
echo get_class($attr);

?
--EXPECTF--
DOMAttr

http://cvs.php.net/viewvc.cgi/php-src/ext/dom/tests/DOMDocument_createAttribute_basic.phpt?view=markuprev=1.1
Index: php-src/ext/dom/tests/DOMDocument_createAttribute_basic.phpt
+++ php-src/ext/dom/tests/DOMDocument_createAttribute_basic.phpt
--TEST--
DomDocument::createAttribute() - basic test for DomDocument::createAttribute()
--CREDITS--
Muhammad Khalid Adnan 
# TestFest 2008
--FILE--
?php

$doc = new DOMDocument;

$node = $doc-createElement(para);
$newnode = $doc-appendChild($node);

// A pass case.
$test_attribute = $doc-createAttribute(hahaha);
$node-appendChild($test_attribute);

echo $doc-saveXML();

?
--EXPECT--
?xml version=1.0?
para hahaha=/


http://cvs.php.net/viewvc.cgi/php-src/ext/dom/tests/DOMDocument_createAttribute_error.phpt?view=markuprev=1.1
Index: php-src/ext/dom/tests/DOMDocument_createAttribute_error.phpt
+++ php-src/ext/dom/tests/DOMDocument_createAttribute_error.phpt
--TEST--
Test DOMDocument::createAttribute() for expected expection thrown when wrong 
parameter passed
--FILE--
?php
$dom = new DOMDocument();

try {
$attr = $dom-createAttribute(0);
}
catch(DOMException $e) {
$code = $e-getCode();
if(DOM_INVALID_CHARACTER_ERR === $code) {
echo PASS;
}
else {
echo 'Wrong exception code';
}
}
catch(Exception $e) {
echo 'Wrong exception thrown';
}

?
--EXPECTF--
PASS

http://cvs.php.net/viewvc.cgi/php-src/ext/dom/tests/DOMDocument_createAttribute_error1.phpt?view=markuprev=1.1
Index: php-src/ext/dom/tests/DOMDocument_createAttribute_error1.phpt
+++ php-src/ext/dom/tests/DOMDocument_createAttribute_error1.phpt
--TEST--
DomDocument::createAttribute() - error test for DomDocument::createAttribute()
--CREDITS--
Muhammad Khalid Adnan
# TestFest 2008
--FILE--
?php

$doc = new DOMDocument;

$node = $doc-createElement(para);
$newnode = $doc-appendChild($node);

try {
$failed_test_attribute = $doc-createAttribute(ha haha);
$node-appendChild($failed_test_attribute);

echo $doc-saveXML();
}
catch (DOMException $e) {
echo 'Test failed!', PHP_EOL;
}

?
--EXPECT--
Test failed!




-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-CVS] cvs: php-src(PHP_5_3) /ext/phar/tests phar_extract2.phpt

2008-05-15 Thread Greg Beaver
cellog  Thu May 15 14:01:30 2008 UTC

  Modified files:  (Branch: PHP_5_3)
/php-src/ext/phar/tests phar_extract2.phpt 
  Log:
  make test OS-agnostic
  
http://cvs.php.net/viewvc.cgi/php-src/ext/phar/tests/phar_extract2.phpt?r1=1.1.2.1r2=1.1.2.2diff_format=u
Index: php-src/ext/phar/tests/phar_extract2.phpt
diff -u php-src/ext/phar/tests/phar_extract2.phpt:1.1.2.1 
php-src/ext/phar/tests/phar_extract2.phpt:1.1.2.2
--- php-src/ext/phar/tests/phar_extract2.phpt:1.1.2.1   Thu May 15 12:37:45 2008
+++ php-src/ext/phar/tests/phar_extract2.phpt   Thu May 15 14:01:30 2008
@@ -62,11 +62,11 @@
 ?
 --EXPECTF--
 %sextract%cfile1.txt
-%sextract\file2.txt
-%sextract\one
-%sextract\subdir
-%sextract\subdir\ectory
-%sextract\subdir\ectory\file.txt
+%sextract%cfile2.txt
+%sextract%cone
+%sextract%csubdir
+%sextract%csubdir%cectory
+%sextract%csubdir%cectory%cfile.txt
 Phar Error: attempted to extract non-existent file phar from phar 
%stempmanifest2.phar.php
 Phar Error: attempted to extract non-existent file .phar from phar 
%stempmanifest2.phar.php
 Phar Error: attempted to extract non-existent file /phar from phar 
%stempmanifest2.phar.php



-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-CVS] cvs: php-src(PHP_5_3) /ext/phar/tests phar_extract2.phpt

2008-05-15 Thread Steph Fox

d'oh :) Sorry, I was rushing out the door - y'know how it is.

Thanks for fix.

- Original Message - 
From: Greg Beaver [EMAIL PROTECTED]

To: php-cvs@lists.php.net
Sent: Thursday, May 15, 2008 3:01 PM
Subject: [PHP-CVS] cvs: php-src(PHP_5_3) /ext/phar/tests phar_extract2.phpt



cellog Thu May 15 14:01:30 2008 UTC

 Modified files:  (Branch: PHP_5_3)
   /php-src/ext/phar/tests phar_extract2.phpt
 Log:
 make test OS-agnostic

http://cvs.php.net/viewvc.cgi/php-src/ext/phar/tests/phar_extract2.phpt?r1=1.1.2.1r2=1.1.2.2diff_format=u
Index: php-src/ext/phar/tests/phar_extract2.phpt
diff -u php-src/ext/phar/tests/phar_extract2.phpt:1.1.2.1 
php-src/ext/phar/tests/phar_extract2.phpt:1.1.2.2
--- php-src/ext/phar/tests/phar_extract2.phpt:1.1.2.1 Thu May 15 12:37:45 
2008

+++ php-src/ext/phar/tests/phar_extract2.phpt Thu May 15 14:01:30 2008
@@ -62,11 +62,11 @@
?
--EXPECTF--
%sextract%cfile1.txt
-%sextract\file2.txt
-%sextract\one
-%sextract\subdir
-%sextract\subdir\ectory
-%sextract\subdir\ectory\file.txt
+%sextract%cfile2.txt
+%sextract%cone
+%sextract%csubdir
+%sextract%csubdir%cectory
+%sextract%csubdir%cectory%cfile.txt
Phar Error: attempted to extract non-existent file phar from phar 
%stempmanifest2.phar.php
Phar Error: attempted to extract non-existent file .phar from phar 
%stempmanifest2.phar.php
Phar Error: attempted to extract non-existent file /phar from phar 
%stempmanifest2.phar.php




--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-CVS] cvs: php-src(PHP_5_3) /ext/phar dirstream.c phar_internal.h phar_object.c stream.c util.c /ext/phar/tests 030.phpt addfuncs.phpt mkdir.phpt mounteddir.phpt phar_buildfromiterator4.phpt phar

2008-05-15 Thread Greg Beaver
cellog  Thu May 15 16:09:01 2008 UTC

  Modified files:  (Branch: PHP_5_3)
/php-src/ext/phar   dirstream.c phar_internal.h phar_object.c 
stream.c util.c 
/php-src/ext/phar/tests 030.phpt addfuncs.phpt mkdir.phpt 
mounteddir.phpt 
phar_buildfromiterator4.phpt phar_copy.phpt 
phar_extract2.phpt phar_offset_check.phpt 
phar_offset_get_error.phpt zf_test.phpt 
/php-src/ext/phar/tests/tar dir.phpt tar_003.phpt 
  Log:
  fix potentially major security hole: modification/creation of files in .phar 
directory enabled in many locations
  which then allows easy creation of tar/zip-based phar archives with a simple 
rename even when phar.readonly=1.  Plug the hole very tightly, allowing read 
access to
  files, and also excluding them from opendir() output
  http://cvs.php.net/viewvc.cgi/php-src/ext/phar/dirstream.c?r1=1.26.2.1r2=1.26.2.2diff_format=u
Index: php-src/ext/phar/dirstream.c
diff -u php-src/ext/phar/dirstream.c:1.26.2.1 
php-src/ext/phar/dirstream.c:1.26.2.2
--- php-src/ext/phar/dirstream.c:1.26.2.1   Wed May 14 21:29:50 2008
+++ php-src/ext/phar/dirstream.cThu May 15 16:09:00 2008
@@ -196,8 +196,9 @@
ALLOC_HASHTABLE(data);
zend_hash_init(data, 64, zend_get_hash_value, NULL, 0);
 
-   if (*dir == '/'  dirlen == 1  (manifest-nNumOfElements == 0)) {
+   if ((*dir == '/'  dirlen == 1  (manifest-nNumOfElements == 0)) || 
(dirlen = sizeof(.phar)-1  !memcmp(dir, .phar, sizeof(.phar)-1))) {
/* make empty root directory for empty phar */
+   /* make empty directory for .phar magic directory */
efree(dir);
return php_stream_alloc(phar_dir_ops, data, NULL, r);
}
@@ -217,6 +218,13 @@
}
if (*dir == '/') {
/* root directory */
+   if (keylen = sizeof(.phar)-1  !memcmp(str_key, 
.phar, sizeof(.phar)-1)) {
+   /* do not add any magic entries to this 
directory */
+   if (SUCCESS != 
zend_hash_move_forward(manifest)) {
+   break;
+   }
+   continue;
+   }
if (NULL != (found = (char *) memchr(str_key, '/', 
keylen))) {
/* the entry has a path separator and is a 
subdirectory */
entry = (char *) safe_emalloc(found - str_key, 
1, 1);
@@ -446,7 +454,7 @@
return FAILURE;
}
 
-   if ((e = phar_get_entry_info_dir(phar, resource-path + 1, 
strlen(resource-path + 1), 2, error TSRMLS_CC))) {
+   if ((e = phar_get_entry_info_dir(phar, resource-path + 1, 
strlen(resource-path + 1), 2, error, 1 TSRMLS_CC))) {
/* directory exists, or is a subdirectory of an existing file */
if (e-is_temp_dir) {
efree(e-filename);
@@ -462,7 +470,7 @@
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))) {
+   if ((e = phar_get_entry_info_dir(phar, resource-path + 1, 
strlen(resource-path + 1), 0, error, 1 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);
@@ -565,7 +573,7 @@
return FAILURE;
}
 
-   if (!(entry = phar_get_entry_info_dir(phar, resource-path + 1, 
strlen(resource-path) - 1, 2, error TSRMLS_CC))) {
+   if (!(entry = phar_get_entry_info_dir(phar, resource-path + 1, 
strlen(resource-path) - 1, 2, error, 1 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/php-src/ext/phar/phar_internal.h?r1=1.109.2.1r2=1.109.2.2diff_format=u
Index: php-src/ext/phar/phar_internal.h
diff -u php-src/ext/phar/phar_internal.h:1.109.2.1 
php-src/ext/phar/phar_internal.h:1.109.2.2
--- php-src/ext/phar/phar_internal.h:1.109.2.1  Wed May 14 21:29:51 2008
+++ php-src/ext/phar/phar_internal.hThu May 15 16:09:00 2008
@@ -17,7 +17,7 @@
   +--+
 */
 
-/* $Id: phar_internal.h,v 1.109.2.1 2008/05/14 21:29:51 sfox Exp $ */
+/* $Id: phar_internal.h,v 1.109.2.2 2008/05/15 16:09:00 cellog Exp $ */
 
 #ifdef HAVE_CONFIG_H
 #include config.h
@@ -445,10 +445,10 @@
 

[PHP-CVS] cvs: php-src /ext/phar dirstream.c phar_internal.h phar_object.c stream.c util.c /ext/phar/tests 030.phpt addfuncs.phpt mkdir.phpt mounteddir.phpt phar_buildfromiterator4.phpt phar_copy.php

2008-05-15 Thread Greg Beaver
cellog  Thu May 15 16:09:21 2008 UTC

  Modified files:  
/php-src/ext/phar   dirstream.c phar_internal.h phar_object.c 
stream.c util.c 
/php-src/ext/phar/tests phar_extract2.phpt phar_offset_check.phpt 
030.phpt addfuncs.phpt mkdir.phpt 
mounteddir.phpt 
phar_buildfromiterator4.phpt phar_copy.phpt 
phar_offset_get_error.phpt zf_test.phpt 
/php-src/ext/phar/tests/tar dir.phpt tar_003.phpt 
  Log:
  MFB: plug security hole of unfettered creation access to .phar magic directory
  http://cvs.php.net/viewvc.cgi/php-src/ext/phar/dirstream.c?r1=1.28r2=1.29diff_format=u
Index: php-src/ext/phar/dirstream.c
diff -u php-src/ext/phar/dirstream.c:1.28 php-src/ext/phar/dirstream.c:1.29
--- php-src/ext/phar/dirstream.c:1.28   Wed May 14 21:27:31 2008
+++ php-src/ext/phar/dirstream.cThu May 15 16:09:21 2008
@@ -196,8 +196,9 @@
ALLOC_HASHTABLE(data);
zend_hash_init(data, 64, zend_get_hash_value, NULL, 0);
 
-   if (*dir == '/'  dirlen == 1  (manifest-nNumOfElements == 0)) {
+   if ((*dir == '/'  dirlen == 1  (manifest-nNumOfElements == 0)) || 
(dirlen = sizeof(.phar)-1  !memcmp(dir, .phar, sizeof(.phar)-1))) {
/* make empty root directory for empty phar */
+   /* make empty directory for .phar magic directory */
efree(dir);
return php_stream_alloc(phar_dir_ops, data, NULL, r);
}
@@ -217,6 +218,13 @@
}
if (*dir == '/') {
/* root directory */
+   if (keylen = sizeof(.phar)-1  !memcmp(str_key, 
.phar, sizeof(.phar)-1)) {
+   /* do not add any magic entries to this 
directory */
+   if (SUCCESS != 
zend_hash_move_forward(manifest)) {
+   break;
+   }
+   continue;
+   }
if (NULL != (found = (char *) memchr(str_key, '/', 
keylen))) {
/* the entry has a path separator and is a 
subdirectory */
entry = (char *) safe_emalloc(found - str_key, 
1, 1);
@@ -446,7 +454,7 @@
return FAILURE;
}
 
-   if ((e = phar_get_entry_info_dir(phar, resource-path + 1, 
strlen(resource-path + 1), 2, error TSRMLS_CC))) {
+   if ((e = phar_get_entry_info_dir(phar, resource-path + 1, 
strlen(resource-path + 1), 2, error, 1 TSRMLS_CC))) {
/* directory exists, or is a subdirectory of an existing file */
if (e-is_temp_dir) {
efree(e-filename);
@@ -462,7 +470,7 @@
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))) {
+   if ((e = phar_get_entry_info_dir(phar, resource-path + 1, 
strlen(resource-path + 1), 0, error, 1 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);
@@ -565,7 +573,7 @@
return FAILURE;
}
 
-   if (!(entry = phar_get_entry_info_dir(phar, resource-path + 1, 
strlen(resource-path) - 1, 2, error TSRMLS_CC))) {
+   if (!(entry = phar_get_entry_info_dir(phar, resource-path + 1, 
strlen(resource-path) - 1, 2, error, 1 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/php-src/ext/phar/phar_internal.h?r1=1.110r2=1.111diff_format=u
Index: php-src/ext/phar/phar_internal.h
diff -u php-src/ext/phar/phar_internal.h:1.110 
php-src/ext/phar/phar_internal.h:1.111
--- php-src/ext/phar/phar_internal.h:1.110  Wed May 14 21:27:31 2008
+++ php-src/ext/phar/phar_internal.hThu May 15 16:09:21 2008
@@ -17,7 +17,7 @@
   +--+
 */
 
-/* $Id: phar_internal.h,v 1.110 2008/05/14 21:27:31 sfox Exp $ */
+/* $Id: phar_internal.h,v 1.111 2008/05/15 16:09:21 cellog Exp $ */
 
 #ifdef HAVE_CONFIG_H
 #include config.h
@@ -445,10 +445,10 @@
 int phar_archive_delref(phar_archive_data *phar TSRMLS_DC);
 int phar_entry_delref(phar_entry_data *idata TSRMLS_DC);
 
-phar_entry_info *phar_get_entry_info(phar_archive_data *phar, char *path, int 
path_len, char **error TSRMLS_DC);
-phar_entry_info *phar_get_entry_info_dir(phar_archive_data *phar, char *path, 
int 

[PHP-CVS] cvs: php-src /ext/spl spl_heap.c /ext/spl/tests pqueue_001.phpt

2008-05-15 Thread Etienne Kneuss
colder  Thu May 15 17:05:20 2008 UTC

  Modified files:  
/php-src/ext/splspl_heap.c 
/php-src/ext/spl/tests  pqueue_001.phpt 
  Log:
  Implement SplPriorityQueue::getExtractFlags()
  
http://cvs.php.net/viewvc.cgi/php-src/ext/spl/spl_heap.c?r1=1.3r2=1.4diff_format=u
Index: php-src/ext/spl/spl_heap.c
diff -u php-src/ext/spl/spl_heap.c:1.3 php-src/ext/spl/spl_heap.c:1.4
--- php-src/ext/spl/spl_heap.c:1.3  Fri Feb 29 09:25:30 2008
+++ php-src/ext/spl/spl_heap.c  Thu May 15 17:05:20 2008
@@ -16,7 +16,7 @@
+--+
  */
 
-/* $Id: spl_heap.c,v 1.3 2008/02/29 09:25:30 colder Exp $ */
+/* $Id: spl_heap.c,v 1.4 2008/05/15 17:05:20 colder Exp $ */
 
 #ifdef HAVE_CONFIG_H
 # include config.h
@@ -737,7 +737,7 @@
 }
 /* }}} */
 
-/* {{{ proto int SplPriorityQueue::setIteratorMode($flags) U
+/* {{{ proto int SplPriorityQueue::setExtractFlags($flags) U
  Set the flags of extraction*/
 SPL_METHOD(SplPriorityQueue, setExtractFlags)
 {
@@ -755,6 +755,22 @@
RETURN_LONG(intern-flags);
 }
 /* }}} */
+/* {{{ proto int SplPriorityQueue::getExtractFlags($flags) U
+ Set the flags of extraction*/
+SPL_METHOD(SplPriorityQueue, getExtractFlags)
+{
+   long value;
+   spl_heap_object *intern;
+
+   if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, ) == FAILURE) {
+   return;
+   }
+
+   intern = (spl_heap_object*)zend_object_store_get_object(getThis() 
TSRMLS_CC);
+
+   RETURN_LONG(intern-flags  SPL_PQUEUE_EXTR_MASK;);
+}
+/* }}} */
 
 /* {{{ proto int SplHeap::recoverFromCorruption() U
  Recover from a corrupted state*/
@@ -1119,6 +1135,7 @@
SPL_ME(SplPriorityQueue, compare,   arginfo_heap_compare,   
 ZEND_ACC_PUBLIC)
SPL_ME(SplPriorityQueue, insert,arginfo_pqueue_insert,  
 ZEND_ACC_PUBLIC)
SPL_ME(SplPriorityQueue, setExtractFlags,   
arginfo_pqueue_setflags, ZEND_ACC_PUBLIC)
+   SPL_ME(SplPriorityQueue, getExtractFlags,   NULL,   
 ZEND_ACC_PUBLIC)
SPL_ME(SplPriorityQueue, top,   NULL,   
 ZEND_ACC_PUBLIC)
SPL_ME(SplPriorityQueue, extract,   NULL,   
 ZEND_ACC_PUBLIC)
SPL_ME(SplHeap,  count, NULL,   
 ZEND_ACC_PUBLIC)
http://cvs.php.net/viewvc.cgi/php-src/ext/spl/tests/pqueue_001.phpt?r1=1.1r2=1.2diff_format=u
Index: php-src/ext/spl/tests/pqueue_001.phpt
diff -u php-src/ext/spl/tests/pqueue_001.phpt:1.1 
php-src/ext/spl/tests/pqueue_001.phpt:1.2
--- php-src/ext/spl/tests/pqueue_001.phpt:1.1   Mon Feb 25 23:36:36 2008
+++ php-src/ext/spl/tests/pqueue_001.phpt   Thu May 15 17:05:20 2008
@@ -5,6 +5,7 @@
 --FILE--
 ?php
 $pq = new SplPriorityQueue();
+echo $pq-getExtractFlags().\n;
 
 // errors
 try {
@@ -25,6 +26,7 @@
 
 $pq1 = new SplPriorityQueue();
 $pq1-setExtractFlags(SplPriorityQueue::EXTR_BOTH);
+echo $pq1-getExtractFlags().\n;
 
 $pq1-insert(a, 1);
 $pq1-insert(b, 2);
@@ -38,6 +40,7 @@
 
 $pq2 = new SplPriorityQueue();
 $pq2-setExtractFlags(SplPriorityQueue::EXTR_DATA);
+echo $pq2-getExtractFlags().\n;
 
 $pq2-insert(a, 1);
 $pq2-insert(b, 2);
@@ -51,6 +54,7 @@
 
 $pq3 = new SplPriorityQueue();
 $pq3-setExtractFlags(SplPriorityQueue::EXTR_PRIORITY);
+echo $pq3-getExtractFlags().\n;
 
 $pq3-insert(a, 1);
 $pq3-insert(b, 2);
@@ -64,11 +68,13 @@
 ===DONE===
 ?php exit(0); ?
 --EXPECTF--
+1
 Exception: Can't extract from an empty heap
 3=b
 2=a
 1=c
 EXTR_BOTH
+3
 3=Array
 (
 [data] = b
@@ -88,10 +94,12 @@
 )
 
 EXTR_DATA
+1
 3=b
 2=a
 1=c
 EXTR_PRIORITY
+2
 3=2
 2=1
 1=0



-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-CVS] cvs: php-src /ext/spl spl_directory.c

2008-05-15 Thread Etienne Kneuss
colder  Thu May 15 17:22:03 2008 UTC

  Modified files:  
/php-src/ext/splspl_directory.c 
  Log:
  Replace the iterator correctly after being cloned (related to #44964)
  
http://cvs.php.net/viewvc.cgi/php-src/ext/spl/spl_directory.c?r1=1.152r2=1.153diff_format=u
Index: php-src/ext/spl/spl_directory.c
diff -u php-src/ext/spl/spl_directory.c:1.152 
php-src/ext/spl/spl_directory.c:1.153
--- php-src/ext/spl/spl_directory.c:1.152   Sat May  3 16:01:00 2008
+++ php-src/ext/spl/spl_directory.c Thu May 15 17:22:03 2008
@@ -16,7 +16,7 @@
+--+
  */
 
-/* $Id: spl_directory.c,v 1.152 2008/05/03 16:01:00 colder Exp $ */
+/* $Id: spl_directory.c,v 1.153 2008/05/15 17:22:03 colder Exp $ */
 
 #ifdef HAVE_CONFIG_H
 # include config.h
@@ -298,6 +298,7 @@
zend_object_handle handle = Z_OBJ_HANDLE_P(zobject);
spl_filesystem_object *intern;
spl_filesystem_object *source;
+   int index;
 
old_object = zend_objects_get_address(zobject TSRMLS_CC);
source = (spl_filesystem_object*)old_object;
@@ -316,6 +317,11 @@
break;
case SPL_FS_DIR:
spl_filesystem_dir_open(intern, source-_path_type, 
source-_path, source-_path_len TSRMLS_CC);
+   /* read until we hit the position in which we were before */
+   for(index = 0; index  source-u.dir.index; ++index) {
+   spl_filesystem_dir_read(intern TSRMLS_CC);
+   }
+   intern-u.dir.index = index;
break;
case SPL_FS_FILE:
php_error_docref(NULL TSRMLS_CC, E_ERROR, An object of class 
%v cannot be cloned, old_object-ce-name);



-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-CVS] cvs: php-src(PHP_5_3) /ext/phar phar_object.c tar.c /ext/phar/tests badparameters.phpt pharfileinfo_setmetadata.phpt /ext/phar/tests/tar all.phpt

2008-05-15 Thread Greg Beaver
cellog  Thu May 15 23:46:29 2008 UTC

  Added files: (Branch: PHP_5_3)
/php-src/ext/phar/tests/tar all.phpt 

  Modified files:  
/php-src/ext/phar   phar_object.c tar.c 
/php-src/ext/phar/tests badparameters.phpt 
pharfileinfo_setmetadata.phpt 
  Log:
  add full metadata support for tar-based archives and test
  http://cvs.php.net/viewvc.cgi/php-src/ext/phar/phar_object.c?r1=1.266.2.2r2=1.266.2.3diff_format=u
Index: php-src/ext/phar/phar_object.c
diff -u php-src/ext/phar/phar_object.c:1.266.2.2 
php-src/ext/phar/phar_object.c:1.266.2.3
--- php-src/ext/phar/phar_object.c:1.266.2.2Thu May 15 16:09:00 2008
+++ php-src/ext/phar/phar_object.c  Thu May 15 23:46:28 2008
@@ -17,7 +17,7 @@
   +--+
 */
 
-/* $Id: phar_object.c,v 1.266.2.2 2008/05/15 16:09:00 cellog Exp $ */
+/* $Id: phar_object.c,v 1.266.2.3 2008/05/15 23:46:28 cellog Exp $ */
 
 #include phar_internal.h
 #include func_interceptors.h
@@ -1999,6 +1999,7 @@
newentry.tmp = estrdup(newentry.tmp);
goto no_copy;
}
+   newentry.metadata_str.c = 0;
if (FAILURE == phar_copy_file_contents(newentry, phar-fp 
TSRMLS_CC)) {
zend_hash_destroy((phar-manifest));
php_stream_close(phar-fp);
@@ -3537,11 +3538,7 @@
zend_throw_exception_ex(spl_ce_BadMethodCallException, 0 
TSRMLS_CC, Write operations disabled by INI setting);
return;
}
-   if (phar_obj-arc.archive-is_tar) {
-   zend_throw_exception_ex(spl_ce_BadMethodCallException, 0 
TSRMLS_CC,
-   Cannot set metadata, not possible with tar-based phar 
archives);
-   return;
-   }
+
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, z, metadata) == 
FAILURE) {
return;
}
@@ -3553,6 +3550,7 @@
 
MAKE_STD_ZVAL(phar_obj-arc.archive-metadata);
ZVAL_ZVAL(phar_obj-arc.archive-metadata, metadata, 1, 0);
+   phar_obj-arc.archive-is_modified = 1;
 
phar_flush(phar_obj-arc.archive, 0, 0, 0, error TSRMLS_CC);
if (error) {
@@ -3574,14 +3572,11 @@
zend_throw_exception_ex(spl_ce_BadMethodCallException, 0 
TSRMLS_CC, Write operations disabled by INI setting);
return;
}
-   if (phar_obj-arc.archive-is_tar) {
-   zend_throw_exception_ex(spl_ce_BadMethodCallException, 0 
TSRMLS_CC,
-   Cannot delete metadata, not possible with tar-based 
phar archives);
-   return;
-   }
+
if (phar_obj-arc.archive-metadata) {
zval_ptr_dtor(phar_obj-arc.archive-metadata);
phar_obj-arc.archive-metadata = NULL;
+   phar_obj-arc.archive-is_modified = 1;
 
phar_flush(phar_obj-arc.archive, 0, 0, 0, error TSRMLS_CC);
if (error) {
@@ -4117,11 +4112,6 @@
zend_throw_exception_ex(spl_ce_BadMethodCallException, 0 
TSRMLS_CC, Write operations disabled by phar.readonly INI setting);
return;
}
-   if (entry_obj-ent.entry-is_tar) {
-   zend_throw_exception_ex(spl_ce_BadMethodCallException, 0 
TSRMLS_CC,
-   Cannot set metadata, not possible with tar-based phar 
archives);
-   return;
-   }
if (entry_obj-ent.entry-is_temp_dir) {
zend_throw_exception_ex(spl_ce_BadMethodCallException, 0 
TSRMLS_CC, \
Phar entry is a temporary directory (not an actual 
entry in the archive), cannot set metadata); \
@@ -4139,6 +4129,8 @@
MAKE_STD_ZVAL(entry_obj-ent.entry-metadata);
ZVAL_ZVAL(entry_obj-ent.entry-metadata, metadata, 1, 0);
 
+   entry_obj-ent.entry-is_modified = 1;
+   entry_obj-ent.entry-phar-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);
@@ -4159,11 +4151,6 @@
zend_throw_exception_ex(spl_ce_BadMethodCallException, 0 
TSRMLS_CC, Write operations disabled by phar.readonly INI setting);
return;
}
-   if (entry_obj-ent.entry-is_tar) {
-   zend_throw_exception_ex(spl_ce_BadMethodCallException, 0 
TSRMLS_CC,
-   Cannot delete metadata, not possible with tar-based 
phar archives);
-   return;
-   }
if (entry_obj-ent.entry-is_temp_dir) {
zend_throw_exception_ex(spl_ce_BadMethodCallException, 0 
TSRMLS_CC, \
Phar entry is a temporary directory (not an actual 
entry in the archive), cannot delete metadata); \
@@ -4172,6 +4159,8 @@
if (entry_obj-ent.entry-metadata) {

[PHP-CVS] cvs: php-src /ext/phar phar_object.c tar.c /ext/phar/tests badparameters.phpt pharfileinfo_setmetadata.phpt

2008-05-15 Thread Greg Beaver
cellog  Thu May 15 23:46:32 2008 UTC

  Modified files:  
/php-src/ext/phar   phar_object.c tar.c 
/php-src/ext/phar/tests badparameters.phpt 
pharfileinfo_setmetadata.phpt 
  Log:
  MFB: add full metadata support for tar-based archives and test
  http://cvs.php.net/viewvc.cgi/php-src/ext/phar/phar_object.c?r1=1.269r2=1.270diff_format=u
Index: php-src/ext/phar/phar_object.c
diff -u php-src/ext/phar/phar_object.c:1.269 
php-src/ext/phar/phar_object.c:1.270
--- php-src/ext/phar/phar_object.c:1.269Thu May 15 16:09:21 2008
+++ php-src/ext/phar/phar_object.c  Thu May 15 23:46:32 2008
@@ -17,7 +17,7 @@
   +--+
 */
 
-/* $Id: phar_object.c,v 1.269 2008/05/15 16:09:21 cellog Exp $ */
+/* $Id: phar_object.c,v 1.270 2008/05/15 23:46:32 cellog Exp $ */
 
 #include phar_internal.h
 #include func_interceptors.h
@@ -1999,6 +1999,7 @@
newentry.tmp = estrdup(newentry.tmp);
goto no_copy;
}
+   newentry.metadata_str.c = 0;
if (FAILURE == phar_copy_file_contents(newentry, phar-fp 
TSRMLS_CC)) {
zend_hash_destroy((phar-manifest));
php_stream_close(phar-fp);
@@ -3537,11 +3538,7 @@
zend_throw_exception_ex(spl_ce_BadMethodCallException, 0 
TSRMLS_CC, Write operations disabled by INI setting);
return;
}
-   if (phar_obj-arc.archive-is_tar) {
-   zend_throw_exception_ex(spl_ce_BadMethodCallException, 0 
TSRMLS_CC,
-   Cannot set metadata, not possible with tar-based phar 
archives);
-   return;
-   }
+
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, z, metadata) == 
FAILURE) {
return;
}
@@ -3553,6 +3550,7 @@
 
MAKE_STD_ZVAL(phar_obj-arc.archive-metadata);
ZVAL_ZVAL(phar_obj-arc.archive-metadata, metadata, 1, 0);
+   phar_obj-arc.archive-is_modified = 1;
 
phar_flush(phar_obj-arc.archive, 0, 0, 0, error TSRMLS_CC);
if (error) {
@@ -3574,14 +3572,11 @@
zend_throw_exception_ex(spl_ce_BadMethodCallException, 0 
TSRMLS_CC, Write operations disabled by INI setting);
return;
}
-   if (phar_obj-arc.archive-is_tar) {
-   zend_throw_exception_ex(spl_ce_BadMethodCallException, 0 
TSRMLS_CC,
-   Cannot delete metadata, not possible with tar-based 
phar archives);
-   return;
-   }
+
if (phar_obj-arc.archive-metadata) {
zval_ptr_dtor(phar_obj-arc.archive-metadata);
phar_obj-arc.archive-metadata = NULL;
+   phar_obj-arc.archive-is_modified = 1;
 
phar_flush(phar_obj-arc.archive, 0, 0, 0, error TSRMLS_CC);
if (error) {
@@ -4117,11 +4112,6 @@
zend_throw_exception_ex(spl_ce_BadMethodCallException, 0 
TSRMLS_CC, Write operations disabled by phar.readonly INI setting);
return;
}
-   if (entry_obj-ent.entry-is_tar) {
-   zend_throw_exception_ex(spl_ce_BadMethodCallException, 0 
TSRMLS_CC,
-   Cannot set metadata, not possible with tar-based phar 
archives);
-   return;
-   }
if (entry_obj-ent.entry-is_temp_dir) {
zend_throw_exception_ex(spl_ce_BadMethodCallException, 0 
TSRMLS_CC, \
Phar entry is a temporary directory (not an actual 
entry in the archive), cannot set metadata); \
@@ -4139,6 +4129,8 @@
MAKE_STD_ZVAL(entry_obj-ent.entry-metadata);
ZVAL_ZVAL(entry_obj-ent.entry-metadata, metadata, 1, 0);
 
+   entry_obj-ent.entry-is_modified = 1;
+   entry_obj-ent.entry-phar-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);
@@ -4159,11 +4151,6 @@
zend_throw_exception_ex(spl_ce_BadMethodCallException, 0 
TSRMLS_CC, Write operations disabled by phar.readonly INI setting);
return;
}
-   if (entry_obj-ent.entry-is_tar) {
-   zend_throw_exception_ex(spl_ce_BadMethodCallException, 0 
TSRMLS_CC,
-   Cannot delete metadata, not possible with tar-based 
phar archives);
-   return;
-   }
if (entry_obj-ent.entry-is_temp_dir) {
zend_throw_exception_ex(spl_ce_BadMethodCallException, 0 
TSRMLS_CC, \
Phar entry is a temporary directory (not an actual 
entry in the archive), cannot delete metadata); \
@@ -4172,6 +4159,8 @@
if (entry_obj-ent.entry-metadata) {
zval_ptr_dtor(entry_obj-ent.entry-metadata);
entry_obj-ent.entry-metadata = NULL;
+   

[PHP-CVS] cvs: php-src /ext/phar/tests/tar all.phpt

2008-05-15 Thread Greg Beaver
cellog  Thu May 15 23:46:54 2008 UTC

  Modified files:  
/php-src/ext/phar/tests/tar all.phpt 
  Log:
  MFB: add full metadata support for tar-based archives and test
  
http://cvs.php.net/viewvc.cgi/php-src/ext/phar/tests/tar/all.phpt?r1=1.1r2=1.2diff_format=u
Index: php-src/ext/phar/tests/tar/all.phpt
diff -u /dev/null php-src/ext/phar/tests/tar/all.phpt:1.2
--- /dev/null   Thu May 15 23:46:54 2008
+++ php-src/ext/phar/tests/tar/all.phpt Thu May 15 23:46:54 2008
@@ -0,0 +1,56 @@
+--TEST--
+Phar: test that creation of tar-based phar generates valid tar with all 
bells/whistles
+--SKIPIF--
+?php if (!extension_loaded(phar)) die(skip); ?
+?php if (!extension_loaded(spl)) die(skip SPL not available); ?
+?php if (!extension_loaded(zlib)) die(skip zlib not available); ?
+?php if (!extension_loaded(bz2)) die(skip bz2 not available); ?
+--INI--
+phar.readonly=0
+--FILE--
+?php
+
+$fname = dirname(__FILE__) . '/' . basename(__FILE__, '.php') . 
'.phar.tar.php';
+$pname = 'phar://' . $fname;
+$fname2 = dirname(__FILE__) . '/' . basename(__FILE__, '.php') . 
'.2.phar.tar.php';
+$pname2 = 'phar://' . $fname2;
+
+$phar = new Phar($fname);
+
+$phar-setMetadata('hi there');
+$phar['a'] = 'hi';
+$phar['a']-setMetadata('a meta');
+$phar['b'] = 'hi2';
+$phar['c'] = 'hi3';
+$phar['b']-chmod(0444);
+$phar-setStub(?php ok __HALT_COMPILER(););
+$phar-setAlias(hime);
+unset($phar);
+copy($fname, $fname2);
+Phar::unlinkArchive($fname);
+var_dump(file_exists($fname), file_exists($pname . '/a'));
+
+$phar = new Phar($fname2);
+var_dump($phar['a']-getContent(), $phar['b']-getContent(), 
$phar['c']-getContent());
+var_dump((string) decoct(fileperms($pname2 . '/b')));
+var_dump($phar-getStub());
+var_dump($phar-getAlias());
+var_dump($phar-getMetadata());
+var_dump($phar['a']-getMetadata());
+?
+===DONE===
+--CLEAN--
+?php unlink(dirname(__FILE__) . '/' . basename(__FILE__, '.clean.php') . 
'.2.phar.tar.php'); ?
+--EXPECT--
+bool(false)
+bool(false)
+string(2) hi
+string(3) hi2
+string(3) hi3
+string(6) 100444
+string(32) ?php ok __HALT_COMPILER(); ?
+
+string(4) hime
+string(8) hi there
+string(6) a meta
+===DONE===



-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-CVS] cvs: php-src(PHP_5_3) /ext/phar config.m4 config.w32

2008-05-15 Thread Greg Beaver
cellog  Fri May 16 00:01:56 2008 UTC

  Modified files:  (Branch: PHP_5_3)
/php-src/ext/phar   config.m4 config.w32 
  Log:
  as discussed on internals, enable phar by default for testing purposes.
  Phar is enabled as a shared extension by default in order to allow zlib/bz2 
to be built shared.  If phar is statically built,
  both zlib and bz2 must be statically built in order for phar to use them, so 
default compile as shared is much more flexible
  
http://cvs.php.net/viewvc.cgi/php-src/ext/phar/config.m4?r1=1.27r2=1.27.2.1diff_format=u
Index: php-src/ext/phar/config.m4
diff -u php-src/ext/phar/config.m4:1.27 php-src/ext/phar/config.m4:1.27.2.1
--- php-src/ext/phar/config.m4:1.27 Mon Jan 28 08:52:06 2008
+++ php-src/ext/phar/config.m4  Fri May 16 00:01:56 2008
@@ -1,8 +1,8 @@
-dnl $Id: config.m4,v 1.27 2008/01/28 08:52:06 cellog Exp $
+dnl $Id: config.m4,v 1.27.2.1 2008/05/16 00:01:56 cellog Exp $
 dnl config.m4 for extension phar
 
 PHP_ARG_ENABLE(phar, for phar archive support,
-[  --enable-phar   Enable phar support])
+[  --disable-phar   Disable phar support], shared)
 
 if test $PHP_PHAR != no; then
   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)
http://cvs.php.net/viewvc.cgi/php-src/ext/phar/config.w32?r1=1.27r2=1.27.2.1diff_format=u
Index: php-src/ext/phar/config.w32
diff -u php-src/ext/phar/config.w32:1.27 php-src/ext/phar/config.w32:1.27.2.1
--- php-src/ext/phar/config.w32:1.27Mon Jan 28 14:39:16 2008
+++ php-src/ext/phar/config.w32 Fri May 16 00:01:56 2008
@@ -1,7 +1,7 @@
-// $Id: config.w32,v 1.27 2008/01/28 14:39:16 sfox Exp $
+// $Id: config.w32,v 1.27.2.1 2008/05/16 00:01:56 cellog Exp $
 // vim:ft=javascript
 
-ARG_ENABLE(phar, enable phar support, no);
+ARG_ENABLE(phar, disable phar support, shared);
 
 if (PHP_PHAR != no) {
EXTENSION(phar, dirstream.c func_interceptors.c phar.c phar_object.c 
phar_path_check.c stream.c tar.c util.c zip.c);



-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-CVS] cvs: php-src(PHP_5_3) /ext/phar config.m4

2008-05-15 Thread Greg Beaver
cellog  Fri May 16 00:11:43 2008 UTC

  Modified files:  (Branch: PHP_5_3)
/php-src/ext/phar   config.m4 
  Log:
  cosmetics
  
http://cvs.php.net/viewvc.cgi/php-src/ext/phar/config.m4?r1=1.27.2.1r2=1.27.2.2diff_format=u
Index: php-src/ext/phar/config.m4
diff -u php-src/ext/phar/config.m4:1.27.2.1 php-src/ext/phar/config.m4:1.27.2.2
--- php-src/ext/phar/config.m4:1.27.2.1 Fri May 16 00:01:56 2008
+++ php-src/ext/phar/config.m4  Fri May 16 00:11:42 2008
@@ -1,8 +1,8 @@
-dnl $Id: config.m4,v 1.27.2.1 2008/05/16 00:01:56 cellog Exp $
+dnl $Id: config.m4,v 1.27.2.2 2008/05/16 00:11:42 cellog Exp $
 dnl config.m4 for extension phar
 
 PHP_ARG_ENABLE(phar, for phar archive support,
-[  --disable-phar   Disable phar support], shared)
+[  --disable-phar Disable phar support], shared)
 
 if test $PHP_PHAR != no; then
   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 CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-CVS] cvs: php-src(PHP_5_3) /ext/standard dl.c

2008-05-15 Thread Felipe Pena
felipe  Fri May 16 03:01:20 2008 UTC

  Modified files:  (Branch: PHP_5_3)
/php-src/ext/standard   dl.c 
  Log:
  - Added conversion to string.
  
  
http://cvs.php.net/viewvc.cgi/php-src/ext/standard/dl.c?r1=1.106.2.1.2.5.2.6r2=1.106.2.1.2.5.2.7diff_format=u
Index: php-src/ext/standard/dl.c
diff -u php-src/ext/standard/dl.c:1.106.2.1.2.5.2.6 
php-src/ext/standard/dl.c:1.106.2.1.2.5.2.7
--- php-src/ext/standard/dl.c:1.106.2.1.2.5.2.6 Thu Feb 28 16:59:10 2008
+++ php-src/ext/standard/dl.c   Fri May 16 03:01:20 2008
@@ -18,7 +18,7 @@
+--+
 */
 
-/* $Id: dl.c,v 1.106.2.1.2.5.2.6 2008/02/28 16:59:10 dmitry Exp $ */
+/* $Id: dl.c,v 1.106.2.1.2.5.2.7 2008/05/16 03:01:20 felipe Exp $ */
 
 #include php.h
 #include dl.h
@@ -55,9 +55,11 @@
 {
zval *filename;
 
-   if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, z, filename) == 
FAILURE) {
+   if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, z/, filename) 
== FAILURE) {
return;
}
+   
+   convert_to_string(filename);
 
if (!PG(enable_dl)) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, Dynamically loaded 
extensions aren't enabled);



-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-CVS] cvs: php-src /ext/standard dl.c

2008-05-15 Thread Felipe Pena
felipe  Fri May 16 03:11:56 2008 UTC

  Modified files:  
/php-src/ext/standard   dl.c 
  Log:
  - MFB: Added conversion to string.
  
  
http://cvs.php.net/viewvc.cgi/php-src/ext/standard/dl.c?r1=1.125r2=1.126diff_format=u
Index: php-src/ext/standard/dl.c
diff -u php-src/ext/standard/dl.c:1.125 php-src/ext/standard/dl.c:1.126
--- php-src/ext/standard/dl.c:1.125 Thu Feb 28 16:59:21 2008
+++ php-src/ext/standard/dl.c   Fri May 16 03:11:56 2008
@@ -18,7 +18,7 @@
+--+
 */
 
-/* $Id: dl.c,v 1.125 2008/02/28 16:59:21 dmitry Exp $ */
+/* $Id: dl.c,v 1.126 2008/05/16 03:11:56 felipe Exp $ */
 
 #include php.h
 #include dl.h
@@ -56,9 +56,11 @@
 {
zval *filename;
 
-   if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, z, filename) == 
FAILURE) {
+   if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, z/, filename) 
== FAILURE) {
return;
}
+   
+   convert_to_string(filename);
 
if (Z_STRLEN_P(filename) = MAXPATHLEN) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, File name exceeds 
the maximum allowed length of %d characters, MAXPATHLEN);



-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php