[PHP-CVS] com php-src: Merge branch 'PHP-5.4' into PHP-5.5: ext/dom/document.c main/streams/plain_wrapper.c

2013-12-06 Thread Michael Wallner
Commit:a48d82d23824a1d81e3ab847774476485f9388a5
Author:Michael Wallner  Fri, 6 Dec 2013 10:33:10 +0100
Parents:   32a4cc8353ff94d107611f00e7376e8e1baae926 
b5f5bff965c1a27a4820d0129d61f80ef8894e38
Branches:  PHP-5.5 PHP-5.6 master

Link:   
http://git.php.net/?p=php-src.git;a=commitdiff;h=a48d82d23824a1d81e3ab847774476485f9388a5

Log:
Merge branch 'PHP-5.4' into PHP-5.5

* PHP-5.4:
  Fixed bug #61645 (fopen and O_NONBLOCK)
  fix possibly uninitialized value

Bugs:
https://bugs.php.net/61645

Changed paths:
  MM  ext/dom/document.c
  MM  main/streams/plain_wrapper.c


Diff:



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



[PHP-CVS] com php-src: BFN: NEWS

2013-12-06 Thread Michael Wallner
Commit:51f01a43a71df8316c22b4e1eeb0f3858cb25f71
Author:Michael Wallner  Fri, 6 Dec 2013 10:39:02 +0100
Parents:   a48d82d23824a1d81e3ab847774476485f9388a5
Branches:  PHP-5.5 PHP-5.6 master

Link:   
http://git.php.net/?p=php-src.git;a=commitdiff;h=51f01a43a71df8316c22b4e1eeb0f3858cb25f71

Log:
BFN

Changed paths:
  M  NEWS


Diff:
diff --git a/NEWS b/NEWS
index 88a7129..8b83337 100644
--- a/NEWS
+++ b/NEWS
@@ -8,6 +8,7 @@ PHP 
   NEWS
 (Nikita)
   . Fixed bug #65764 (generators/throw_rethrow FAIL with
 ZEND_COMPILE_EXTENDED_INFO). (Nikita)
+  . Fixed bug #61645 (fopen and O_NONBLOCK). (Mike)
 
 - Date:
   . Fixed bug #66060 (Heap buffer over-read in DateInterval). (Remi)


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



[PHP-CVS] com php-src: Fixed bug #61645 (fopen and O_NONBLOCK): NEWS main/streams/plain_wrapper.c

2013-12-06 Thread Michael Wallner
Commit:b5f5bff965c1a27a4820d0129d61f80ef8894e38
Author:Michael Wallner  Fri, 6 Dec 2013 10:29:24 +0100
Parents:   098d2a5d0ff6353602654a9872c76c5811277546
Branches:  PHP-5.4 PHP-5.5 PHP-5.6 master

Link:   
http://git.php.net/?p=php-src.git;a=commitdiff;h=b5f5bff965c1a27a4820d0129d61f80ef8894e38

Log:
Fixed bug #61645 (fopen and O_NONBLOCK)

if a mode like "rn" was passed to fopen(), then
php_stream_parse_fopen_modes() would assign O_WRONLY to
flags, because O_NONBLOCK tainted flags for the r/w/+ check

Bugs:
https://bugs.php.net/61645

Changed paths:
  M  NEWS
  M  main/streams/plain_wrapper.c


Diff:
diff --git a/NEWS b/NEWS
index c0379f8..c601a8a 100644
--- a/NEWS
+++ b/NEWS
@@ -4,6 +4,7 @@ PHP 
   NEWS
 
 - Core:
   . Added validation of class names in the autoload process. (Dmitry)
+  . Fixed bug #61645 (fopen and O_NONBLOCK). (Mike)
 
 - Date:
   . Fixed bug #66060 (Heap buffer over-read in DateInterval). (Remi)
diff --git a/main/streams/plain_wrapper.c b/main/streams/plain_wrapper.c
index 4ee8150..c188763 100644
--- a/main/streams/plain_wrapper.c
+++ b/main/streams/plain_wrapper.c
@@ -78,11 +78,7 @@ PHPAPI int php_stream_parse_fopen_modes(const char *mode, 
int *open_flags)
/* unknown mode */
return FAILURE;
}
-#if defined(O_NONBLOCK)
-   if (strchr(mode, 'n')) {
-   flags |= O_NONBLOCK;
-   }
-#endif
+
if (strchr(mode, '+')) {
flags |= O_RDWR;
} else if (flags) {
@@ -91,6 +87,12 @@ PHPAPI int php_stream_parse_fopen_modes(const char *mode, 
int *open_flags)
flags |= O_RDONLY;
}
 
+#if defined(O_NONBLOCK)
+   if (strchr(mode, 'n')) {
+   flags |= O_NONBLOCK;
+   }
+#endif
+
 #if defined(_O_TEXT) && defined(O_BINARY)
if (strchr(mode, 't')) {
flags |= _O_TEXT;


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



[PHP-CVS] com php-src: BFN: NEWS UPGRADING

2013-12-05 Thread Michael Wallner
Commit:ecf95a4cc5ef0168b0669cc659cad83eb7807efd
Author:Michael Wallner  Thu, 5 Dec 2013 11:30:52 +0100
Parents:   44ff944b37985cbe016c89ee7229710cdc342a52
Branches:  master

Link:   
http://git.php.net/?p=php-src.git;a=commitdiff;h=ecf95a4cc5ef0168b0669cc659cad83eb7807efd

Log:
BFN

Changed paths:
  M  NEWS
  M  UPGRADING


Diff:
diff --git a/NEWS b/NEWS
index e527eee..a1fa83c 100644
--- a/NEWS
+++ b/NEWS
@@ -2,6 +2,8 @@ PHP 
   NEWS
 |||
 ?? ??? 20??, PHP 5.7.0 
 
+- DBA:
+  . Fixed bug #62490 (dba_delete returns true on missing item (inifile)). 
(Mike)
 - XSL:
   . Fixed bug #64776 (The XSLT extension is not thread safe). (Mike)
 
diff --git a/UPGRADING b/UPGRADING
index e086188..f5e36fe 100755
--- a/UPGRADING
+++ b/UPGRADING
@@ -20,6 +20,9 @@ PHP X.Y UPGRADE NOTES
 1. Backward Incompatible Changes
 
 
+- DBA
+  . dba_delete() now returns false if the key was not found for the inifile 
+handler, too.
 
 
 2. New Features


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



[PHP-CVS] com php-src: fix php_stream_copy_to_stream_ex usage: ext/dba/libinifile/inifile.c

2013-12-05 Thread Michael Wallner
Commit:9e309a2d10d9696d047ecb442189b5428dc81e43
Author:Michael Wallner  Tue, 3 Dec 2013 17:55:18 +0100
Parents:   a7f0465c0b295e01768cc4cccebcfb4da2cab596
Branches:  master

Link:   
http://git.php.net/?p=php-src.git;a=commitdiff;h=9e309a2d10d9696d047ecb442189b5428dc81e43

Log:
fix php_stream_copy_to_stream_ex usage

Changed paths:
  M  ext/dba/libinifile/inifile.c


Diff:
diff --git a/ext/dba/libinifile/inifile.c b/ext/dba/libinifile/inifile.c
index cc09b3d..d6d311c 100644
--- a/ext/dba/libinifile/inifile.c
+++ b/ext/dba/libinifile/inifile.c
@@ -402,7 +402,7 @@ static int inifile_copy_to(inifile *dba, size_t pos_start, 
size_t pos_end, inifi
return FAILURE;
}
php_stream_seek(dba->fp, pos_start, SEEK_SET);
-   if (!php_stream_copy_to_stream_ex(dba->fp, fp, pos_end - pos_start, 
NULL)) {
+   if (SUCCESS != php_stream_copy_to_stream_ex(dba->fp, fp, pos_end - 
pos_start, NULL)) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Could not copy 
group [%zu - %zu] to temporary stream", pos_start, pos_end);
return FAILURE;
} 
@@ -427,7 +427,7 @@ static int inifile_filter(inifile *dba, inifile *from, 
const key_type *key TSRML
pos_curr = php_stream_tell(from->fp);
if (pos_start != pos_next) {
php_stream_seek(from->fp, pos_start, SEEK_SET);
-   if (!php_stream_copy_to_stream_ex(from->fp, 
dba->fp, pos_next - pos_start, NULL)) {
+   if (SUCCESS != 
php_stream_copy_to_stream_ex(from->fp, dba->fp, pos_next - pos_start, NULL)) {
php_error_docref(NULL TSRMLS_CC, 
E_WARNING, "Could not copy [%zu - %zu] from temporary stream", pos_next, 
pos_start);
ret = FAILURE;
}
@@ -446,7 +446,7 @@ static int inifile_filter(inifile *dba, inifile *from, 
const key_type *key TSRML
}
if (pos_start != pos_next) {
php_stream_seek(from->fp, pos_start, SEEK_SET);
-   if (!php_stream_copy_to_stream_ex(from->fp, dba->fp, pos_next - 
pos_start, NULL)) {
+   if (SUCCESS != php_stream_copy_to_stream_ex(from->fp, dba->fp, 
pos_next - pos_start, NULL)) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Could not 
copy [%zu - %zu] from temporary stream", pos_next, pos_start);
ret = FAILURE;
}
@@ -497,7 +497,7 @@ static int inifile_delete_replace_append(inifile *dba, 
const key_type *key, cons
php_stream_seek(dba->fp, 0, SEEK_END);
if (pos_grp_next != (size_t)php_stream_tell(dba->fp)) {
php_stream_seek(dba->fp, pos_grp_next, 
SEEK_SET);
-   if (!php_stream_copy_to_stream_ex(dba->fp, 
fp_tmp, PHP_STREAM_COPY_ALL, NULL)) {
+   if (SUCCESS != 
php_stream_copy_to_stream_ex(dba->fp, fp_tmp, PHP_STREAM_COPY_ALL, NULL)) {
php_error_docref(NULL TSRMLS_CC, 
E_WARNING, "Could not copy remainder to temporary stream");
ret = FAILURE;
}
@@ -538,7 +538,7 @@ static int inifile_delete_replace_append(inifile *dba, 
const key_type *key, cons
if (fp_tmp && php_stream_tell(fp_tmp)) {
php_stream_seek(fp_tmp, 0, SEEK_SET);
php_stream_seek(dba->fp, 0, SEEK_END);
-   if (!php_stream_copy_to_stream_ex(fp_tmp, dba->fp, 
PHP_STREAM_COPY_ALL, NULL)) {
+   if (SUCCESS != php_stream_copy_to_stream_ex(fp_tmp, 
dba->fp, PHP_STREAM_COPY_ALL, NULL)) {
php_error_docref(NULL TSRMLS_CC, 
E_RECOVERABLE_ERROR, "Could not copy from temporary stream - ini file 
truncated");
ret = FAILURE;
}


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



[PHP-CVS] com php-src: fix test: ext/dba/tests/dba_inifile.phpt

2013-12-05 Thread Michael Wallner
Commit:b0415856fddd93ddb02a00c56953707be199c2a9
Author:Michael Wallner  Tue, 3 Dec 2013 17:55:26 +0100
Parents:   9e309a2d10d9696d047ecb442189b5428dc81e43
Branches:  master

Link:   
http://git.php.net/?p=php-src.git;a=commitdiff;h=b0415856fddd93ddb02a00c56953707be199c2a9

Log:
fix test

Changed paths:
  M  ext/dba/tests/dba_inifile.phpt


Diff:
diff --git a/ext/dba/tests/dba_inifile.phpt b/ext/dba/tests/dba_inifile.phpt
index f8102b2..ae06aee 100644
--- a/ext/dba/tests/dba_inifile.phpt
+++ b/ext/dba/tests/dba_inifile.phpt
@@ -23,7 +23,7 @@ Content String 2
 Content 2 replaced
 Read during write: not allowed
 "key number 6" written
-Failed to write "key number 6" 2nd time
+"key number 6" written 2nd time
 Content 2 replaced 2nd time
 The 6th value
 array(3) {
@@ -40,7 +40,7 @@ Content String 2
 Content 2 replaced
 Read during write: not allowed
 "key number 6" written
-Failed to write "key number 6" 2nd time
+"key number 6" written 2nd time
 Content 2 replaced 2nd time
 The 6th value
 array(3) {


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



[PHP-CVS] com php-src: remove test for already removed feature: ext/dba/tests/dba_db4_010.phpt

2013-12-05 Thread Michael Wallner
Commit:f4912e3a96b1f00128abf934c43319490c2d4c5f
Author:Michael Wallner  Tue, 3 Dec 2013 16:57:35 +0100
Parents:   48cc47d55aedce5b90ac1458f4c2c3f6240f3019
Branches:  master

Link:   
http://git.php.net/?p=php-src.git;a=commitdiff;h=f4912e3a96b1f00128abf934c43319490c2d4c5f

Log:
remove test for already removed feature

Changed paths:
  D  ext/dba/tests/dba_db4_010.phpt


Diff:
diff --git a/ext/dba/tests/dba_db4_010.phpt b/ext/dba/tests/dba_db4_010.phpt
deleted file mode 100644
index fb31f05..000
--- a/ext/dba/tests/dba_db4_010.phpt
+++ /dev/null
@@ -1,38 +0,0 @@
---TEST--
-DBA DB4 magic_quotes_runtime Test
---SKIPIF--
-
---FILE--
-
---CLEAN--
-
---EXPECTF--
-database handler: db4
-string(1) """
-string(2) "\""
-string(2) "\""
-string(1) """


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



[PHP-CVS] com php-src: add missing clean section: ext/dba/tests/dba_inifile.phpt

2013-12-05 Thread Michael Wallner
Commit:a7f0465c0b295e01768cc4cccebcfb4da2cab596
Author:Michael Wallner  Tue, 3 Dec 2013 17:07:40 +0100
Parents:   f4912e3a96b1f00128abf934c43319490c2d4c5f
Branches:  master

Link:   
http://git.php.net/?p=php-src.git;a=commitdiff;h=a7f0465c0b295e01768cc4cccebcfb4da2cab596

Log:
add missing clean section

Changed paths:
  M  ext/dba/tests/dba_inifile.phpt


Diff:
diff --git a/ext/dba/tests/dba_inifile.phpt b/ext/dba/tests/dba_inifile.phpt
index 5975d25..f8102b2 100644
--- a/ext/dba/tests/dba_inifile.phpt
+++ b/ext/dba/tests/dba_inifile.phpt
@@ -12,6 +12,10 @@ DBA INIFILE handler test
require_once dirname(__FILE__) .'/dba_handler.inc';
 ?>
 ===DONE===
+--CLEAN--
+
 --EXPECT--
 database handler: inifile
 3NYNYY


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



[PHP-CVS] com php-src: more test fixes: ext/dba/tests/dba_db4_003.phpt ext/dba/tests/dba_db4_007.phpt ext/dba/tests/dba_handler.inc ext/dba/tests/dba_tcadb.phpt

2013-12-05 Thread Michael Wallner
Commit:f0c85fab45b22dae6cbb2392d0192d7fd924d274
Author:Michael Wallner  Tue, 3 Dec 2013 18:18:40 +0100
Parents:   b0415856fddd93ddb02a00c56953707be199c2a9
Branches:  master

Link:   
http://git.php.net/?p=php-src.git;a=commitdiff;h=f0c85fab45b22dae6cbb2392d0192d7fd924d274

Log:
more test fixes

Changed paths:
  M  ext/dba/tests/dba_db4_003.phpt
  M  ext/dba/tests/dba_db4_007.phpt
  M  ext/dba/tests/dba_handler.inc
  M  ext/dba/tests/dba_tcadb.phpt


Diff:
diff --git a/ext/dba/tests/dba_db4_003.phpt b/ext/dba/tests/dba_db4_003.phpt
index 7e8568c..8708170 100644
--- a/ext/dba/tests/dba_db4_003.phpt
+++ b/ext/dba/tests/dba_db4_003.phpt
@@ -39,8 +39,6 @@ require(dirname(__FILE__) .'/clean.inc');
 database handler: db4
 int(14)
 
-Notice: dba_open(): %stest0.dbm: unexpected file type or format in 
%sdba_db4_003.php on line %d
-
 Warning: dba_open(%stest0.dbm,c): Driver initialization failed for handler: 
db4: Invalid argument in %sdba_db4_003.php on line %d
 Error creating %stest0.dbm
 Dummy contents
diff --git a/ext/dba/tests/dba_db4_007.phpt b/ext/dba/tests/dba_db4_007.phpt
index bd95e0b..027d0af 100644
--- a/ext/dba/tests/dba_db4_007.phpt
+++ b/ext/dba/tests/dba_db4_007.phpt
@@ -35,7 +35,5 @@ require(dirname(__FILE__) .'/clean.inc');
 database handler: db4
 int(14)
 
-Notice: dba_popen(): %stest0.dbm: unexpected file type or format in 
%sdba_db4_007.php on line %d
-
 Warning: dba_popen(%stest0.dbm,c): Driver initialization failed for handler: 
db4: Invalid argument in %sdba_db4_007.php on line %d
 Error creating %stest0.dbm
diff --git a/ext/dba/tests/dba_handler.inc b/ext/dba/tests/dba_handler.inc
index a950e90..ed2a524 100644
--- a/ext/dba/tests/dba_handler.inc
+++ b/ext/dba/tests/dba_handler.inc
@@ -82,7 +82,7 @@ do {
dba_close($dba_reader);
}
if (($db_file = dba_popen($db_filename, 'r'.($lock_flag==''?'':'-'), 
$handler))!==FALSE) {
-   if ($handler == 'dbm') {
+   if ($handler == 'dbm' || $handler == "tcadb") {
dba_close($db_file);
}
}
diff --git a/ext/dba/tests/dba_tcadb.phpt b/ext/dba/tests/dba_tcadb.phpt
index 28b6dd8..f75aa81 100644
--- a/ext/dba/tests/dba_tcadb.phpt
+++ b/ext/dba/tests/dba_tcadb.phpt
@@ -16,6 +16,12 @@ DBA TCADB handler test
require_once dirname(__FILE__) .'/dba_handler.inc';
 ?>
 ===DONE===
+--CLEAN--
+
 --EXPECT--
 database handler: tcadb
 3NYNYY


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



[PHP-CVS] com php-src: BFN: NEWS

2013-12-03 Thread Michael Wallner
Commit:ffbb56685ff316e89161a80911b71039e4544184
Author:Michael Wallner  Mon, 2 Dec 2013 17:02:01 +0100
Parents:   9c0a70c1de5ff0f53167822ddd445918db2fb482
Branches:  PHP-5.5 PHP-5.6 master

Link:   
http://git.php.net/?p=php-src.git;a=commitdiff;h=ffbb56685ff316e89161a80911b71039e4544184

Log:
BFN

Changed paths:
  M  NEWS


Diff:
diff --git a/NEWS b/NEWS
index 0815ca0..792aa27 100644
--- a/NEWS
+++ b/NEWS
@@ -13,6 +13,10 @@ PHP  
  NEWS
   . Fixed bug #66060 (Heap buffer over-read in DateInterval). (Remi)
   . Fixed bug #65768 (DateTimeImmutable::diff does not work). (Nikita Nefedov)
   
+- DOM:
+  . Fixed bug #65196 (Passing DOMDocumentFragment to DOMDocument::saveHTML() 
+Produces invalid Markup). (Mike)
+
 - Sockets:
   . Fixed bug #65923 (ext/socket assumes AI_V4MAPPED is defined). (Felipe)


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



[PHP-CVS] com php-src: BFN: NEWS

2013-12-02 Thread Michael Wallner
Commit:6eae92741345515c0f55d1b1672c9463eee60463
Author:Michael Wallner  Mon, 2 Dec 2013 12:14:26 +0100
Parents:   e4b310d2a9843db7f054acfd569e2e48085c87d6
Branches:  PHP-5.5 PHP-5.6 master

Link:   
http://git.php.net/?p=php-src.git;a=commitdiff;h=6eae92741345515c0f55d1b1672c9463eee60463

Log:
BFN

Changed paths:
  M  NEWS


Diff:
diff --git a/NEWS b/NEWS
index f4b3bf8..0815ca0 100644
--- a/NEWS
+++ b/NEWS
@@ -16,6 +16,10 @@ PHP  
  NEWS
 - Sockets:
   . Fixed bug #65923 (ext/socket assumes AI_V4MAPPED is defined). (Felipe)
 
+- XSL
+  . Fixed bug #49634 (Segfault throwing an exception in a XSL registered
+function). (Mike)
+
 ?? ??? 2013, PHP 5.5.7
 
 - CLI server:


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



[PHP-CVS] com php-src: Fix bug #65196: NEWS ext/dom/document.c ext/dom/tests/bug65196.phpt

2013-12-02 Thread Michael Wallner
Commit:22fa3fbc5ffe75349c0edb6b776b6fb1168cb21c
Author:Michael Wallner  Mon, 2 Dec 2013 16:58:34 +0100
Parents:   6408a1a59e6d371cd488687e28e18815ea97984e
Branches:  PHP-5.4 PHP-5.5 PHP-5.6 master

Link:   
http://git.php.net/?p=php-src.git;a=commitdiff;h=22fa3fbc5ffe75349c0edb6b776b6fb1168cb21c

Log:
Fix bug #65196

Passing DOMDocumentFragment to DOMDocument::saveHTML()
produces invalid markup, because a DocumentFragment is just a container
for child nodes and not a real node itself.

Bugs:
https://bugs.php.net/65196

Changed paths:
  M  NEWS
  M  ext/dom/document.c
  A  ext/dom/tests/bug65196.phpt


Diff:
diff --git a/NEWS b/NEWS
index bf759c8..3b20898 100644
--- a/NEWS
+++ b/NEWS
@@ -11,6 +11,10 @@ PHP  
  NEWS
 1600). (Derick, T. Carter)
   . Fixed bug #61599 (Wrong Day of Week). (Derick, T. Carter)
 
+- DOM:
+  . Fixed bug #65196 (Passing DOMDocumentFragment to DOMDocument::saveHTML() 
+Produces invalid Markup). (Mike)
+
 - XSL
   . Fixed bug #49634 (Segfault throwing an exception in a XSL registered
 function). (Mike)
diff --git a/ext/dom/document.c b/ext/dom/document.c
index d17c7cb..0826863 100644
--- a/ext/dom/document.c
+++ b/ext/dom/document.c
@@ -2324,7 +2324,22 @@ PHP_FUNCTION(dom_document_save_html)
RETURN_FALSE;
}

-   size = htmlNodeDump(buf, docp, node);
+   if (node->type == XML_DOCUMENT_FRAG_NODE) {
+   int one_size;
+
+   for (node = node->children; node; node = node->next) {
+   one_size = htmlNodeDump(buf, docp, node);
+
+   if (one_size >= 0) {
+   size += one_size;
+   } else {
+   size = -1;
+   break;
+   }
+   }
+   } else {
+   size = htmlNodeDump(buf, docp, node);
+   }
if (size >= 0) {
mem = (xmlChar*) xmlBufferContent(buf);
if (!mem) {
diff --git a/ext/dom/tests/bug65196.phpt b/ext/dom/tests/bug65196.phpt
new file mode 100644
index 000..c77f972
--- /dev/null
+++ b/ext/dom/tests/bug65196.phpt
@@ -0,0 +1,26 @@
+--TEST--
+bug #65196 (Passing DOMDocumentFragment to DOMDocument::saveHTML() Produces 
invalid Markup)
+--SKIPIF--
+
+--FILE--
+createDocumentFragment();
+var_dump($dom->saveHTML($frag1));
+
+$frag2 = $dom->createDocumentFragment();
+$div = $dom->createElement('div');
+$div->appendChild($dom->createElement('span'));
+$frag2->appendChild($div);
+$frag2->appendChild($dom->createElement('div'));
+$frag2->appendChild($dom->createElement('div'));
+var_dump($dom->saveHTML($frag2));
+?>
+===DONE===
+--EXPECT--
+string(0) ""
+string(46) ""
+===DONE===


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



[PHP-CVS] com php-src: Merged PR #293 (Exif crash on unknown encoding was fixed) By: Draal Conflicts: configure.in main/php_version.h: ext/exif/exif.c ext/exif/tests/exif_encoding_crash.jpg ext/exi

2013-10-23 Thread Michael Wallner
Commit:1b43f9504020a1fa607eb58b81defaba9d8cfd6b
Author:Michael Wallner  Mon, 21 Oct 2013 21:48:27 
+0200
Parents:   2ecf94e07efae6059e40069a7c1a895514c24466
Branches:  PHP-5.4 PHP-5.5 master

Link:   
http://git.php.net/?p=php-src.git;a=commitdiff;h=1b43f9504020a1fa607eb58b81defaba9d8cfd6b

Log:
Merged PR #293 (Exif crash on unknown encoding was fixed)
By:
Draal
Conflicts:
configure.in
main/php_version.h

Bugs:
https://bugs.php.net/293

Changed paths:
  M  ext/exif/exif.c
  A  ext/exif/tests/exif_encoding_crash.jpg
  A  ext/exif/tests/exif_encoding_crash.phpt


Diff:
diff --git a/ext/exif/exif.c b/ext/exif/exif.c
index bd646d9..2fe54f7 100644
--- a/ext/exif/exif.c
+++ b/ext/exif/exif.c
@@ -2643,6 +2643,7 @@ static int exif_process_user_comment(image_info_type 
*ImageInfo, char **pszInfoP
} else {
decode = ImageInfo->decode_unicode_le;
}
+   /* XXX this will fail again if encoding_converter 
returns on error something different than SIZE_MAX   */
if (zend_multibyte_encoding_converter(
(unsigned char**)pszInfoPtr, 
&len, 
@@ -2650,7 +2651,7 @@ static int exif_process_user_comment(image_info_type 
*ImageInfo, char **pszInfoP
ByteCount,

zend_multibyte_fetch_encoding(ImageInfo->encode_unicode TSRMLS_CC),
zend_multibyte_fetch_encoding(decode 
TSRMLS_CC)
-   TSRMLS_CC) < 0) {
+   TSRMLS_CC) == (size_t)-1) {
len = exif_process_string_raw(pszInfoPtr, 
szValuePtr, ByteCount);
}
return len;
@@ -2663,6 +2664,7 @@ static int exif_process_user_comment(image_info_type 
*ImageInfo, char **pszInfoP
*pszEncoding = estrdup((const char*)szValuePtr);
szValuePtr = szValuePtr+8;
ByteCount -= 8;
+   /* XXX this will fail again if encoding_converter 
returns on error something different than SIZE_MAX   */
if (zend_multibyte_encoding_converter(
(unsigned char**)pszInfoPtr, 
&len, 
@@ -2670,7 +2672,7 @@ static int exif_process_user_comment(image_info_type 
*ImageInfo, char **pszInfoP
ByteCount,

zend_multibyte_fetch_encoding(ImageInfo->encode_jis TSRMLS_CC),

zend_multibyte_fetch_encoding(ImageInfo->motorola_intel ? 
ImageInfo->decode_jis_be : ImageInfo->decode_jis_le TSRMLS_CC)
-   TSRMLS_CC) < 0) {
+   TSRMLS_CC) == (size_t)-1) {
len = exif_process_string_raw(pszInfoPtr, 
szValuePtr, ByteCount);
}
return len;
@@ -2700,8 +2702,8 @@ static int exif_process_user_comment(image_info_type 
*ImageInfo, char **pszInfoP
 static int exif_process_unicode(image_info_type *ImageInfo, xp_field_type 
*xp_field, int tag, char *szValuePtr, int ByteCount TSRMLS_DC)
 {
xp_field->tag = tag;
-
-   /* Copy the comment */
+   
+   /* XXX this will fail again if encoding_converter returns on error 
something different than SIZE_MAX   */
if (zend_multibyte_encoding_converter(
(unsigned char**)&xp_field->value, 
&xp_field->size, 
@@ -2709,7 +2711,7 @@ static int exif_process_unicode(image_info_type 
*ImageInfo, xp_field_type *xp_fi
ByteCount,
zend_multibyte_fetch_encoding(ImageInfo->encode_unicode 
TSRMLS_CC),
zend_multibyte_fetch_encoding(ImageInfo->motorola_intel 
? ImageInfo->decode_unicode_be : ImageInfo->decode_unicode_le TSRMLS_CC)
-   TSRMLS_CC) < 0) {
+   TSRMLS_CC) == (size_t)-1) {
xp_field->size = exif_process_string_raw(&xp_field->value, 
szValuePtr, ByteCount);
}
return xp_field->size;
diff --git a/ext/exif/tests/exif_encoding_crash.jpg 
b/ext/exif/tests/exif_encoding_crash.jpg
new file mode 100644
index 000..55138ab
Binary files /dev/null and b/ext/exif/tests/exif_encoding_crash.jpg differ
diff --git a/ext/exif/tests/exif_encoding_crash.phpt 
b/ext/exif/tests/exif_encoding_crash.phpt
new file mode 100644
index 000..1c4ad63
--- /dev/null
+++ b/ext/exif/tests/exif_encoding_crash.phpt
@@ -0,0 +1,14 @@
+--TEST--
+PHP crash when zend_multibyte_encoding_converter returns (s

[PHP-CVS] com php-src: Dont reset other counters when incrementing slow_rq: sapi/fpm/fpm/fpm_php_trace.c sapi/fpm/fpm/fpm_scoreboard.c

2013-10-22 Thread Michael Wallner
Commit:3fd5a4055634a62efa7a635d29f9b19e440d842b
Author:Karsten Schmidt  Wed, 20 Feb 2013 
18:53:17 +0100
Parents:   39fb14acb7aa39c9c7f9a070d0871f0a240c4369
Branches:  master

Link:   
http://git.php.net/?p=php-src.git;a=commitdiff;h=3fd5a4055634a62efa7a635d29f9b19e440d842b

Log:
Dont reset other counters when incrementing slow_rq

Changed paths:
  M  sapi/fpm/fpm/fpm_php_trace.c
  M  sapi/fpm/fpm/fpm_scoreboard.c


Diff:
diff --git a/sapi/fpm/fpm/fpm_php_trace.c b/sapi/fpm/fpm/fpm_php_trace.c
index d95d66a..925f2de 100644
--- a/sapi/fpm/fpm/fpm_php_trace.c
+++ b/sapi/fpm/fpm/fpm_php_trace.c
@@ -138,7 +138,7 @@ static int fpm_php_trace_dump(struct fpm_child_s *child, 
FILE *slowlog TSRMLS_DC
 void fpm_php_trace(struct fpm_child_s *child) /* {{{ */
 {
TSRMLS_FETCH();
-   fpm_scoreboard_update(0, 0, 0, 0, 0, 0, 1, FPM_SCOREBOARD_ACTION_SET, 
child->wp->scoreboard);
+   fpm_scoreboard_update(0, 0, 0, 0, 0, 0, 1, FPM_SCOREBOARD_ACTION_INC, 
child->wp->scoreboard);
FILE *slowlog;
 
zlog(ZLOG_NOTICE, "about to trace %d", (int) child->pid);
diff --git a/sapi/fpm/fpm/fpm_scoreboard.c b/sapi/fpm/fpm/fpm_scoreboard.c
index 24463a9..8d08681 100644
--- a/sapi/fpm/fpm/fpm_scoreboard.c
+++ b/sapi/fpm/fpm/fpm_scoreboard.c
@@ -111,7 +111,7 @@ void fpm_scoreboard_update(int idle, int active, int lq, 
int lq_len, int request
scoreboard->max_children_reached = max_children_reached;
}
if (slow_rq > 0) {
-   scoreboard->slow_rq += slow_rq;
+   scoreboard->slow_rq = slow_rq;
}
} else {
if (scoreboard->idle + idle > 0) {
@@ -137,6 +137,12 @@ void fpm_scoreboard_update(int idle, int active, int lq, 
int lq_len, int request
} else {
scoreboard->max_children_reached = 0;
}
+
+   if (scoreboard->slow_rq + slow_rq > 0) {
+   scoreboard->slow_rq += slow_rq;
+   } else {
+   scoreboard->slow_rq = 0;
+   }
}
 
if (scoreboard->active > scoreboard->active_max) {


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



[PHP-CVS] com php-src: Merge branch 'PHP-5.4' into PHP-5.5: ext/standard/tests/file/disk_free_space_basic.phpt

2013-10-21 Thread Michael Wallner
Commit:825174e48073005d408c5a5b6be942dbd9be8e54
Author:Michael Wallner  Mon, 21 Oct 2013 12:18:10 
+0200
Parents:   098855433dc5d609e3970f0bc9d6766c007273f3 
2ecf94e07efae6059e40069a7c1a895514c24466
Branches:  PHP-5.5 master

Link:   
http://git.php.net/?p=php-src.git;a=commitdiff;h=825174e48073005d408c5a5b6be942dbd9be8e54

Log:
Merge branch 'PHP-5.4' into PHP-5.5

* PHP-5.4:
  Just SKIP that test on travis

Changed paths:
  MM  ext/standard/tests/file/disk_free_space_basic.phpt


Diff:



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



[PHP-CVS] com php-src: Just SKIP that test on travis: ext/standard/tests/file/disk_free_space_basic.phpt

2013-10-21 Thread Michael Wallner
Commit:2ecf94e07efae6059e40069a7c1a895514c24466
Author:Michael Wallner  Mon, 21 Oct 2013 12:16:41 
+0200
Parents:   f860486de5805eefd63af5d750c913e1515970c8
Branches:  PHP-5.4

Link:   
http://git.php.net/?p=php-src.git;a=commitdiff;h=2ecf94e07efae6059e40069a7c1a895514c24466

Log:
Just SKIP that test on travis

Changed paths:
  M  ext/standard/tests/file/disk_free_space_basic.phpt


Diff:
diff --git a/ext/standard/tests/file/disk_free_space_basic.phpt 
b/ext/standard/tests/file/disk_free_space_basic.phpt
index 7ea8d36..9dc663a 100644
--- a/ext/standard/tests/file/disk_free_space_basic.phpt
+++ b/ext/standard/tests/file/disk_free_space_basic.phpt
@@ -1,5 +1,9 @@
 --TEST--
 Test disk_free_space and its alias diskfreespace() functions : basic 
functionality
+--SKIPIF--
+
 --INI--
 memory_limit=32M
 --FILE--


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



[PHP-CVS] com php-src: Merge branch 'PHP-5.5': ext/standard/tests/file/disk_free_space_basic.phpt

2013-10-21 Thread Michael Wallner
Commit:6764993358f2da19896f1c0ca6a114af744125dc
Author:Michael Wallner  Mon, 21 Oct 2013 12:21:21 
+0200
Parents:   454a9fcb14c62384bd223c1d5668701061cf647f 
fb610b4e808c770800434d1a42d606f274927a94
Branches:  master

Link:   
http://git.php.net/?p=php-src.git;a=commitdiff;h=6764993358f2da19896f1c0ca6a114af744125dc

Log:
Merge branch 'PHP-5.5'

* PHP-5.5:
  remove TRAVIS check in test source
  Just SKIP that test on travis

Changed paths:
  MM  ext/standard/tests/file/disk_free_space_basic.phpt


Diff:
diff --cc ext/standard/tests/file/disk_free_space_basic.phpt
index bff30d9,200e92a..2904ff9
--- a/ext/standard/tests/file/disk_free_space_basic.phpt
+++ b/ext/standard/tests/file/disk_free_space_basic.phpt
@@@ -33,12 -37,10 +37,12 @@@ echo "\n Free Space after writing to a 
  $space2 =  disk_free_space($file_path.$dir); 
  var_dump( $space2 ); 
  
- if(getenv('TRAVIS') === 'true' || $space1 > $space2 )
+ if($space1 > $space2 )
echo "\n Free Space Value Is Correct\n";
 -else
 +else {
echo "\n Free Space Value Is Incorrect\n";
 +  var_dump($space1, $space2);
 +}
  
  echo "*** Testing with Binary Input ***\n";
  var_dump( disk_free_space(b"$file_path") );


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



Re: [PHP-CVS] com php-src: Merge branch 'issue-55736' of https://github.com/tistre/php-src: run-tests.php

2013-10-09 Thread Michael Wallner
Now gotta look up what QA docs I also have to change...

On 9 October 2013 10:06, Michael Wallner  wrote:
> Commit:5f41cb18beb9437df73c382b5a9689d43c357628
> Author:Michael Wallner  Wed, 9 Oct 2013 10:06:45 
> +0200
> Parents:   29d5ff75d5ac076eb0b4623e1a29eb33bb65393a 
> 5ffaf95d3f6d8634cdc218ea6bfdb24c7887148c
> Branches:  master
>
> Link:   
> http://git.php.net/?p=php-src.git;a=commitdiff;h=5f41cb18beb9437df73c382b5a9689d43c357628
>
> Log:
> Merge branch 'issue-55736' of https://github.com/tistre/php-src
>
> implements FR #55736
>
> * 'issue-55736' of https://github.com/tistre/php-src:
>   run-tests.php: Adding support for sections EXPECT_EXTERNAL, 
> EXPECTF_EXTERNAL and EXPECTREGEX_EXTERNAL. (Issue 55736)
>
> Bugs:
> https://bugs.php.net/55736
>
> Changed paths:
>   MM  run-tests.php
>
>
> Diff:
>
>
>
> --
> PHP CVS Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>



-- 
Regards,
Mike

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



[PHP-CVS] com php-src: Thanks Daniel, I didn't think long enough: UPGRADING

2013-10-09 Thread Michael Wallner
Commit:1815942f53a976555e9cb60ac3ce2425142d1cb1
Author:Michael Wallner  Wed, 9 Oct 2013 08:22:33 +0200
Parents:   cfa4eced9f7407f924fdf9c4bdbceae5373b3d0e
Branches:  master

Link:   
http://git.php.net/?p=php-src.git;a=commitdiff;h=1815942f53a976555e9cb60ac3ce2425142d1cb1

Log:
Thanks Daniel, I didn't think long enough

Changed paths:
  M  UPGRADING


Diff:
diff --git a/UPGRADING b/UPGRADING
index 238aa5e..b19c3dd 100755
--- a/UPGRADING
+++ b/UPGRADING
@@ -113,11 +113,6 @@ PHP X.Y UPGRADE NOTES
 9. New Global Constants
 
 
-- Openssl:
-  . STREAM_CRYPTO_METHOD_SSLv2_CLIENT
-  . STREAM_CRYPTO_METHOD_SSLv3_CLIENT
-  . STREAM_CRYPTO_METHOD_SSLv23_CLIENT
-  . STREAM_CRYPTO_METHOD_TLS_CLIENT
 
 
 10. Changes to INI File Handling


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



[PHP-CVS] com php-src: consolidate NEWS with 5.4: NEWS

2013-10-09 Thread Michael Wallner
Commit:e3c7b487099f317378cc747aea4dbe044f7faba8
Author:Michael Wallner  Wed, 9 Oct 2013 08:16:00 +0200
Parents:   f32d2ac3aaa7d4af7c348b00ebebb9ae64955704
Branches:  PHP-5.5 master

Link:   
http://git.php.net/?p=php-src.git;a=commitdiff;h=e3c7b487099f317378cc747aea4dbe044f7faba8

Log:
consolidate NEWS with 5.4

Changed paths:
  M  NEWS


Diff:
diff --git a/NEWS b/NEWS
index 6649a49..b70bdcc 100644
--- a/NEWS
+++ b/NEWS
@@ -2,22 +2,23 @@ PHP   
 NEWS
 |||
 ?? ??? 2013, PHP 5.5.5
 
-- Buildsystem:
-  . Fixed bug #51076 (race condition in shtool's mkdir -p implementation).
-(Mike, Raphael Geissert)
-
 - Core:
   . Fixed bug #64979 (Wrong behavior of static variables in closure 
generators).
 (Nikita)
+  . Fixed bug #65322 (compile time errors won't trigger auto loading). (Nikita)
   . Fixed bug #65821 (By-ref foreach on property access of string offset
 segfaults). (Nikita)
 
 - CLI server:
   . Fixed bug #65633 (built-in server treat some http headers as
 case-sensitive). (Adam)
+  . Fixed bug #65818 (Segfault with built-in webserver and chunked transfer 
+encoding). (Felipe)
   . Added application/pdf to PHP CLI Web Server mime types (Chris Jones)
 
 - Datetime:
+  . Fixed bug #64157 (DateTime::createFromFormat() reports confusing error
+message). (Boro Sitnikovski)
   . Fixed bug #65502 (DateTimeImmutable::createFromFormat returns DateTime).
 (Boro Sitnikovski)
   . Fixed bug #65548 (Comparison for DateTimeImmutable doesn't work).
@@ -27,6 +28,14 @@ PHP  
  NEWS
   . Fixed bug #65708 (dba functions cast $key param to string in-place,
 bypassing copy on write). (Adam)
 
+- Filter:
+  . Add RFC 6598 IPs to reserved addresses. (Sebastian Nohn)
+  . Fixed bug #64441 (FILTER_VALIDATE_URL rejects fully qualified domain 
names).
+(Syra)
+
+- FTP:
+  . Fixed bug #65667 (ftp_nb_continue produces segfault). (Philip Hofstetter)
+
 - GD
   . Ensure that the defined interpolation method is used with the generic
 scaling methods. (Pierre)
@@ -45,10 +54,29 @@ PHP 
   NEWS
   . Fixed issue #135 (segfault in interned strings if initial memory is too
 low). (Julien)
 
+- Sockets:
+  . Fixed bug #65808 (the socket_connect() won't work with IPv6 address).
+(Mike)
+
 - SPL:
   . Fix bug #64782 (SplFileObject constructor make $context optional / give it
 a default value). (Nikita)
 
+- Standard:
+  . Fixed bug #61548 (content-type must appear at the end of headers for 201 
+Location to work in http). (Mike)
+
+- XMLReader:
+  . Fixed bug #51936 (Crash with clone XMLReader). (Mike)
+  . Fixed bug #64230 (XMLReader does not suppress errors). (Mike)
+  
+- Build system:
+  . Fixed bug #51076 (race condition in shtool's mkdir -p implementation).
+(Mike, Raphael Geissert)
+  . Fixed bug #62396 ('make test' crashes starting with 5.3.14 (missing 
+gzencode())). (Mike)
+
+
 19 Sep 2013, PHP 5.5.4
 
 - Core:
@@ -59,6 +87,7 @@ PHP   
 NEWS
 DTRACE_FUNCTION_*). (Chris Jones)
   . Fixed bug #65483 (quoted-printable encode stream filter incorrectly 
encoding
 spaces). (Michael M Slusarz)
+  . Fixed bug #65481 (shutdown segfault due to serialize) (Mike)
   . Fixed bug #65470 (Segmentation fault in zend_error() with
 --enable-dtrace). (Chris Jones, Kris Van Hees)
   . Fixed bug #65225 (PHP_BINARY incorrectly set). (Patrick Allaert)
@@ -85,6 +114,10 @@ PHP 
   NEWS
   . Fixed bug #64802 (openssl_x509_parse fails to parse subject properly in
 some cases). (Mark Jones)
 
+- PDO:
+  . Fixed bug #64953 (Postgres prepared statement positional parameter 
+casting). (Mike)
+
 - Session:
   . Fixed bug #65475 (Session ID is not initialized properly when strict 
session
 is enabled). (Yasuo)
@@ -95,6 +128,10 @@ PHP 
   NEWS
   . Fix issue with return types of password API helper functions. Found via
 static analysis by cjones. (Anthony Ferrara) 
 
+- Zlib:
+  . Fixed bug #65391 (Unable to send vary header user-agent when 
+ob_start('ob_gzhandler') is called) (Mike)
+
 22 Aug 2013, PHP 5.5.3
 
 - Openssl:


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



[PHP-CVS] com php-src: run-tests.php: Adding support for sections EXPECT_EXTERNAL, EXPECTF_EXTERNAL and EXPECTREGEX_EXTERNAL. (Issue 55736): run-tests.php tests/run-test/test011.phpt tests/run-test/te

2013-10-09 Thread Michael Wallner
Commit:5ffaf95d3f6d8634cdc218ea6bfdb24c7887148c
Author:Tim Strehle  Tue, 3 Sep 2013 14:38:52 +0200
Parents:   04fcf6a98b8901ae7c442aa92368c82fa7bd671d
Branches:  master

Link:   
http://git.php.net/?p=php-src.git;a=commitdiff;h=5ffaf95d3f6d8634cdc218ea6bfdb24c7887148c

Log:
run-tests.php: Adding support for sections EXPECT_EXTERNAL, EXPECTF_EXTERNAL 
and EXPECTREGEX_EXTERNAL. (Issue 55736)

Changed paths:
  M  run-tests.php
  A  tests/run-test/test011.phpt
  A  tests/run-test/test011.txt
  A  tests/run-test/test012.phpt
  A  tests/run-test/test012.txt
  A  tests/run-test/test013.phpt
  A  tests/run-test/test013.txt


Diff:
diff --git a/run-tests.php b/run-tests.php
index 54a12a1..dc88ddf 100755
--- a/run-tests.php
+++ b/run-tests.php
@@ -1289,16 +1289,20 @@ TEST $file
unset($section_text['FILEEOF']);
}
 
-   if (@count($section_text['FILE_EXTERNAL']) == 1) {
-   // don't allow tests to retrieve files from 
anywhere but this subdirectory
-   $section_text['FILE_EXTERNAL'] = dirname($file) 
. '/' . trim(str_replace('..', '', $section_text['FILE_EXTERNAL']));
+   foreach (array( 'FILE', 'EXPECT', 'EXPECTF', 
'EXPECTREGEX' ) as $prefix) {
+   $key = $prefix . '_EXTERNAL';
 
-   if 
(file_exists($section_text['FILE_EXTERNAL'])) {
-   $section_text['FILE'] = 
file_get_contents($section_text['FILE_EXTERNAL'], FILE_BINARY);
-   unset($section_text['FILE_EXTERNAL']);
-   } else {
-   $bork_info = "could not load 
--FILE_EXTERNAL-- " . dirname($file) . '/' . 
trim($section_text['FILE_EXTERNAL']);
-   $borked = true;
+   if (@count($section_text[$key]) == 1) {
+   // don't allow tests to retrieve files 
from anywhere but this subdirectory
+   $section_text[$key] = dirname($file) . 
'/' . trim(str_replace('..', '', $section_text[$key]));
+
+   if (file_exists($section_text[$key])) {
+   $section_text[$prefix] = 
file_get_contents($section_text[$key], FILE_BINARY);
+   unset($section_text[$key]);
+   } else {
+   $bork_info = "could not load 
--" . $key . "-- " . dirname($file) . '/' . trim($section_text[$key]);
+   $borked = true;
+   }
}
}
 
diff --git a/tests/run-test/test011.phpt b/tests/run-test/test011.phpt
new file mode 100644
index 000..17f1f7a
--- /dev/null
+++ b/tests/run-test/test011.phpt
@@ -0,0 +1,6 @@
+--TEST--
+EXPECT_EXTERNAL
+--FILE--
+abc
+--EXPECT_EXTERNAL--
+test011.txt
diff --git a/tests/run-test/test011.txt b/tests/run-test/test011.txt
new file mode 100644
index 000..8baef1b
--- /dev/null
+++ b/tests/run-test/test011.txt
@@ -0,0 +1 @@
+abc
diff --git a/tests/run-test/test012.phpt b/tests/run-test/test012.phpt
new file mode 100644
index 000..8213aa2
--- /dev/null
+++ b/tests/run-test/test012.phpt
@@ -0,0 +1,12 @@
+--TEST--
+EXPECTF_EXTERNAL
+--FILE--
+123
+-123
++123
++1.1
+abc
+0abc
+x
+--EXPECTF_EXTERNAL--
+test012.txt
diff --git a/tests/run-test/test012.txt b/tests/run-test/test012.txt
new file mode 100644
index 000..bb29321
--- /dev/null
+++ b/tests/run-test/test012.txt
@@ -0,0 +1,7 @@
+%d
+%i
+%i
+%f
+%s
+%x
+%c
diff --git a/tests/run-test/test013.phpt b/tests/run-test/test013.phpt
new file mode 100644
index 000..79ccd20
--- /dev/null
+++ b/tests/run-test/test013.phpt
@@ -0,0 +1,6 @@
+--TEST--
+EXPECTREGEX_EXTERNAL
+--FILE--
+abcde12314235xyz34264768286abcde
+--EXPECTREGEX_EXTERNAL--
+test013.txt
diff --git a/tests/run-test/test013.txt b/tests/run-test/test013.txt
new file mode 100644
index 000..6c280ec
--- /dev/null
+++ b/tests/run-test/test013.txt
@@ -0,0 +1 @@
+[abcde]+[0-5]*xyz[2-8]+abcde


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



Re: [PHP-CVS] com php-src: Merge branch 'issue-55736' of https://github.com/tistre/php-src: run-tests.php

2013-10-09 Thread Michael Wallner
On 9 October 2013 10:06, Michael Wallner  wrote:
> Commit:5f41cb18beb9437df73c382b5a9689d43c357628
> Author:Michael Wallner  Wed, 9 Oct 2013 10:06:45 
> +0200
> Parents:   29d5ff75d5ac076eb0b4623e1a29eb33bb65393a 
> 5ffaf95d3f6d8634cdc218ea6bfdb24c7887148c
> Branches:  master
>
> Link:   
> http://git.php.net/?p=php-src.git;a=commitdiff;h=5f41cb18beb9437df73c382b5a9689d43c357628
>
> Log:
> Merge branch 'issue-55736' of https://github.com/tistre/php-src
>
> implements FR #55736
>
> * 'issue-55736' of https://github.com/tistre/php-src:
>   run-tests.php: Adding support for sections EXPECT_EXTERNAL, 
> EXPECTF_EXTERNAL and EXPECTREGEX_EXTERNAL. (Issue 55736)
>
> Bugs:
> https://bugs.php.net/55736
>
> Changed paths:
>   MM  run-tests.php

Could someone grant me web-qa karma or merge PR #6, please?
https://github.com/php/web-qa/pull/6


-- 
Regards,
Mike

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



[PHP-CVS] com php-src: openssl NEWS,UPGRADING: NEWS UPGRADING

2013-10-08 Thread Michael Wallner
Commit:cf6413ae7ca9773ea154df3b94ce9299435f0e33
Author:Michael Wallner  Tue, 8 Oct 2013 16:20:07 +0200
Parents:   ea0578e223229a9e1fd84d6c29701aee21bc75ac
Branches:  master

Link:   
http://git.php.net/?p=php-src.git;a=commitdiff;h=cf6413ae7ca9773ea154df3b94ce9299435f0e33

Log:
openssl NEWS,UPGRADING

Changed paths:
  M  NEWS
  M  UPGRADING


Diff:
diff --git a/NEWS b/NEWS
index 8113514..c2cf3d7 100644
--- a/NEWS
+++ b/NEWS
@@ -40,6 +40,11 @@ PHP  
  NEWS
 cache_slots) in op_array->literals table. (Laruence, Dmitry)
   . Added script level constant replacement optimization pass. (Dmitry)
 
+- Openssl:
+  . Added crypto_method option for the ssl stream context. (Martin Jansen)
+  . Added certificate fingerprint support. (Tjerk Meesters)
+  . Fixed bug #65729 (CN_match gives false positive). (Tjerk Meesters)
+  
 - PDO_pgsql:
   . Fixed Bug #42614 (PDO_pgsql: add pg_get_notify support). (Matteo)
   . Fixed Bug #63657 (pgsqlCopyFromFile, pgsqlCopyToArray use Postgres < 7.3
diff --git a/UPGRADING b/UPGRADING
index fb8daab..238aa5e 100755
--- a/UPGRADING
+++ b/UPGRADING
@@ -42,6 +42,11 @@ PHP X.Y UPGRADE NOTES
 
 - Added gost-crypto (CryptoPro S-box) hash algo.
 
+- Added openssl certificate fingerprint support (inclusive stream context 
+  option).
+
+- Added openssl crypto method stream context option.
+
 
 2. Changes in SAPI modules
 
@@ -71,6 +76,8 @@ PHP X.Y UPGRADE NOTES
 5. New Functions
 
 
+- Openssl:
+  Added string openssl_x509_fingerprint($x509, $type, $binary).
 
 
 6. New Classes and Interfaces
@@ -106,6 +113,11 @@ PHP X.Y UPGRADE NOTES
 9. New Global Constants
 
 
+- Openssl:
+  . STREAM_CRYPTO_METHOD_SSLv2_CLIENT
+  . STREAM_CRYPTO_METHOD_SSLv3_CLIENT
+  . STREAM_CRYPTO_METHOD_SSLv23_CLIENT
+  . STREAM_CRYPTO_METHOD_TLS_CLIENT
 
 
 10. Changes to INI File Handling


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



[PHP-CVS] com php-src: Add unit test that covers setting the crypto method.: ext/openssl/tests/streams_crypto_method.pem ext/openssl/tests/streams_crypto_method.phpt

2013-10-08 Thread Michael Wallner
Commit:047877e8106ef9cb53f6a32dc8b645693d59e4b0
Author:Martin Jansen  Fri, 4 Oct 2013 
21:55:29 +0200
Parents:   ce2789558a970057539094ca9019d98ff09e831e
Branches:  master

Link:   
http://git.php.net/?p=php-src.git;a=commitdiff;h=047877e8106ef9cb53f6a32dc8b645693d59e4b0

Log:
Add unit test that covers setting the crypto method.

Changed paths:
  A  ext/openssl/tests/streams_crypto_method.pem
  A  ext/openssl/tests/streams_crypto_method.phpt


Diff:
diff --git a/ext/openssl/tests/streams_crypto_method.pem 
b/ext/openssl/tests/streams_crypto_method.pem
new file mode 100644
index 000..9d754d4
--- /dev/null
+++ b/ext/openssl/tests/streams_crypto_method.pem
@@ -0,0 +1,33 @@
+-BEGIN CERTIFICATE-
+MIIC5jCCAk+gAwIBAgIBADANBgkqhkiG9w0BAQQFADBcMQswCQYDVQQGEwJBVTET
+MBEGA1UECBMKUXVlZW5zbGFuZDEaMBgGA1UEChMRQ3J5cHRTb2Z0IFB0eSBMdGQx
+HDAaBgNVBAMTE1Rlc3QgUENBICgxMDI0IGJpdCkwHhcNOTkxMjAyMjEzNTQ4WhcN
+MDUwNzExMjEzNTQ4WjBcMQswCQYDVQQGEwJBVTETMBEGA1UECBMKUXVlZW5zbGFu
+ZDEaMBgGA1UEChMRQ3J5cHRTb2Z0IFB0eSBMdGQxHDAaBgNVBAMTE1Rlc3QgUENB
+ICgxMDI0IGJpdCkwgZ8wDQYJKoZIhvcNAQEBBQADgY0AMIGJAoGBAJ2haT/f5Zwy
+V+MiuSDjSR62adBoSiBB7Usty44lXqsp9RICw+DCCxpsn/CfxPEDXLLd4olsWXc6
+JRcxGynbYmnzk+Z6aIPPJQhK3CTvaqGnWKZsA1m+WaUIUqJCuNTK4N+7hMAGaf6S
+S3e9HVgEQ4a34gXJ7VQFVIBNV1EnZRWHAgMBAAGjgbcwgbQwHQYDVR0OBBYEFE0R
+aEcrj18q1dw+G6nJbsTWR213MIGEBgNVHSMEfTB7gBRNEWhHK49fKtXcPhupyW7E
+1kdtd6FgpF4wXDELMAkGA1UEBhMCQVUxEzARBgNVBAgTClF1ZWVuc2xhbmQxGjAY
+BgNVBAoTEUNyeXB0U29mdCBQdHkgTHRkMRwwGgYDVQQDExNUZXN0IFBDQSAoMTAy
+NCBiaXQpggEAMAwGA1UdEwQFMAMBAf8wDQYJKoZIhvcNAQEEBQADgYEAUa8B3pho
++Mvxeq9HsEzJxHIFQla05S5J/e/V+DQTYoKiRFchKPrDAdrzYSEvP3h4QJEtsNqQ
+JfOxg5M42uLFq7aPGWkF6ZZqZsYS+zA9IVT14g7gNA6Ne+5QtJqQtH9HA24st0T0
+Tga/lZ9M2ovImovaxSL/kRHbpCWcqWVxpOw=
+-END CERTIFICATE-
+-BEGIN RSA PRIVATE KEY-
+MIICXAIBAAKBgQCdoWk/3+WcMlfjIrkg40ketmnQaEogQe1LLcuOJV6rKfUSAsPg
+wgsabJ/wn8TxA1yy3eKJbFl3OiUXMRsp22Jp85PmemiDzyUIStwk72qhp1imbANZ
+vlmlCFKiQrjUyuDfu4TABmn+kkt3vR1YBEOGt+IFye1UBVSATVdRJ2UVhwIDAQAB
+AoGAba4fTtuap5l7/8ZsbE7Z1O32KJY4ZcOZukLOLUUhXxXduT+FTgGWujc0/rgc
+z9qYCLlNZHOouMYTgtSfYvuMuLZ11VIt0GYH+nRioLShE59Yy+zCRyC+gPigS1kz
+xvo14AsOIPYV14Tk/SsHyq6E0eTk7VzaIE197giiINUERPECQQDSKmtPTh/lRKw7
+HSZSM0I1mFWn/1zqrAbontRQY5w98QWIOe5qmzYyFbPXYT3d9BzlsMyhgiRNoBbD
+yvohSHXJAkEAwAHx6ezAZeWWzD5yXD36nyjpkVCw7Tk7TSmOceLJMWt1QcrCfqlS
+xA5jjpQ6Z8suU5DdtWAryM2sAir1WisYzwJAd6Zcx56jvAQ3xcPXsE6scBTVFzrj
+7FqZ6E+cclPzfLQ+QQsyOBE7bpI6e/FJppY26XGZXo3YGzV8IGXrt40oOQJALETG
+h86EFXo3qGOFbmsDy4pdP5nBERCu8X1xUCSfintiD4c2DInxgS5oGclnJeMcjTvL
+QjQoJCX3UJCi/OUO1QJBAKgcDHWjMvt+l1pjJBsSEZ0HX9AAIIVx0RQmbFGS+F2Q
+hhu5l77WnnZOQ9vvhV5u7NPCUF9nhU3jh60qWWO8mkc=
+-END RSA PRIVATE KEY-
diff --git a/ext/openssl/tests/streams_crypto_method.phpt 
b/ext/openssl/tests/streams_crypto_method.phpt
new file mode 100644
index 000..7ac195b
--- /dev/null
+++ b/ext/openssl/tests/streams_crypto_method.phpt
@@ -0,0 +1,77 @@
+--TEST--
+Specific crypto method for ssl:// transports.
+--SKIPIF--
+
+--FILE--
+https://127.0.0.1:' . $port . '/', 'r', false, $ctx);
+   if ($fp) {
+   fpassthru($fp);
+   fclose($fp);
+   }
+}
+
+function server($port, $transport) {
+$context = stream_context_create();
+
+stream_context_set_option($context, 'ssl', 'local_cert', 
dirname(__FILE__) . '/streams_crypto_method.pem');
+stream_context_set_option($context, 'ssl', 'allow_self_signed', true);
+stream_context_set_option($context, 'ssl', 'verify_peer', false);
+
+$server = stream_socket_server($transport . '127.0.0.1:' . $port, 
$errno, $errstr, STREAM_SERVER_BIND|STREAM_SERVER_LISTEN, $context);
+
+   $client = @stream_socket_accept($server);
+
+   if ($client) {
+   $in = '';
+   while (!preg_match('/\r?\n\r?\n/', $in)) {
+   $in .= fread($client, 2048);
+   }
+
+   $response = <<
+--EXPECTF--
+Hello World!


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



[PHP-CVS] com php-src: Streams for ssl:// transports can now be configured to use a specific crypto method (SSLv3, SSLv2 etc.) by calling: ext/openssl/xp_ssl.c

2013-10-08 Thread Michael Wallner
Commit:ce2789558a970057539094ca9019d98ff09e831e
Author:Martin Jansen  Sat, 21 Sep 2013 
21:26:40 +0200
Parents:   9e3bedcd73265acb3d190c894860bd9aa1015121
Branches:  master

Link:   
http://git.php.net/?p=php-src.git;a=commitdiff;h=ce2789558a970057539094ca9019d98ff09e831e

Log:
Streams for ssl:// transports can now be configured to use a specific
crypto method (SSLv3, SSLv2 etc.) by calling

stream_context_set_option($ctx, "ssl", "crypto_method", $crypto_method)

where $crypto_method can be one of STREAM_CRYPTO_METHOD_SSLv2_CLIENT,
STREAM_CRYPTO_METHOD_SSLv3_CLIENT, STREAM_CRYPTO_METHOD_SSLv23_CLIENT
or STREAM_CRYPTO_METHOD_TLS_CLIENT. SSLv23 remains the default crypto
method.

This change makes it possible to fopen() SSL URLs that are only
provided using SSL v3.

Changed paths:
  M  ext/openssl/xp_ssl.c


Diff:
diff --git a/ext/openssl/xp_ssl.c b/ext/openssl/xp_ssl.c
index d7ef42e..1ac8a02 100644
--- a/ext/openssl/xp_ssl.c
+++ b/ext/openssl/xp_ssl.c
@@ -853,6 +853,29 @@ php_stream_ops php_openssl_socket_ops = {
php_openssl_sockop_set_option,
 };
 
+static int get_crypto_method(php_stream_context *ctx) {
+if (ctx) {
+zval **val = NULL;
+long crypto_method;
+
+if (php_stream_context_get_option(ctx, "ssl", "crypto_method", 
&val) == SUCCESS) {
+convert_to_long_ex(val);
+crypto_method = (long)Z_LVAL_PP(val);
+
+switch (crypto_method) {
+case STREAM_CRYPTO_METHOD_SSLv2_CLIENT:
+case STREAM_CRYPTO_METHOD_SSLv3_CLIENT:
+case STREAM_CRYPTO_METHOD_SSLv23_CLIENT:
+case STREAM_CRYPTO_METHOD_TLS_CLIENT:
+return crypto_method;
+}
+
+}
+}
+
+return STREAM_CRYPTO_METHOD_SSLv23_CLIENT;
+}
+
 static char * get_sni(php_stream_context *ctx, const char *resourcename, 
size_t resourcenamelen, int is_persistent TSRMLS_DC) {
 
php_url *url;
@@ -939,7 +962,12 @@ php_stream *php_openssl_ssl_socket_factory(const char 
*proto, size_t protolen,

if (strncmp(proto, "ssl", protolen) == 0) {
sslsock->enable_on_connect = 1;
-   sslsock->method = STREAM_CRYPTO_METHOD_SSLv23_CLIENT;
+
+   /* General ssl:// transports can use a number
+* of crypto methods. The actual methhod can be
+* provided in the streams context options.
+*/ 
+   sslsock->method = get_crypto_method(context);
} else if (strncmp(proto, "sslv2", protolen) == 0) {
 #ifdef OPENSSL_NO_SSL2
php_error_docref(NULL TSRMLS_CC, E_WARNING, "SSLv2 support is 
not compiled into the OpenSSL library PHP is linked against");


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



[PHP-CVS] com php-src: yay, reduced one variable: ext/openssl/openssl.c

2013-10-08 Thread Michael Wallner
Commit:a820c3d6baac945ead4a5fe6e54d0a04b02620de
Author:Tjerk Meesters  Sat, 21 Sep 2013 20:42:52 
+0800
Parents:   8e847b5845b85c080295aea60c20869973c09a15
Branches:  master

Link:   
http://git.php.net/?p=php-src.git;a=commitdiff;h=a820c3d6baac945ead4a5fe6e54d0a04b02620de

Log:
yay, reduced one variable

Changed paths:
  M  ext/openssl/openssl.c


Diff:
diff --git a/ext/openssl/openssl.c b/ext/openssl/openssl.c
index 1c367df..2aa850a 100644
--- a/ext/openssl/openssl.c
+++ b/ext/openssl/openssl.c
@@ -4851,13 +4851,11 @@ static int php_openssl_match_cn(const char 
*subjectname, const char *certname)
suffix_len = strlen(wildcard + 1);
subject_len = strlen(subjectname);
if (suffix_len <= subject_len) {
-   const char *suffix = subjectname + subject_len - suffix_len;
-
/* 2) suffix must match
 * 3) no . between prefix and suffix
 **/
-   return strcmp(wildcard + 1, suffix) == 0 &&
-   memchr(subjectname + prefix_len, '.', suffix - 
subjectname - prefix_len) == NULL;
+   return strcmp(wildcard + 1, subjectname + subject_len - 
suffix_len) == 0 &&
+   memchr(subjectname + prefix_len, '.', subject_len - 
suffix_len - prefix_len) == NULL;
}
 
return 0;


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



[PHP-CVS] com php-src: added better wildcard matching for CN: ext/openssl/openssl.c ext/openssl/tests/bug65729.pem ext/openssl/tests/bug65729.phpt

2013-10-08 Thread Michael Wallner
Commit:8915c3fb4fa40743bdddf23013a63e014d03d02c
Author:Tjerk Meesters  Sat, 21 Sep 2013 16:45:20 
+0800
Parents:   9e3bedcd73265acb3d190c894860bd9aa1015121
Branches:  master

Link:   
http://git.php.net/?p=php-src.git;a=commitdiff;h=8915c3fb4fa40743bdddf23013a63e014d03d02c

Log:
added better wildcard matching for CN

Changed paths:
  M  ext/openssl/openssl.c
  A  ext/openssl/tests/bug65729.pem
  A  ext/openssl/tests/bug65729.phpt


Diff:
diff --git a/ext/openssl/openssl.c b/ext/openssl/openssl.c
index 4aac4e3..5460f3a 100644
--- a/ext/openssl/openssl.c
+++ b/ext/openssl/openssl.c
@@ -4829,6 +4829,30 @@ static int verify_callback(int preverify_ok, 
X509_STORE_CTX *ctx) /* {{{ */
 }
 /* }}} */
 
+static int php_openssl_match_cn(const char *subjectname, const char *certname)
+{
+   int match = strcmp(subjectname, certname) == 0;
+
+   if (!match) {
+   char *wildcard = strchr(certname, '*');
+   int prefix_len = wildcard - certname;
+
+   /* 1) prefix, if not empty, must match */
+   if (wildcard && (prefix_len == 0 || strncmp(subjectname, 
certname, prefix_len) == 0)) {
+   const char *suffix = subjectname + strlen(subjectname) 
- strlen(wildcard + 1);
+
+   /*
+* 2) suffix must match
+* 3) no period between prefix and suffix
+   **/
+   match = strcmp(wildcard + 1, suffix) == 0 &&
+   memchr(subjectname + prefix_len, '.', suffix - 
subjectname - prefix_len) == NULL;
+   }
+   }
+
+   return match;
+}
+
 int php_openssl_apply_verification_policy(SSL *ssl, X509 *peer, php_stream 
*stream TSRMLS_DC) /* {{{ */
 {
zval **val = NULL;
@@ -4881,16 +4905,7 @@ int php_openssl_apply_verification_policy(SSL *ssl, X509 
*peer, php_stream *stre
return FAILURE;
}
 
-   match = strcmp(cnmatch, buf) == 0;
-   if (!match && strlen(buf) > 3 && buf[0] == '*' && buf[1] == 
'.') {
-   /* Try wildcard */
-
-   if (strchr(buf+2, '.')) {
-   char *tmp = strstr(cnmatch, buf+1);
-
-   match = tmp && strcmp(tmp, buf+2) && tmp == 
strchr(cnmatch, '.');
-   }
-   }
+   match = php_openssl_match_cn(cnmatch, buf);
 
if (!match) {
/* didn't match */
diff --git a/ext/openssl/tests/bug65729.pem b/ext/openssl/tests/bug65729.pem
new file mode 100644
index 000..dbeed6e
--- /dev/null
+++ b/ext/openssl/tests/bug65729.pem
@@ -0,0 +1,28 @@
+-BEGIN CERTIFICATE-
+MIICCTCCAXICCQDNMI29sowT7TANBgkqhkiG9w0BAQUFADBJMQswCQYDVQQGEwJT
+RzESMBAGA1UECBMJVGVzdHZpbGxlMREwDwYDVQQKEwhkYXRpYmJhdzETMBEGA1UE
+AxQKKi50ZXN0LmNvbTAeFw0xMzA5MjEwNzUyMjRaFw0xNDA5MjEwNzUyMjRaMEkx
+CzAJBgNVBAYTAlNHMRIwEAYDVQQIEwlUZXN0dmlsbGUxETAPBgNVBAoTCGRhdGli
+YmF3MRMwEQYDVQQDFAoqLnRlc3QuY29tMIGfMA0GCSqGSIb3DQEBAQUAA4GNADCB
+iQKBgQCdzVnic8K5W4SVbwVuqezcTjeqVLoQ91vVNZB0Jnsuz6q3DoK03oAd1jTe
+Vd0k+MQDbXpHoc37lA4+8z/g5Bs0UXxNx+nkbFTE7Ba2/G24caI9/cOXZPG3UViD
+rtqXKL6h5/umqRG9Dt5liF2MVP9XFAesVC7B8+Ca+PbPlQoYzwIDAQABMA0GCSqG
+SIb3DQEBBQUAA4GBAAS07u/Ke+EhEHidz6CG3Qcr+zg483JKRgZFyGz+YUKyyKKy
+fmLs7JieGJxYQjOmIpj/6X9Gnb2HjIPDnI6A+MV1emXDTnnmsgf2/lZGcthhpZn2
+rMbj9bI0iH6HwOVGtp4ZJA5fB7nj3J+gWNTCQzDDOxwX36d2LL9ua+UMnk/g
+-END CERTIFICATE-
+-BEGIN RSA PRIVATE KEY-
+MIICXQIBAAKBgQCdzVnic8K5W4SVbwVuqezcTjeqVLoQ91vVNZB0Jnsuz6q3DoK0
+3oAd1jTeVd0k+MQDbXpHoc37lA4+8z/g5Bs0UXxNx+nkbFTE7Ba2/G24caI9/cOX
+ZPG3UViDrtqXKL6h5/umqRG9Dt5liF2MVP9XFAesVC7B8+Ca+PbPlQoYzwIDAQAB
+AoGAeyzTwKPDl5QMRejHQL57GOwlH1vLcXrjv+VzwHZZKQ0IoKM++5fCQYf29KXp
+XPahaluGW2u9sWa8R/7wGcd0Q4RtquGzsgT3+AQsIc5KfIamyOyDaRVM/ymX3fWg
+gHIU7OOzB+ihOU8sHyRIwfbk01/kmrBXLRj8E31sy3i3PIECQQDQQYE+aN7Acrdt
+yN5CaqvbkiCGjRvASlemiTzPosgOtndyp21w1gakJwKYhYDk1N6A6Qb8REMZqM/U
+wFypldV/AkEAwfq6NFuhpGL6hDA7MvlyY1KiZ0cHetPUX+PgdNqy2DA+1Sv4i7gm
+Wd/uA651K7aPXuUaf9dKtPCmZwI4M6SEsQJBALW89HTqP7niYoDEEnITdPaghxHk
+gptERUln6lGo1L1CLus3gSI/JHyMLo+7scgAnEwTD62GRKhX0Ubwt+ymfTECQAY5
+fHYnppU20+EgBxZIqOIFCc8UmWnYmE0Ha/Fz/x8u1SVUBuK84wYpSGL32yyu7ATY
+hzQo/W229zABAzqtAdECQQCUdB7IBFpPnsfv/EUBFX7X/7zAc9JpACmu9It5ju8C
+KIsMuz/02D+TQoJNjdAngBM+4AJDIaGFgTMIfaDMh5L7
+-END RSA PRIVATE KEY-
diff --git a/ext/openssl/tests/bug65729.phpt b/ext/openssl/tests/bug65729.phpt
new file mode 100644
index 000..d4645d9
--- /dev/null
+++ b/ext/openssl/tests/bug65729.phpt
@@ -0,0 +1,42 @@
+--TEST--
+Bug #65729: CN_match gives false positive when wildcard is used
+--SKIPIF--
+ array(
+   'verify_peer'   => true,
+   'allow_self_signed' => true,
+   'CN_match'  => 'foo.test.com.sg',
+   )
+   )
+   );
+   var_dump(stream

[PHP-CVS] com php-src: Added two more test cases for CN matching.: ext/openssl/tests/bug65729.phpt

2013-10-08 Thread Michael Wallner
Commit:674dd73f8c34b9faf1e777a301e5302348b48b9d
Author:Tjerk Meesters  Mon, 7 Oct 2013 22:10:05 
+0800
Parents:   a820c3d6baac945ead4a5fe6e54d0a04b02620de
Branches:  master

Link:   
http://git.php.net/?p=php-src.git;a=commitdiff;h=674dd73f8c34b9faf1e777a301e5302348b48b9d

Log:
Added two more test cases for CN matching.

Changed paths:
  M  ext/openssl/tests/bug65729.phpt


Diff:
diff --git a/ext/openssl/tests/bug65729.phpt b/ext/openssl/tests/bug65729.phpt
index d4645d9..7008f3c 100644
--- a/ext/openssl/tests/bug65729.phpt
+++ b/ext/openssl/tests/bug65729.phpt
@@ -13,24 +13,28 @@ stream_context_set_option($context, 'ssl', 
'allow_self_signed', true);
 $server = stream_socket_server('ssl://127.0.0.1:64321', $errno, $errstr,
STREAM_SERVER_BIND|STREAM_SERVER_LISTEN, $context);
 
+$expected_names = array('foo.test.com.sg', 'foo.test.com', 'foo.bar.test.com');
+
 $pid = pcntl_fork();
 if ($pid == -1) {
die('could not fork');
 } else if ($pid) {
-   $contextC = stream_context_create(
-   array(
+   foreach ($expected_names as $expected_name) {
+   $contextC = stream_context_create(array(
'ssl' => array(
'verify_peer'   => true,
'allow_self_signed' => true,
-   'CN_match'  => 'foo.test.com.sg',
+   'CN_match'  => $expected_name,
)
-   )
-   );
-   var_dump(stream_socket_client("ssl://127.0.0.1:64321", $errno, $errstr, 
1,
+   ));
+   var_dump(stream_socket_client("ssl://127.0.0.1:64321", $errno, 
$errstr, 1,
STREAM_CLIENT_CONNECT, $contextC));
+   }
 } else {   
@pcntl_wait($status);
-   @stream_socket_accept($server, 1);
+   foreach ($expected_names as $name) {
+   @stream_socket_accept($server, 1);
+   }
 }
 --EXPECTF--
 Warning: stream_socket_client(): Peer certificate CN=`*.test.com' did not 
match expected CN=`foo.test.com.sg' in %s on line %d
@@ -39,4 +43,11 @@ Warning: stream_socket_client(): Failed to enable crypto in 
%s on line %d
 
 Warning: stream_socket_client(): unable to connect to ssl://127.0.0.1:64321 
(Unknown error) in %s on line %d
 bool(false)
+resource(%d) of type (stream)
+
+Warning: stream_socket_client(): Peer certificate CN=`*.test.com' did not 
match expected CN=`foo.bar.test.com' in %s on line %d
+
+Warning: stream_socket_client(): Failed to enable crypto in %s on line %d
 
+Warning: stream_socket_client(): unable to connect to ssl://127.0.0.1:64321 
(Unknown error) in %s on line %d
+bool(false)


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



[PHP-CVS] com php-src: Fixed bug that would lead to out of bounds memory access: ext/openssl/openssl.c

2013-10-08 Thread Michael Wallner
Commit:8e847b5845b85c080295aea60c20869973c09a15
Author:Tjerk Meesters  Sat, 21 Sep 2013 19:38:09 
+0800
Parents:   8915c3fb4fa40743bdddf23013a63e014d03d02c
Branches:  master

Link:   
http://git.php.net/?p=php-src.git;a=commitdiff;h=8e847b5845b85c080295aea60c20869973c09a15

Log:
Fixed bug that would lead to out of bounds memory access

Changed paths:
  M  ext/openssl/openssl.c


Diff:
diff --git a/ext/openssl/openssl.c b/ext/openssl/openssl.c
index 5460f3a..1c367df 100644
--- a/ext/openssl/openssl.c
+++ b/ext/openssl/openssl.c
@@ -4831,26 +4831,36 @@ static int verify_callback(int preverify_ok, 
X509_STORE_CTX *ctx) /* {{{ */
 
 static int php_openssl_match_cn(const char *subjectname, const char *certname)
 {
-   int match = strcmp(subjectname, certname) == 0;
-
-   if (!match) {
-   char *wildcard = strchr(certname, '*');
-   int prefix_len = wildcard - certname;
-
-   /* 1) prefix, if not empty, must match */
-   if (wildcard && (prefix_len == 0 || strncmp(subjectname, 
certname, prefix_len) == 0)) {
-   const char *suffix = subjectname + strlen(subjectname) 
- strlen(wildcard + 1);
-
-   /*
-* 2) suffix must match
-* 3) no period between prefix and suffix
-   **/
-   match = strcmp(wildcard + 1, suffix) == 0 &&
-   memchr(subjectname + prefix_len, '.', suffix - 
subjectname - prefix_len) == NULL;
-   }
+   char *wildcard;
+   int prefix_len, suffix_len, subject_len;
+
+   if (strcmp(subjectname, certname) == 0) {
+   return 1;
}
 
-   return match;
+   if (!(wildcard = strchr(certname, '*'))) {
+   return 0;
+   }
+
+   // 1) prefix, if not empty, must match subject
+   prefix_len = wildcard - certname;
+   if (prefix_len && strncmp(subjectname, certname, prefix_len) != 0) {
+   return 0;
+   }
+
+   suffix_len = strlen(wildcard + 1);
+   subject_len = strlen(subjectname);
+   if (suffix_len <= subject_len) {
+   const char *suffix = subjectname + subject_len - suffix_len;
+
+   /* 2) suffix must match
+* 3) no . between prefix and suffix
+**/
+   return strcmp(wildcard + 1, suffix) == 0 &&
+   memchr(subjectname + prefix_len, '.', suffix - 
subjectname - prefix_len) == NULL;
+   }
+
+   return 0;
 }
 
 int php_openssl_apply_verification_policy(SSL *ssl, X509 *peer, php_stream 
*stream TSRMLS_DC) /* {{{ */


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



[PHP-CVS] com php-src: DNS name comparison is now case insensitive.: ext/openssl/openssl.c ext/openssl/tests/bug65729.phpt

2013-10-08 Thread Michael Wallner
Commit:6106896440572dd8093acdd11ea691a07d9b169c
Author:datibbaw  Tue, 8 Oct 2013 10:07:54 +0800
Parents:   39c0daeb71f76ce22dc604bda8a063319fd55e59
Branches:  master

Link:   
http://git.php.net/?p=php-src.git;a=commitdiff;h=6106896440572dd8093acdd11ea691a07d9b169c

Log:
DNS name comparison is now case insensitive.

Changed paths:
  M  ext/openssl/openssl.c
  M  ext/openssl/tests/bug65729.phpt


Diff:
diff --git a/ext/openssl/openssl.c b/ext/openssl/openssl.c
index 2b34570..15cf798 100644
--- a/ext/openssl/openssl.c
+++ b/ext/openssl/openssl.c
@@ -4834,7 +4834,7 @@ static zend_bool php_openssl_match_cn(const char 
*subjectname, const char *certn
char *wildcard;
int prefix_len, suffix_len, subject_len;
 
-   if (strcmp(subjectname, certname) == 0) {
+   if (strcasecmp(subjectname, certname) == 0) {
return 1;
}
 
@@ -4844,7 +4844,7 @@ static zend_bool php_openssl_match_cn(const char 
*subjectname, const char *certn
 
// 1) prefix, if not empty, must match subject
prefix_len = wildcard - certname;
-   if (prefix_len && strncmp(subjectname, certname, prefix_len) != 0) {
+   if (prefix_len && strncasecmp(subjectname, certname, prefix_len) != 0) {
return 0;
}
 
@@ -4854,7 +4854,7 @@ static zend_bool php_openssl_match_cn(const char 
*subjectname, const char *certn
/* 2) suffix must match
 * 3) no . between prefix and suffix
 **/
-   return strcmp(wildcard + 1, subjectname + subject_len - 
suffix_len) == 0 &&
+   return strcasecmp(wildcard + 1, subjectname + subject_len - 
suffix_len) == 0 &&
memchr(subjectname + prefix_len, '.', subject_len - 
suffix_len - prefix_len) == NULL;
}
 
diff --git a/ext/openssl/tests/bug65729.phpt b/ext/openssl/tests/bug65729.phpt
index 7008f3c..c0ee444 100644
--- a/ext/openssl/tests/bug65729.phpt
+++ b/ext/openssl/tests/bug65729.phpt
@@ -13,7 +13,7 @@ stream_context_set_option($context, 'ssl', 
'allow_self_signed', true);
 $server = stream_socket_server('ssl://127.0.0.1:64321', $errno, $errstr,
STREAM_SERVER_BIND|STREAM_SERVER_LISTEN, $context);
 
-$expected_names = array('foo.test.com.sg', 'foo.test.com', 'foo.bar.test.com');
+$expected_names = array('foo.test.com.sg', 'foo.test.com', 'FOO.TEST.COM', 
'foo.bar.test.com');
 
 $pid = pcntl_fork();
 if ($pid == -1) {
@@ -44,6 +44,7 @@ Warning: stream_socket_client(): Failed to enable crypto in 
%s on line %d
 Warning: stream_socket_client(): unable to connect to ssl://127.0.0.1:64321 
(Unknown error) in %s on line %d
 bool(false)
 resource(%d) of type (stream)
+resource(%d) of type (stream)
 
 Warning: stream_socket_client(): Peer certificate CN=`*.test.com' did not 
match expected CN=`foo.bar.test.com' in %s on line %d


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



[PHP-CVS] com php-src: Use zend_bool as return value for _match(): ext/openssl/openssl.c

2013-10-08 Thread Michael Wallner
Commit:39c0daeb71f76ce22dc604bda8a063319fd55e59
Author:Tjerk Meesters  Mon, 7 Oct 2013 23:04:24 
+0800
Parents:   674dd73f8c34b9faf1e777a301e5302348b48b9d
Branches:  master

Link:   
http://git.php.net/?p=php-src.git;a=commitdiff;h=39c0daeb71f76ce22dc604bda8a063319fd55e59

Log:
Use zend_bool as return value for _match()

Changed paths:
  M  ext/openssl/openssl.c


Diff:
diff --git a/ext/openssl/openssl.c b/ext/openssl/openssl.c
index 2aa850a..2b34570 100644
--- a/ext/openssl/openssl.c
+++ b/ext/openssl/openssl.c
@@ -4829,7 +4829,7 @@ static int verify_callback(int preverify_ok, 
X509_STORE_CTX *ctx) /* {{{ */
 }
 /* }}} */
 
-static int php_openssl_match_cn(const char *subjectname, const char *certname)
+static zend_bool php_openssl_match_cn(const char *subjectname, const char 
*certname)
 {
char *wildcard;
int prefix_len, suffix_len, subject_len;
@@ -4902,7 +4902,6 @@ int php_openssl_apply_verification_policy(SSL *ssl, X509 
*peer, php_stream *stre
/* Does the common name match ? (used primarily for https://) */
GET_VER_OPT_STRING("CN_match", cnmatch);
if (cnmatch) {
-   int match = 0;
int name_len = X509_NAME_get_text_by_NID(name, NID_commonName, 
buf, sizeof(buf));
 
if (name_len == -1) {
@@ -4913,9 +4912,7 @@ int php_openssl_apply_verification_policy(SSL *ssl, X509 
*peer, php_stream *stre
return FAILURE;
}
 
-   match = php_openssl_match_cn(cnmatch, buf);
-
-   if (!match) {
+   if (!php_openssl_match_cn(cnmatch, buf)) {
/* didn't match */
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Peer 
certificate CN=`%.*s' did not match expected CN=`%s'", name_len, buf, cnmatch);
return FAILURE;


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



[PHP-CVS] com php-src: added openssl_x509_digest(), output is binary sha1: ext/openssl/openssl.c ext/openssl/php_openssl.h

2013-10-08 Thread Michael Wallner
Commit:b8f9a20286c6d88c11e81967df42d118bdba2f02
Author:datibbaw  Fri, 20 Sep 2013 15:04:52 +0800
Parents:   11d60447f9f22944dd08d8dacba1230fc4caabd8
Branches:  master

Link:   
http://git.php.net/?p=php-src.git;a=commitdiff;h=b8f9a20286c6d88c11e81967df42d118bdba2f02

Log:
added openssl_x509_digest(), output is binary sha1

Changed paths:
  M  ext/openssl/openssl.c
  M  ext/openssl/php_openssl.h


Diff:
diff --git a/ext/openssl/openssl.c b/ext/openssl/openssl.c
index 4aac4e3..c7203a7 100644
--- a/ext/openssl/openssl.c
+++ b/ext/openssl/openssl.c
@@ -129,6 +129,11 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_openssl_x509_export, 0, 0, 
2)
 ZEND_ARG_INFO(0, notext)
 ZEND_END_ARG_INFO()
 
+ZEND_BEGIN_ARG_INFO_EX(arginfo_openssl_x509_digest, 0, 0, 2)
+   ZEND_ARG_INFO(0, x509)
+   ZEND_ARG_INFO(1, out)
+ZEND_END_ARG_INFO()
+
 ZEND_BEGIN_ARG_INFO(arginfo_openssl_x509_check_private_key, 0)
 ZEND_ARG_INFO(0, cert)
 ZEND_ARG_INFO(0, key)
@@ -443,6 +448,7 @@ const zend_function_entry openssl_functions[] = {
PHP_FE(openssl_x509_checkpurpose,   
arginfo_openssl_x509_checkpurpose)
PHP_FE(openssl_x509_check_private_key,  
arginfo_openssl_x509_check_private_key)
PHP_FE(openssl_x509_export, 
arginfo_openssl_x509_export)
+   PHP_FE(openssl_x509_digest, 
arginfo_openssl_x509_digest)
PHP_FE(openssl_x509_export_to_file, 
arginfo_openssl_x509_export_to_file)
 
 /* PKCS12 funcs */
@@ -1665,6 +1671,41 @@ PHP_FUNCTION(openssl_x509_export)
 }
 /* }}} */
 
+PHP_FUNCTION(openssl_x509_digest)
+{
+   X509 *cert;
+zval **zcert, *zout;
+   long certresource;
+
+unsigned char md[EVP_MAX_MD_SIZE];
+   unsigned int n;
+
+   RETVAL_FALSE;
+
+if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "Zz", &zcert, &zout) 
== FAILURE) {
+   return;
+   }
+
+   cert = php_openssl_x509_from_zval(zcert, 0, &certresource TSRMLS_CC);
+   if (cert == NULL) {
+   php_error_docref(NULL TSRMLS_CC, E_WARNING, "cannot get cert 
from parameter 1");
+   return;
+   }
+
+   if (!X509_digest(cert, EVP_sha1(), md, &n)) {
+   php_error_docref(NULL TSRMLS_CC, E_ERROR, "out of memory");
+   return;
+   }
+
+   zval_dtor(zout);
+   ZVAL_STRINGL(zout, md, n, 1);
+
+   if (certresource == -1 && cert) {
+   X509_free(cert);
+   }
+   RETVAL_TRUE;
+}
+
 /* {{{ proto bool openssl_x509_check_private_key(mixed cert, mixed key)
Checks if a private key corresponds to a CERT */
 PHP_FUNCTION(openssl_x509_check_private_key)
diff --git a/ext/openssl/php_openssl.h b/ext/openssl/php_openssl.h
index 8483bbf..4f0ac14 100644
--- a/ext/openssl/php_openssl.h
+++ b/ext/openssl/php_openssl.h
@@ -66,6 +66,7 @@ PHP_FUNCTION(openssl_x509_free);
 PHP_FUNCTION(openssl_x509_parse);
 PHP_FUNCTION(openssl_x509_checkpurpose);
 PHP_FUNCTION(openssl_x509_export);
+PHP_FUNCTION(openssl_x509_digest);
 PHP_FUNCTION(openssl_x509_export_to_file);
 PHP_FUNCTION(openssl_x509_check_private_key);


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



[PHP-CVS] com php-src: added option for hash function: ext/openssl/openssl.c

2013-10-08 Thread Michael Wallner
Commit:b2881db9a98db6e92d9f6964dd83a003c39a7fbd
Author:datibbaw  Fri, 20 Sep 2013 16:56:50 +0800
Parents:   5cff92fb12e83f4c6c81c6e8b89480def3ee5e9e
Branches:  master

Link:   
http://git.php.net/?p=php-src.git;a=commitdiff;h=b2881db9a98db6e92d9f6964dd83a003c39a7fbd

Log:
added option for hash function

Changed paths:
  M  ext/openssl/openssl.c


Diff:
diff --git a/ext/openssl/openssl.c b/ext/openssl/openssl.c
index 5dfb9b4..6979e35 100644
--- a/ext/openssl/openssl.c
+++ b/ext/openssl/openssl.c
@@ -132,6 +132,7 @@ ZEND_END_ARG_INFO()
 ZEND_BEGIN_ARG_INFO_EX(arginfo_openssl_x509_digest, 0, 0, 2)
ZEND_ARG_INFO(0, x509)
ZEND_ARG_INFO(1, out)
+   ZEND_ARG_INFO(0, method)
ZEND_ARG_INFO(0, raw_output)
 ZEND_END_ARG_INFO()
 
@@ -1678,13 +1679,16 @@ PHP_FUNCTION(openssl_x509_digest)
 zval **zcert, *zout;
long certresource;
zend_bool raw_output = 0;
+   char *method = "sha1";
+   int method_len;
 
+   const EVP_MD *mdtype;
 unsigned char md[EVP_MAX_MD_SIZE];
unsigned int n;
 
RETVAL_FALSE;
 
-if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "Zz|b", &zcert, 
&zout, &raw_output) == FAILURE) {
+if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "Zz|sb", &zcert, 
&zout, &method, &method_len, &raw_output) == FAILURE) {
return;
}
 
@@ -1694,7 +1698,13 @@ PHP_FUNCTION(openssl_x509_digest)
return;
}
 
-   if (!X509_digest(cert, EVP_sha1(), md, &n)) {
+   mdtype = EVP_get_digestbyname(method);
+   if (!mdtype) {
+   php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unknown signature 
algorithm");
+   RETURN_FALSE;
+   }
+
+   if (!X509_digest(cert, mdtype, md, &n)) {
php_error_docref(NULL TSRMLS_CC, E_ERROR, "out of memory");
return;
}


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



[PHP-CVS] com php-src: Merge branch 'bug65729' of https://github.com/datibbaw/php-src: ext/openssl/openssl.c

2013-10-08 Thread Michael Wallner
Commit:8300ced2f7daef0e1a6786d89361b92aadb3dd10
Author:Michael Wallner  Tue, 8 Oct 2013 15:58:28 +0200
Parents:   0d8c83a251a96a81f53dec16e4ae4d39de01c4da 
6106896440572dd8093acdd11ea691a07d9b169c
Branches:  master

Link:   
http://git.php.net/?p=php-src.git;a=commitdiff;h=8300ced2f7daef0e1a6786d89361b92aadb3dd10

Log:
Merge branch 'bug65729' of https://github.com/datibbaw/php-src

* 'bug65729' of https://github.com/datibbaw/php-src:
  DNS name comparison is now case insensitive.
  Use zend_bool as return value for _match()
  Added two more test cases for CN matching.
  yay, reduced one variable
  Fixed bug that would lead to out of bounds memory access
  added better wildcard matching for CN

Bugs:
https://bugs.php.net/65729

Changed paths:
  MM  ext/openssl/openssl.c


Diff:



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



[PHP-CVS] com php-src: added option for raw output: ext/openssl/openssl.c

2013-10-08 Thread Michael Wallner
Commit:5cff92fb12e83f4c6c81c6e8b89480def3ee5e9e
Author:datibbaw  Fri, 20 Sep 2013 15:45:41 +0800
Parents:   b8f9a20286c6d88c11e81967df42d118bdba2f02
Branches:  master

Link:   
http://git.php.net/?p=php-src.git;a=commitdiff;h=5cff92fb12e83f4c6c81c6e8b89480def3ee5e9e

Log:
added option for raw output

Changed paths:
  M  ext/openssl/openssl.c


Diff:
diff --git a/ext/openssl/openssl.c b/ext/openssl/openssl.c
index c7203a7..5dfb9b4 100644
--- a/ext/openssl/openssl.c
+++ b/ext/openssl/openssl.c
@@ -132,6 +132,7 @@ ZEND_END_ARG_INFO()
 ZEND_BEGIN_ARG_INFO_EX(arginfo_openssl_x509_digest, 0, 0, 2)
ZEND_ARG_INFO(0, x509)
ZEND_ARG_INFO(1, out)
+   ZEND_ARG_INFO(0, raw_output)
 ZEND_END_ARG_INFO()
 
 ZEND_BEGIN_ARG_INFO(arginfo_openssl_x509_check_private_key, 0)
@@ -1676,13 +1677,14 @@ PHP_FUNCTION(openssl_x509_digest)
X509 *cert;
 zval **zcert, *zout;
long certresource;
+   zend_bool raw_output = 0;
 
 unsigned char md[EVP_MAX_MD_SIZE];
unsigned int n;
 
RETVAL_FALSE;
 
-if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "Zz", &zcert, &zout) 
== FAILURE) {
+if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "Zz|b", &zcert, 
&zout, &raw_output) == FAILURE) {
return;
}
 
@@ -1698,7 +1700,16 @@ PHP_FUNCTION(openssl_x509_digest)
}
 
zval_dtor(zout);
-   ZVAL_STRINGL(zout, md, n, 1);
+
+   if (raw_output) {
+   ZVAL_STRINGL(zout, md, n, 1);
+   } else {
+   int digest_str_len = n * 2;
+   char *digest_str = emalloc(digest_str_len + 1);
+
+   make_digest_ex(digest_str, md, n);
+   ZVAL_STRINGL(zout, digest_str, digest_str_len, 0);
+   }
 
if (certresource == -1 && cert) {
X509_free(cert);


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



[PHP-CVS] com php-src: removed the byref result: ext/openssl/openssl.c

2013-10-08 Thread Michael Wallner
Commit:574fe449dc05a11cfe7e6a33b04d3f6557442600
Author:Tjerk Meesters  Fri, 20 Sep 2013 22:50:30 
+0800
Parents:   ce13f9fa328ae4a0c7fa9ef5efdb72a43f29dde2
Branches:  master

Link:   
http://git.php.net/?p=php-src.git;a=commitdiff;h=574fe449dc05a11cfe7e6a33b04d3f6557442600

Log:
removed the byref result

Changed paths:
  M  ext/openssl/openssl.c


Diff:
diff --git a/ext/openssl/openssl.c b/ext/openssl/openssl.c
index f0ae2b7..e6040d5 100644
--- a/ext/openssl/openssl.c
+++ b/ext/openssl/openssl.c
@@ -129,9 +129,8 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_openssl_x509_export, 0, 0, 2)
 ZEND_ARG_INFO(0, notext)
 ZEND_END_ARG_INFO()
 
-ZEND_BEGIN_ARG_INFO_EX(arginfo_openssl_x509_digest, 0, 0, 2)
+ZEND_BEGIN_ARG_INFO_EX(arginfo_openssl_x509_digest, 0, 0, 1)
ZEND_ARG_INFO(0, x509)
-   ZEND_ARG_INFO(1, out)
ZEND_ARG_INFO(0, method)
ZEND_ARG_INFO(0, raw_output)
 ZEND_END_ARG_INFO()
@@ -1676,7 +1675,7 @@ PHP_FUNCTION(openssl_x509_export)
 PHP_FUNCTION(openssl_x509_digest)
 {
X509 *cert;
-   zval **zcert, *zout;
+   zval **zcert;
long certresource;
zend_bool raw_output = 0;
char *method = "sha1";
@@ -1688,7 +1687,7 @@ PHP_FUNCTION(openssl_x509_digest)
 
RETVAL_FALSE;
 
-if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "Zz|sb", &zcert, 
&zout, &method, &method_len, &raw_output) == FAILURE) {
+   if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "Z|sb", &zcert, 
&method, &method_len, &raw_output) == FAILURE) {
return;
}
 
@@ -1701,7 +1700,7 @@ PHP_FUNCTION(openssl_x509_digest)
mdtype = EVP_get_digestbyname(method);
if (!mdtype) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unknown signature 
algorithm");
-   RETURN_FALSE;
+   return;
}
 
if (!X509_digest(cert, mdtype, md, &n)) {
@@ -1709,22 +1708,19 @@ PHP_FUNCTION(openssl_x509_digest)
return;
}
 
-   zval_dtor(zout);
-
if (raw_output) {
-   ZVAL_STRINGL(zout, md, n, 1);
+   RETVAL_STRINGL(md, n, 1);
} else {
int digest_str_len = n * 2;
char *digest_str = emalloc(digest_str_len + 1);
 
make_digest_ex(digest_str, md, n);
-   ZVAL_STRINGL(zout, digest_str, digest_str_len, 0);
+   RETVAL_STRINGL(digest_str, digest_str_len, 0);
}
 
if (certresource == -1 && cert) {
X509_free(cert);
}
-   RETVAL_TRUE;
 }
 
 /* {{{ proto bool openssl_x509_check_private_key(mixed cert, mixed key)


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



[PHP-CVS] com php-src: indentation fail: ext/openssl/openssl.c

2013-10-08 Thread Michael Wallner
Commit:ce13f9fa328ae4a0c7fa9ef5efdb72a43f29dde2
Author:datibbaw  Fri, 20 Sep 2013 16:59:44 +0800
Parents:   b2881db9a98db6e92d9f6964dd83a003c39a7fbd
Branches:  master

Link:   
http://git.php.net/?p=php-src.git;a=commitdiff;h=ce13f9fa328ae4a0c7fa9ef5efdb72a43f29dde2

Log:
indentation fail

Changed paths:
  M  ext/openssl/openssl.c


Diff:
diff --git a/ext/openssl/openssl.c b/ext/openssl/openssl.c
index 6979e35..f0ae2b7 100644
--- a/ext/openssl/openssl.c
+++ b/ext/openssl/openssl.c
@@ -1676,14 +1676,14 @@ PHP_FUNCTION(openssl_x509_export)
 PHP_FUNCTION(openssl_x509_digest)
 {
X509 *cert;
-zval **zcert, *zout;
+   zval **zcert, *zout;
long certresource;
zend_bool raw_output = 0;
char *method = "sha1";
int method_len;
 
const EVP_MD *mdtype;
-unsigned char md[EVP_MAX_MD_SIZE];
+   unsigned char md[EVP_MAX_MD_SIZE];
unsigned int n;
 
RETVAL_FALSE;


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



[PHP-CVS] com php-src: who put that stupid newline there?: ext/openssl/openssl.c

2013-10-08 Thread Michael Wallner
Commit:69bdc5aca8f14515556bb6fc8f86becf55ef30bf
Author:Tjerk Meesters  Mon, 23 Sep 2013 23:42:31 
+0800
Parents:   1c7cabb2ca405e6763d7044015f9cb063941a838
Branches:  master

Link:   
http://git.php.net/?p=php-src.git;a=commitdiff;h=69bdc5aca8f14515556bb6fc8f86becf55ef30bf

Log:
who put that stupid newline there?

Changed paths:
  M  ext/openssl/openssl.c


Diff:
diff --git a/ext/openssl/openssl.c b/ext/openssl/openssl.c
index c8588e2..a6ddd14 100644
--- a/ext/openssl/openssl.c
+++ b/ext/openssl/openssl.c
@@ -1,5 +1,4 @@
 /*
-   
+--+
| PHP Version 5|
+--+


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



[PHP-CVS] com php-src: don't leak cert on errors, return null on zpp failure: ext/openssl/openssl.c ext/openssl/tests/openssl_x509_digest.phpt

2013-10-08 Thread Michael Wallner
Commit:521a5c956800115f0be008e0581878e4303a5118
Author:Tjerk Meesters  Sat, 21 Sep 2013 18:24:00 
+0800
Parents:   a97aec16c0320c5737b43ad1c3caf01ea1485874
Branches:  master

Link:   
http://git.php.net/?p=php-src.git;a=commitdiff;h=521a5c956800115f0be008e0581878e4303a5118

Log:
don't leak cert on errors, return null on zpp failure

Changed paths:
  M  ext/openssl/openssl.c
  M  ext/openssl/tests/openssl_x509_digest.phpt


Diff:
diff --git a/ext/openssl/openssl.c b/ext/openssl/openssl.c
index e6040d5..9685dac 100644
--- a/ext/openssl/openssl.c
+++ b/ext/openssl/openssl.c
@@ -1685,8 +1685,6 @@ PHP_FUNCTION(openssl_x509_digest)
unsigned char md[EVP_MAX_MD_SIZE];
unsigned int n;
 
-   RETVAL_FALSE;
-
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "Z|sb", &zcert, 
&method, &method_len, &raw_output) == FAILURE) {
return;
}
@@ -1694,28 +1692,26 @@ PHP_FUNCTION(openssl_x509_digest)
cert = php_openssl_x509_from_zval(zcert, 0, &certresource TSRMLS_CC);
if (cert == NULL) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "cannot get cert 
from parameter 1");
-   return;
+   RETURN_FALSE;
}
 
mdtype = EVP_get_digestbyname(method);
if (!mdtype) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unknown signature 
algorithm");
-   return;
-   }
-
-   if (!X509_digest(cert, mdtype, md, &n)) {
-   php_error_docref(NULL TSRMLS_CC, E_ERROR, "out of memory");
-   return;
-   }
-
-   if (raw_output) {
-   RETVAL_STRINGL(md, n, 1);
+   RETVAL_FALSE;
+   } else if (!X509_digest(cert, mdtype, md, &n)) {
+   php_error_docref(NULL TSRMLS_CC, E_ERROR, "Out of memory");
+   RETVAL_FALSE;
} else {
-   int digest_str_len = n * 2;
-   char *digest_str = emalloc(digest_str_len + 1);
+   if (raw_output) {
+   RETVAL_STRINGL(md, n, 1);
+   } else {
+   int digest_str_len = n * 2;
+   char *digest_str = emalloc(digest_str_len + 1);
 
-   make_digest_ex(digest_str, md, n);
-   RETVAL_STRINGL(digest_str, digest_str_len, 0);
+   make_digest_ex(digest_str, md, n);
+   RETVAL_STRINGL(digest_str, digest_str_len, 0);
+   }
}
 
if (certresource == -1 && cert) {
diff --git a/ext/openssl/tests/openssl_x509_digest.phpt 
b/ext/openssl/tests/openssl_x509_digest.phpt
index 98ec009..fde4280 100644
--- a/ext/openssl/tests/openssl_x509_digest.phpt
+++ b/ext/openssl/tests/openssl_x509_digest.phpt
@@ -9,8 +9,12 @@ if (!extension_loaded("openssl")) die("skip");
 
 $cert = "file://" . dirname(__FILE__) . "/cert.crt";
 
+echo "** Testing with no parameters **\n";
+var_dump(openssl_x509_digest());
+
 echo "** Testing default functionality **\n";
 var_dump(openssl_x509_digest($cert));
+
 echo "** Testing hash method md5 **\n";
 var_dump(openssl_x509_digest($cert, 'md5'));
 
@@ -22,6 +26,10 @@ var_dump(openssl_x509_digest('123'));
 echo "** Testing bad hash method **\n";
 var_dump(openssl_x509_digest($cert, 'xx45'));
 --EXPECTF--
+** Testing with no parameters **
+
+Warning: openssl_x509_digest() expects at least 1 parameter, 0 given in %s on 
line %d
+NULL
 ** Testing default functionality **
 string(40) "6e6fd1ea10a5a23071d61c728ee9b40df6dbc33c"
 ** Testing hash method md5 **


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



[PHP-CVS] com php-src: Support string and array for peer fingerprint matching: ext/openssl/openssl.c ext/openssl/tests/openssl_peer_fingerprint.phpt

2013-10-08 Thread Michael Wallner
Commit:edd93f34520b550c4c42877fe9e03112cad005ba
Author:datibbaw  Fri, 27 Sep 2013 14:13:11 +0800
Parents:   69bdc5aca8f14515556bb6fc8f86becf55ef30bf
Branches:  master

Link:   
http://git.php.net/?p=php-src.git;a=commitdiff;h=edd93f34520b550c4c42877fe9e03112cad005ba

Log:
Support string and array for peer fingerprint matching

Changed paths:
  M  ext/openssl/openssl.c
  M  ext/openssl/tests/openssl_peer_fingerprint.phpt


Diff:
diff --git a/ext/openssl/openssl.c b/ext/openssl/openssl.c
index a6ddd14..c0d1b0b 100644
--- a/ext/openssl/openssl.c
+++ b/ext/openssl/openssl.c
@@ -1672,7 +1672,7 @@ PHP_FUNCTION(openssl_x509_export)
 }
 /* }}} */
 
-int php_openssl_x509_fingerprint(X509 *peer, const char *method, int raw, char 
**out, int *out_len)
+static int php_openssl_x509_fingerprint(X509 *peer, const char *method, int 
raw, char **out, int *out_len)
 {
unsigned char md[EVP_MAX_MD_SIZE];
const EVP_MD *mdtype;
@@ -1699,6 +1699,61 @@ int php_openssl_x509_fingerprint(X509 *peer, const char 
*method, int raw, char *
return 1;
 }
 
+static int php_x509_fingerprint_cmp(X509 *peer, const char *method, const char 
*expected)
+{
+   char *fingerprint;
+   int fingerprint_len;
+   int result = -1;
+
+   if (php_openssl_x509_fingerprint(peer, method, 0, &fingerprint, 
&fingerprint_len)) {
+   result = strcmp(expected, fingerprint);
+   efree(fingerprint);
+   }
+
+   return result;
+}
+
+static int php_x509_fingerprint_match(X509 *peer, zval **val)
+{
+   if (Z_TYPE_PP(val) == IS_STRING) {
+   const char *method = NULL;
+
+   switch (Z_STRLEN_PP(val)) {
+   case 32:
+   method = "md5";
+   break;
+
+   case 40:
+   method = "sha1";
+   break;
+   }
+
+   return method && php_x509_fingerprint_cmp(peer, method, 
Z_STRVAL_PP(val)) == 0;
+   } else if (Z_TYPE_PP(val) == IS_ARRAY) {
+   HashPosition pos;
+   zval **current;
+   char *key;
+   uint key_len;
+   ulong key_index;
+
+   for (zend_hash_internal_pointer_reset_ex(Z_ARRVAL_PP(val), 
&pos);
+   zend_hash_get_current_data_ex(Z_ARRVAL_PP(val), (void 
**)¤t, &pos) == SUCCESS;
+   zend_hash_move_forward_ex(Z_ARRVAL_PP(val), &pos)
+   ) {
+   int key_type = 
zend_hash_get_current_key_ex(Z_ARRVAL_PP(val), &key, &key_len, &key_index, 0, 
&pos);
+
+   if (key_type == HASH_KEY_IS_STRING 
+   && Z_TYPE_PP(current) == IS_STRING
+   && php_x509_fingerprint_cmp(peer, key, 
Z_STRVAL_PP(current)) != 0
+   ) {
+   return 0;
+   }
+   }
+   return 1;
+   }
+   return 0;
+}
+
 PHP_FUNCTION(openssl_x509_fingerprint)
 {
X509 *cert;
@@ -1709,7 +1764,7 @@ PHP_FUNCTION(openssl_x509_fingerprint)
int method_len;
 
char *fingerprint;
-   char *fingerprint_len;
+   int fingerprint_len;
 
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "Z|sb", &zcert, 
&method, &method_len, &raw_output) == FAILURE) {
return;
@@ -4932,30 +4987,14 @@ int php_openssl_apply_verification_policy(SSL *ssl, 
X509 *peer, php_stream *stre
 
/* if the cert passed the usual checks, apply our own local policies 
now */
 
-   if (GET_VER_OPT("peer_fingerprint") && Z_TYPE_PP(val) == IS_STRING) {
-   char *fingerprint;
-   int fingerprint_len;
-   const char *method = NULL;
-
-   switch (Z_STRLEN_PP(val)) {
-   case 32:
-   method = "md5";
-   break;
-
-   case 40:
-   method = "sha1";
-   break;
-   }
-
-   if (method && php_openssl_x509_fingerprint(peer, method, 0, 
&fingerprint, &fingerprint_len)) {
-   int match = strcmp(Z_STRVAL_PP(val), fingerprint) == 0;
-
-   efree(fingerprint);
-
-   if (!match) {
-   php_error_docref(NULL TSRMLS_CC, E_WARNING, 
"Peer fingerprint `%s` not matched", Z_STRVAL_PP(val));
+   if (GET_VER_OPT("peer_fingerprint")) {
+   if (Z_TYPE_PP(val) == IS_STRING || Z_TYPE_PP(val) == IS_ARRAY) {
+   if (!php_x509_fingerprint_match(peer, val)) {
+   php_error_docref(NULL TSRMLS_CC, E_WARNING, 
"Peer fingerprint doesn't match");
return FAILURE;
}
+   } else {
+   php_err

[PHP-CVS] com php-src: Renamed to be more descriptive of what it does: ext/openssl/openssl.c ext/openssl/php_openssl.h ext/openssl/tests/openssl_x509_digest.phpt ext/openssl/tests/openssl_x509_fingerp

2013-10-08 Thread Michael Wallner
Commit:2bfc5a253b4ee76f9930692f2d088371c38dd65f
Author:Tjerk Meesters  Mon, 23 Sep 2013 00:51:17 
+0800
Parents:   521a5c956800115f0be008e0581878e4303a5118
Branches:  master

Link:   
http://git.php.net/?p=php-src.git;a=commitdiff;h=2bfc5a253b4ee76f9930692f2d088371c38dd65f

Log:
Renamed to be more descriptive of what it does

Changed paths:
  M  ext/openssl/openssl.c
  M  ext/openssl/php_openssl.h
  D  ext/openssl/tests/openssl_x509_digest.phpt
  A  ext/openssl/tests/openssl_x509_fingerprint.phpt


Diff:
diff --git a/ext/openssl/openssl.c b/ext/openssl/openssl.c
index 9685dac..9da10fc 100644
--- a/ext/openssl/openssl.c
+++ b/ext/openssl/openssl.c
@@ -129,7 +129,7 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_openssl_x509_export, 0, 0, 2)
 ZEND_ARG_INFO(0, notext)
 ZEND_END_ARG_INFO()
 
-ZEND_BEGIN_ARG_INFO_EX(arginfo_openssl_x509_digest, 0, 0, 1)
+ZEND_BEGIN_ARG_INFO_EX(arginfo_openssl_x509_fingerprint, 0, 0, 1)
ZEND_ARG_INFO(0, x509)
ZEND_ARG_INFO(0, method)
ZEND_ARG_INFO(0, raw_output)
@@ -449,7 +449,7 @@ const zend_function_entry openssl_functions[] = {
PHP_FE(openssl_x509_checkpurpose,   
arginfo_openssl_x509_checkpurpose)
PHP_FE(openssl_x509_check_private_key,  
arginfo_openssl_x509_check_private_key)
PHP_FE(openssl_x509_export, 
arginfo_openssl_x509_export)
-   PHP_FE(openssl_x509_digest, 
arginfo_openssl_x509_digest)
+   PHP_FE(openssl_x509_fingerprint,
arginfo_openssl_x509_fingerprint)
PHP_FE(openssl_x509_export_to_file, 
arginfo_openssl_x509_export_to_file)
 
 /* PKCS12 funcs */
@@ -1672,7 +1672,7 @@ PHP_FUNCTION(openssl_x509_export)
 }
 /* }}} */
 
-PHP_FUNCTION(openssl_x509_digest)
+PHP_FUNCTION(openssl_x509_fingerprint)
 {
X509 *cert;
zval **zcert;
diff --git a/ext/openssl/php_openssl.h b/ext/openssl/php_openssl.h
index 4f0ac14..a06e43d 100644
--- a/ext/openssl/php_openssl.h
+++ b/ext/openssl/php_openssl.h
@@ -66,7 +66,7 @@ PHP_FUNCTION(openssl_x509_free);
 PHP_FUNCTION(openssl_x509_parse);
 PHP_FUNCTION(openssl_x509_checkpurpose);
 PHP_FUNCTION(openssl_x509_export);
-PHP_FUNCTION(openssl_x509_digest);
+PHP_FUNCTION(openssl_x509_fingerprint);
 PHP_FUNCTION(openssl_x509_export_to_file);
 PHP_FUNCTION(openssl_x509_check_private_key);
 
diff --git a/ext/openssl/tests/openssl_x509_digest.phpt 
b/ext/openssl/tests/openssl_x509_digest.phpt
deleted file mode 100644
index fde4280..000
--- a/ext/openssl/tests/openssl_x509_digest.phpt
+++ /dev/null
@@ -1,47 +0,0 @@
---TEST--
-Testing openssl_x509_digest()
---SKIPIF--
-
---FILE--
-
+--FILE--
+http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-CVS] com php-src: show method in error message: ext/openssl/openssl.c

2013-10-08 Thread Michael Wallner
Commit:e45eacd8fa4e32692697171e90f14d3c66d673de
Author:Tjerk Meesters  Mon, 30 Sep 2013 21:21:56 
+0800
Parents:   edd93f34520b550c4c42877fe9e03112cad005ba
Branches:  master

Link:   
http://git.php.net/?p=php-src.git;a=commitdiff;h=e45eacd8fa4e32692697171e90f14d3c66d673de

Log:
show method in error message

Changed paths:
  M  ext/openssl/openssl.c


Diff:
diff --git a/ext/openssl/openssl.c b/ext/openssl/openssl.c
index c0d1b0b..c208d43 100644
--- a/ext/openssl/openssl.c
+++ b/ext/openssl/openssl.c
@@ -1679,7 +1679,7 @@ static int php_openssl_x509_fingerprint(X509 *peer, const 
char *method, int raw,
int n;
 
if (!(mdtype = EVP_get_digestbyname(method))) {
-   php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unknown signature 
algorithm");
+   php_error_docref(NULL TSRMLS_CC, E_WARNING, "`%s`: Unknown 
signature algorithm", method);
return 0;
} else if (!X509_digest(peer, mdtype, md, &n)) {
php_error_docref(NULL TSRMLS_CC, E_ERROR, "Could not generate 
signature");


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



[PHP-CVS] com php-src: add md5 and sha1 fingerprint tests: ext/openssl/openssl.c ext/openssl/tests/openssl_peer_fingerprint.phpt

2013-10-08 Thread Michael Wallner
Commit:1c7cabb2ca405e6763d7044015f9cb063941a838
Author:Tjerk Meesters  Mon, 23 Sep 2013 23:29:17 
+0800
Parents:   2bfc5a253b4ee76f9930692f2d088371c38dd65f
Branches:  master

Link:   
http://git.php.net/?p=php-src.git;a=commitdiff;h=1c7cabb2ca405e6763d7044015f9cb063941a838

Log:
add md5 and sha1 fingerprint tests

Changed paths:
  M  ext/openssl/openssl.c
  A  ext/openssl/tests/openssl_peer_fingerprint.phpt


Diff:
diff --git a/ext/openssl/openssl.c b/ext/openssl/openssl.c
index 9da10fc..c8588e2 100644
--- a/ext/openssl/openssl.c
+++ b/ext/openssl/openssl.c
@@ -1,4 +1,5 @@
 /*
+   
+--+
| PHP Version 5|
+--+
@@ -1672,6 +1673,33 @@ PHP_FUNCTION(openssl_x509_export)
 }
 /* }}} */
 
+int php_openssl_x509_fingerprint(X509 *peer, const char *method, int raw, char 
**out, int *out_len)
+{
+   unsigned char md[EVP_MAX_MD_SIZE];
+   const EVP_MD *mdtype;
+   int n;
+
+   if (!(mdtype = EVP_get_digestbyname(method))) {
+   php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unknown signature 
algorithm");
+   return 0;
+   } else if (!X509_digest(peer, mdtype, md, &n)) {
+   php_error_docref(NULL TSRMLS_CC, E_ERROR, "Could not generate 
signature");
+   return 0;
+   }
+
+   if (raw) {
+   *out_len = n;
+   *out = estrndup(md, n);
+   } else {
+   *out_len = n * 2;
+   *out = emalloc(*out_len + 1);
+
+   make_digest_ex(*out, md, n);
+   }
+
+   return 1;
+}
+
 PHP_FUNCTION(openssl_x509_fingerprint)
 {
X509 *cert;
@@ -1681,9 +1709,8 @@ PHP_FUNCTION(openssl_x509_fingerprint)
char *method = "sha1";
int method_len;
 
-   const EVP_MD *mdtype;
-   unsigned char md[EVP_MAX_MD_SIZE];
-   unsigned int n;
+   char *fingerprint;
+   char *fingerprint_len;
 
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "Z|sb", &zcert, 
&method, &method_len, &raw_output) == FAILURE) {
return;
@@ -1695,23 +1722,10 @@ PHP_FUNCTION(openssl_x509_fingerprint)
RETURN_FALSE;
}
 
-   mdtype = EVP_get_digestbyname(method);
-   if (!mdtype) {
-   php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unknown signature 
algorithm");
-   RETVAL_FALSE;
-   } else if (!X509_digest(cert, mdtype, md, &n)) {
-   php_error_docref(NULL TSRMLS_CC, E_ERROR, "Out of memory");
-   RETVAL_FALSE;
+   if (php_openssl_x509_fingerprint(cert, method, raw_output, 
&fingerprint, &fingerprint_len)) {
+   RETVAL_STRINGL(fingerprint, fingerprint_len, 0);
} else {
-   if (raw_output) {
-   RETVAL_STRINGL(md, n, 1);
-   } else {
-   int digest_str_len = n * 2;
-   char *digest_str = emalloc(digest_str_len + 1);
-
-   make_digest_ex(digest_str, md, n);
-   RETVAL_STRINGL(digest_str, digest_str_len, 0);
-   }
+   RETVAL_FALSE;
}
 
if (certresource == -1 && cert) {
@@ -4919,6 +4933,33 @@ int php_openssl_apply_verification_policy(SSL *ssl, X509 
*peer, php_stream *stre
 
/* if the cert passed the usual checks, apply our own local policies 
now */
 
+   if (GET_VER_OPT("peer_fingerprint") && Z_TYPE_PP(val) == IS_STRING) {
+   char *fingerprint;
+   int fingerprint_len;
+   const char *method = NULL;
+
+   switch (Z_STRLEN_PP(val)) {
+   case 32:
+   method = "md5";
+   break;
+
+   case 40:
+   method = "sha1";
+   break;
+   }
+
+   if (method && php_openssl_x509_fingerprint(peer, method, 0, 
&fingerprint, &fingerprint_len)) {
+   int match = strcmp(Z_STRVAL_PP(val), fingerprint) == 0;
+
+   efree(fingerprint);
+
+   if (!match) {
+   php_error_docref(NULL TSRMLS_CC, E_WARNING, 
"Peer fingerprint `%s` not matched", Z_STRVAL_PP(val));
+   return FAILURE;
+   }
+   }
+   }
+
name = X509_get_subject_name(peer);
 
/* Does the common name match ? (used primarily for https://) */
diff --git a/ext/openssl/tests/openssl_peer_fingerprint.phpt 
b/ext/openssl/tests/openssl_peer_fingerprint.phpt
new file mode 100644
index 000..a6be676
--- /dev/null
+++ b/ext/openssl/tests/openssl_peer_fingerprint.phpt
@@ -0,0 +1,44 @@
+--TEST--
+Testing peer fingerprint on connection
+--SKIPIF--
+ arra

[PHP-CVS] com php-src: Added test case for openssl_x509_digest(): ext/openssl/tests/openssl_x509_digest.phpt

2013-10-08 Thread Michael Wallner
Commit:a97aec16c0320c5737b43ad1c3caf01ea1485874
Author:Tjerk Meesters  Fri, 20 Sep 2013 23:28:29 
+0800
Committer: Tjerk Meesters   Fri, 20 Sep 2013 23:29:04 +0800
Parents:   574fe449dc05a11cfe7e6a33b04d3f6557442600
Branches:  master

Link:   
http://git.php.net/?p=php-src.git;a=commitdiff;h=a97aec16c0320c5737b43ad1c3caf01ea1485874

Log:
Added test case for openssl_x509_digest()

Changed paths:
  A  ext/openssl/tests/openssl_x509_digest.phpt


Diff:
diff --git a/ext/openssl/tests/openssl_x509_digest.phpt 
b/ext/openssl/tests/openssl_x509_digest.phpt
new file mode 100644
index 000..98ec009
--- /dev/null
+++ b/ext/openssl/tests/openssl_x509_digest.phpt
@@ -0,0 +1,39 @@
+--TEST--
+Testing openssl_x509_digest()
+--SKIPIF--
+
+--FILE--
+http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-CVS] com php-src: Using SUCCESS and FAILURE for return values Using zend_bool for boolean arguments and return values Reduced one level of zval indirection where possible: ext/openssl/openssl.c

2013-10-08 Thread Michael Wallner
Commit:955bc1d91bd772cbb782830220048511b657f063
Author:datibbaw  Mon, 7 Oct 2013 15:38:48 +0800
Parents:   e45eacd8fa4e32692697171e90f14d3c66d673de
Branches:  master

Link:   
http://git.php.net/?p=php-src.git;a=commitdiff;h=955bc1d91bd772cbb782830220048511b657f063

Log:
Using SUCCESS and FAILURE for return values
Using zend_bool for boolean arguments and return values
Reduced one level of zval indirection where possible

Changed paths:
  M  ext/openssl/openssl.c


Diff:
diff --git a/ext/openssl/openssl.c b/ext/openssl/openssl.c
index c208d43..d963f86 100644
--- a/ext/openssl/openssl.c
+++ b/ext/openssl/openssl.c
@@ -1672,18 +1672,18 @@ PHP_FUNCTION(openssl_x509_export)
 }
 /* }}} */
 
-static int php_openssl_x509_fingerprint(X509 *peer, const char *method, int 
raw, char **out, int *out_len)
+static int php_openssl_x509_fingerprint(X509 *peer, const char *method, 
zend_bool raw, char **out, int *out_len)
 {
unsigned char md[EVP_MAX_MD_SIZE];
const EVP_MD *mdtype;
int n;
 
if (!(mdtype = EVP_get_digestbyname(method))) {
-   php_error_docref(NULL TSRMLS_CC, E_WARNING, "`%s`: Unknown 
signature algorithm", method);
-   return 0;
+   php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unknown signature 
algorithm");
+   return FAILURE;
} else if (!X509_digest(peer, mdtype, md, &n)) {
php_error_docref(NULL TSRMLS_CC, E_ERROR, "Could not generate 
signature");
-   return 0;
+   return FAILURE;
}
 
if (raw) {
@@ -1696,7 +1696,7 @@ static int php_openssl_x509_fingerprint(X509 *peer, const 
char *method, int raw,
make_digest_ex(*out, md, n);
}
 
-   return 1;
+   return SUCCESS;
 }
 
 static int php_x509_fingerprint_cmp(X509 *peer, const char *method, const char 
*expected)
@@ -1705,7 +1705,7 @@ static int php_x509_fingerprint_cmp(X509 *peer, const 
char *method, const char *
int fingerprint_len;
int result = -1;
 
-   if (php_openssl_x509_fingerprint(peer, method, 0, &fingerprint, 
&fingerprint_len)) {
+   if (php_openssl_x509_fingerprint(peer, method, 0, &fingerprint, 
&fingerprint_len) == SUCCESS) {
result = strcmp(expected, fingerprint);
efree(fingerprint);
}
@@ -1713,12 +1713,12 @@ static int php_x509_fingerprint_cmp(X509 *peer, const 
char *method, const char *
return result;
 }
 
-static int php_x509_fingerprint_match(X509 *peer, zval **val)
+static zend_bool php_x509_fingerprint_match(X509 *peer, zval *val)
 {
-   if (Z_TYPE_PP(val) == IS_STRING) {
+   if (Z_TYPE_P(val) == IS_STRING) {
const char *method = NULL;
 
-   switch (Z_STRLEN_PP(val)) {
+   switch (Z_STRLEN_P(val)) {
case 32:
method = "md5";
break;
@@ -1728,19 +1728,19 @@ static int php_x509_fingerprint_match(X509 *peer, zval 
**val)
break;
}
 
-   return method && php_x509_fingerprint_cmp(peer, method, 
Z_STRVAL_PP(val)) == 0;
-   } else if (Z_TYPE_PP(val) == IS_ARRAY) {
+   return method && php_x509_fingerprint_cmp(peer, method, 
Z_STRVAL_P(val)) == 0;
+   } else if (Z_TYPE_P(val) == IS_ARRAY) {
HashPosition pos;
zval **current;
char *key;
uint key_len;
ulong key_index;
 
-   for (zend_hash_internal_pointer_reset_ex(Z_ARRVAL_PP(val), 
&pos);
-   zend_hash_get_current_data_ex(Z_ARRVAL_PP(val), (void 
**)¤t, &pos) == SUCCESS;
-   zend_hash_move_forward_ex(Z_ARRVAL_PP(val), &pos)
+   for (zend_hash_internal_pointer_reset_ex(Z_ARRVAL_P(val), &pos);
+   zend_hash_get_current_data_ex(Z_ARRVAL_P(val), (void 
**)¤t, &pos) == SUCCESS;
+   zend_hash_move_forward_ex(Z_ARRVAL_P(val), &pos)
) {
-   int key_type = 
zend_hash_get_current_key_ex(Z_ARRVAL_PP(val), &key, &key_len, &key_index, 0, 
&pos);
+   int key_type = 
zend_hash_get_current_key_ex(Z_ARRVAL_P(val), &key, &key_len, &key_index, 0, 
&pos);
 
if (key_type == HASH_KEY_IS_STRING 
&& Z_TYPE_PP(current) == IS_STRING
@@ -1776,7 +1776,7 @@ PHP_FUNCTION(openssl_x509_fingerprint)
RETURN_FALSE;
}
 
-   if (php_openssl_x509_fingerprint(cert, method, raw_output, 
&fingerprint, &fingerprint_len)) {
+   if (php_openssl_x509_fingerprint(cert, method, raw_output, 
&fingerprint, &fingerprint_len) == SUCCESS) {
RETVAL_STRINGL(fingerprint, fingerprint_len, 0);
} else {
RETVAL_FALSE;
@@ -4989,7 +4989,7 @@ int php_openssl_apply_verification_policy(SSL *ssl, X509 
*peer, php_stream *stre
 

[PHP-CVS] com php-src: fix bad cast: ext/standard/php_fopen_wrapper.c

2013-10-08 Thread Michael Wallner
Commit:5d430ad90257e353321789d9dfe529554028ff6e
Author:Michael Wallner  Tue, 8 Oct 2013 11:16:53 +0200
Parents:   b15765412aebb6b158465f26d8eedb85737862d8
Branches:  master

Link:   
http://git.php.net/?p=php-src.git;a=commitdiff;h=5d430ad90257e353321789d9dfe529554028ff6e

Log:
fix bad cast

Changed paths:
  M  ext/standard/php_fopen_wrapper.c


Diff:
diff --git a/ext/standard/php_fopen_wrapper.c b/ext/standard/php_fopen_wrapper.c
index 76f77eb..0adb1e0 100644
--- a/ext/standard/php_fopen_wrapper.c
+++ b/ext/standard/php_fopen_wrapper.c
@@ -120,11 +120,11 @@ static int php_stream_input_flush(php_stream *stream 
TSRMLS_DC) /* {{{ */
 
 static int php_stream_input_seek(php_stream *stream, off_t offset, int whence, 
off_t *newoffset TSRMLS_DC) /* {{{ */
 {
-   php_stream *inner = stream->abstract;
+   php_stream_input_t *input = stream->abstract;
 
-   if (inner) {
-   int sought = php_stream_seek(inner, offset, whence);
-   *newoffset = inner->position;
+   if (*input->body_ptr) {
+   int sought = php_stream_seek(*input->body_ptr, offset, whence);
+   *newoffset = (*input->body_ptr)->position;
return sought;
}


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



[PHP-CVS] com php-src: fix bug #51076 (race condition in shtool's mkdir -p): NEWS build/shtool

2013-10-07 Thread Michael Wallner
Commit:f32d2ac3aaa7d4af7c348b00ebebb9ae64955704
Author:Michael Wallner  Tue, 8 Oct 2013 08:37:08 +0200
Parents:   0117eb747e1b36a301d58fa29aa3ae48b5aa2ac7
Branches:  PHP-5.5 master

Link:   
http://git.php.net/?p=php-src.git;a=commitdiff;h=f32d2ac3aaa7d4af7c348b00ebebb9ae64955704

Log:
fix bug #51076 (race condition in shtool's mkdir -p)

Bugs:
https://bugs.php.net/51076

Changed paths:
  M  NEWS
  M  build/shtool


Diff:
diff --git a/NEWS b/NEWS
index 796f82f..6649a49 100644
--- a/NEWS
+++ b/NEWS
@@ -2,6 +2,10 @@ PHP
NEWS
 |||
 ?? ??? 2013, PHP 5.5.5
 
+- Buildsystem:
+  . Fixed bug #51076 (race condition in shtool's mkdir -p implementation).
+(Mike, Raphael Geissert)
+
 - Core:
   . Fixed bug #64979 (Wrong behavior of static variables in closure 
generators).
 (Nikita)
diff --git a/build/shtool b/build/shtool
index 684a01f..fc6ae1e 100755
--- a/build/shtool
+++ b/build/shtool
@@ -1003,7 +1003,14 @@ mkdir )
 if [ ".$opt_t" = .yes ]; then
 echo "mkdir $pathcomp" 1>&2
 fi
-mkdir $pathcomp || errstatus=$?
+   # See https://bugs.php.net/51076
+   # The fix is from Debian who have sent 
it
+   # upstream, too; but upstream seems 
dead.
+mkdir $pathcomp || {
+_errstatus=$?
+[ -d "$pathcomp" ] || errstatus=${_errstatus}
+unset _errstatus
+}
 if [ ".$opt_o" != . ]; then
 if [ ".$opt_t" = .yes ]; then
 echo "chown $opt_o $pathcomp" 1>&2


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



[PHP-CVS] com php-src: Merge branch 'PHP-5.4' into PHP-5.5: ext/standard/var.c

2013-10-04 Thread Michael Wallner
Commit:d72a4d1634ff8938cf60c57132d36a79b55bbe4d
Author:Michael Wallner  Fri, 4 Oct 2013 16:17:37 +0200
Parents:   adfb5ab7ced3b0d4456680edb1766f4ad4f279d6 
8973390541faaadfdfc0f838421f037060188e5e
Branches:  PHP-5.5 master

Link:   
http://git.php.net/?p=php-src.git;a=commitdiff;h=d72a4d1634ff8938cf60c57132d36a79b55bbe4d

Log:
Merge branch 'PHP-5.4' into PHP-5.5

* PHP-5.4:
  fix bug #64146 (serialize incorrectly saving objects when they are cloned)

Bugs:
https://bugs.php.net/64146

Changed paths:
  MM  ext/standard/var.c


Diff:



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



[PHP-CVS] com php-src: Merge branch 'PHP-5.5': ext/standard/var.c

2013-10-04 Thread Michael Wallner
Commit:f72ed22749178b9d17455a308cefc523fd85109e
Author:Michael Wallner  Fri, 4 Oct 2013 16:17:46 +0200
Parents:   39022ba227af59a7ab040d7b8fa3510747920733 
d72a4d1634ff8938cf60c57132d36a79b55bbe4d
Branches:  master

Link:   
http://git.php.net/?p=php-src.git;a=commitdiff;h=f72ed22749178b9d17455a308cefc523fd85109e

Log:
Merge branch 'PHP-5.5'

* PHP-5.5:
  fix bug #64146 (serialize incorrectly saving objects when they are cloned)

Bugs:
https://bugs.php.net/64146

Changed paths:
  MM  ext/standard/var.c


Diff:



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



[PHP-CVS] com php-src: fix bug #64146 (serialize incorrectly saving objects when they are cloned): ext/standard/tests/serialize/bug64146.phpt ext/standard/var.c

2013-10-04 Thread Michael Wallner
Commit:8973390541faaadfdfc0f838421f037060188e5e
Author:Michael Wallner  Fri, 4 Oct 2013 16:16:15 +0200
Parents:   e8ae795529eff83482797dff0d1a1de7f0a84c8d
Branches:  PHP-5.4 PHP-5.5 master

Link:   
http://git.php.net/?p=php-src.git;a=commitdiff;h=8973390541faaadfdfc0f838421f037060188e5e

Log:
fix bug #64146 (serialize incorrectly saving objects when they are
cloned)

Bugs:
https://bugs.php.net/64146

Changed paths:
  A  ext/standard/tests/serialize/bug64146.phpt
  M  ext/standard/var.c


Diff:
diff --git a/ext/standard/tests/serialize/bug64146.phpt 
b/ext/standard/tests/serialize/bug64146.phpt
new file mode 100644
index 000..18ae78d
--- /dev/null
+++ b/ext/standard/tests/serialize/bug64146.phpt
@@ -0,0 +1,60 @@
+--TEST--
+Bug #64146 (serialize incorrectly saving objects when they are cloned)
+--FILE--
+a[] = new B(1);
+$this->a[] = new B(2);
+}
+}
+
+class B implements Serializable
+{
+public $b;
+
+public function __construct($c)
+{
+$this->b = new C($c);
+}
+
+public function serialize()
+{
+return serialize(clone $this->b);
+}
+
+public function unserialize($data)
+{
+$this->b = unserialize($data);
+}
+}
+
+class C
+{
+public $c;
+
+public function __construct($c)
+{
+$this->c = $c;
+}
+}
+
+$a = unserialize(serialize(new A()));
+
+print $a->a[0]->b->c . "\n";
+print $a->a[1]->b->c . "\n";
+
+?>
+Done
+--EXPECT--
+Test
+1
+2
+Done
diff --git a/ext/standard/var.c b/ext/standard/var.c
index f76a14c..f71c4a4 100644
--- a/ext/standard/var.c
+++ b/ext/standard/var.c
@@ -549,11 +549,9 @@ static inline int php_add_var_hash(HashTable *var_hash, 
zval *var, void *var_old
char id[32], *p;
register int len;
 
-   /* relies on "(long)" being a perfect hash function for data pointers,
-* however the actual identity of an object has had to be determined
-* by its object handle since 5.0. */
if ((Z_TYPE_P(var) == IS_OBJECT) && Z_OBJ_HT_P(var)->get_class_entry) {
-   p = smart_str_print_long(id + sizeof(id) - 1, (long) 
Z_OBJ_HANDLE_P(var));
+   p = smart_str_print_long(id + sizeof(id) - 1,
+   (long) zend_objects_get_address(var TSRMLS_CC));
*(--p) = 'O';
len = id + sizeof(id) - 1 - p;
} else {


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



[PHP-CVS] com php-src: such a weird hack probably helps in finding regressions in the future: ext/standard/tests/serialize/bug65806.phpt

2013-10-04 Thread Michael Wallner
Commit:e8ae795529eff83482797dff0d1a1de7f0a84c8d
Author:Michael Wallner  Fri, 4 Oct 2013 16:11:49 +0200
Parents:   f6ff3a28d60c24dea2a05344d9b7eb823f09b4e5
Branches:  PHP-5.4 PHP-5.5 master

Link:   
http://git.php.net/?p=php-src.git;a=commitdiff;h=e8ae795529eff83482797dff0d1a1de7f0a84c8d

Log:
such a weird hack probably helps in finding regressions in the future

Changed paths:
  A  ext/standard/tests/serialize/bug65806.phpt


Diff:
diff --git a/ext/standard/tests/serialize/bug65806.phpt 
b/ext/standard/tests/serialize/bug65806.phpt
new file mode 100644
index 000..19fab95
--- /dev/null
+++ b/ext/standard/tests/serialize/bug65806.phpt
@@ -0,0 +1,83 @@
+--TEST--
+Bug #65806 (unserialize fails with object which is referenced multiple times)
+--FILE--
+_obj = $obj;
+$this->_serialized = serialize($this->_obj);
+}
+public function get()
+{
+return $this->_obj;
+}
+public function __sleep()
+{
+$this->_serialized = serialize($this->_obj);
+return array(
+"\0" . __CLASS__ . "\0_serialized",
+);
+}
+public function __wakeup()
+{
+   $this->_obj = unserialize($this->_serialized);
+   }
+}
+
+echo "SCRIPT START" . PHP_EOL;
+
+$objA = new myObjA();
+$objB = new myObjB();
+$objC = new myObjC();
+
+$objB->attrA = new ArrayIterator();
+$objB->attrB = $objA;
+
+$objC->attrC = $objB;
+$objC->attrD = $objA;
+
+$list = new myList($objC);
+
+echo 'check ' . check($list->get()) . PHP_EOL;
+
+echo "start serialize/unserialize" . PHP_EOL;
+$newList = unserialize(serialize($list));
+echo "finish serialize/unserialize" . PHP_EOL;
+
+//after unserialize the property myObjC::attrD is null instead of expected 
object
+echo 'check ' . check($newList->get()) . PHP_EOL;
+
+echo "SCRIPT END" . PHP_EOL ;
+
+function check(myObjC $obj) {
+
+if (!is_object($obj->attrC)) {
+return 'failed (myObjC::attrC => ' . var_export($obj->attrC, true) . 
')';
+}
+if (!is_object($obj->attrD)) {
+return 'failed (myObjC::attrD => ' . var_export($obj->attrD, true) . 
')';
+}
+return 'successful';
+}
+?>
+--EXPECT--
+SCRIPT START
+check successful
+start serialize/unserialize
+finish serialize/unserialize
+check successful
+SCRIPT END
+


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



[PHP-CVS] com php-src: Merge branch 'PHP-5.4' into PHP-5.5: ext/xmlreader/php_xmlreader.c

2013-10-04 Thread Michael Wallner
Commit:2e2bda3508444190cb9b707dffe328a263ec60a1
Author:Michael Wallner  Fri, 4 Oct 2013 11:22:43 +0200
Parents:   92fd085ebfb4cc8256cad235a51b34b246a4c3b7 
f6ff3a28d60c24dea2a05344d9b7eb823f09b4e5
Branches:  PHP-5.5 master

Link:   
http://git.php.net/?p=php-src.git;a=commitdiff;h=2e2bda3508444190cb9b707dffe328a263ec60a1

Log:
Merge branch 'PHP-5.4' into PHP-5.5

* PHP-5.4:
  Fixed bug #64230 (XMLReader does not suppress errors)

Bugs:
https://bugs.php.net/64230

Changed paths:
  MM  ext/xmlreader/php_xmlreader.c


Diff:
diff --cc ext/xmlreader/php_xmlreader.c
index 464998c,adf2821..aae55c8
--- a/ext/xmlreader/php_xmlreader.c
+++ b/ext/xmlreader/php_xmlreader.c
@@@ -844,10 -843,9 +843,9 @@@ PHP_METHOD(xmlreader, next
if 
(xmlStrEqual(xmlTextReaderConstLocalName(intern->ptr), (xmlChar *)name)) {
RETURN_TRUE;
}
 -  retval = xmlTextReaderNext(intern->ptr); 
 +  retval = xmlTextReaderNext(intern->ptr);
}
if (retval == -1) {
-   php_error_docref(NULL TSRMLS_CC, E_WARNING, "An Error 
Occurred while reading");
RETURN_FALSE;
} else {
RETURN_BOOL(retval);


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



[PHP-CVS] com php-src: Merge branch 'PHP-5.5': ext/xmlreader/php_xmlreader.c

2013-10-04 Thread Michael Wallner
Commit:e13e5b17ffce68c7ea65d3410a6b4fe433135914
Author:Michael Wallner  Fri, 4 Oct 2013 11:22:52 +0200
Parents:   099b295646b108ad56d1ec3b37dfcb5812fd378c 
2e2bda3508444190cb9b707dffe328a263ec60a1
Branches:  master

Link:   
http://git.php.net/?p=php-src.git;a=commitdiff;h=e13e5b17ffce68c7ea65d3410a6b4fe433135914

Log:
Merge branch 'PHP-5.5'

* PHP-5.5:
  Fixed bug #64230 (XMLReader does not suppress errors)

Bugs:
https://bugs.php.net/64230

Changed paths:
  MM  ext/xmlreader/php_xmlreader.c


Diff:



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



[PHP-CVS] com php-src: Fixed bug #64230 (XMLReader does not suppress errors): NEWS ext/xmlreader/php_xmlreader.c ext/xmlreader/tests/bug64230.phpt

2013-10-04 Thread Michael Wallner
Commit:f6ff3a28d60c24dea2a05344d9b7eb823f09b4e5
Author:Michael Wallner  Fri, 4 Oct 2013 11:22:17 +0200
Parents:   dc3d360a0ff8c17cb2ce2030813d30b578249be9
Branches:  PHP-5.4 PHP-5.5 master

Link:   
http://git.php.net/?p=php-src.git;a=commitdiff;h=f6ff3a28d60c24dea2a05344d9b7eb823f09b4e5

Log:
Fixed bug #64230 (XMLReader does not suppress errors)

Bugs:
https://bugs.php.net/64230

Changed paths:
  M  NEWS
  M  ext/xmlreader/php_xmlreader.c
  A  ext/xmlreader/tests/bug64230.phpt


Diff:
diff --git a/NEWS b/NEWS
index ffde301..9963714 100644
--- a/NEWS
+++ b/NEWS
@@ -8,6 +8,7 @@ PHP 
   NEWS
 
 - XMLReader:
   . Fixed bug #51936 (Crash with clone XMLReader). (Mike)
+  . Fixed bug #64230 (XMLReader does not suppress errors). (Mike)
 
 
 ?? ??? 2013, PHP 5.4.21
diff --git a/ext/xmlreader/php_xmlreader.c b/ext/xmlreader/php_xmlreader.c
index 8b80320..adf2821 100644
--- a/ext/xmlreader/php_xmlreader.c
+++ b/ext/xmlreader/php_xmlreader.c
@@ -805,7 +805,6 @@ PHP_METHOD(xmlreader, read)
if (intern != NULL && intern->ptr != NULL) {
retval = xmlTextReaderRead(intern->ptr);
if (retval == -1) {
-   php_error_docref(NULL TSRMLS_CC, E_WARNING, "An Error 
Occurred while reading");
RETURN_FALSE;
} else {
RETURN_BOOL(retval);
@@ -847,7 +846,6 @@ PHP_METHOD(xmlreader, next)
retval = xmlTextReaderNext(intern->ptr); 
}
if (retval == -1) {
-   php_error_docref(NULL TSRMLS_CC, E_WARNING, "An Error 
Occurred while reading");
RETURN_FALSE;
} else {
RETURN_BOOL(retval);
diff --git a/ext/xmlreader/tests/bug64230.phpt 
b/ext/xmlreader/tests/bug64230.phpt
new file mode 100644
index 000..0b07092
--- /dev/null
+++ b/ext/xmlreader/tests/bug64230.phpt
@@ -0,0 +1,50 @@
+--TEST--
+Bug #64230 (XMLReader does not suppress errors)
+--SKIPIF--
+
+--FILE--
+message);
+   }
+   libxml_clear_errors();
+}
+
+echo "Internal errors TRUE\n";
+libxml_use_internal_errors(true);
+
+$x = new XMLReader;
+$x->xml("");
+$x->read();
+
+show_internal_errors();
+
+echo "Internal errors FALSE\n";
+libxml_use_internal_errors(false);
+
+$x = new XMLReader;
+$x->xml("");
+$x->read();
+
+show_internal_errors();
+
+?>
+Done
+--EXPECTF--
+Test
+Internal errors TRUE
+Internal: Specification mandate value for attribute att
+
+Internal errors FALSE
+
+Warning: XMLReader::read(): %s: parser error : Specification mandate value for 
attribute att in %s on line %d
+
+Warning: XMLReader::read():  in %s on line %d
+
+Warning: XMLReader::read():  ^ in %s on line %d
+Done


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



[PHP-CVS] com php-src: Add support for CryptoPro S-box for GOST: ext/hash/hash.c ext/hash/hash_gost.c ext/hash/php_hash.h ext/hash/php_hash_gost.h ext/hash/php_hash_gost_tables.h ext/hash/tests/gost.p

2013-10-03 Thread Michael Wallner
Commit:8ca43527e8b7e076779560f1472518bd1fe4d6ca
Author:Manuel Mausz  Thu, 5 Sep 2013 01:04:25 +0200
Parents:   6ece5503942a1d8c4a78504161f9466e9e14fed2
Branches:  master

Link:   
http://git.php.net/?p=php-src.git;a=commitdiff;h=8ca43527e8b7e076779560f1472518bd1fe4d6ca

Log:
Add support for CryptoPro S-box for GOST

This adds a new hash identifier "gost-crypto" which uses the CryptoPro
S-box tables as specified by RFC 4357, section 11.2.

Changed paths:
  M  ext/hash/hash.c
  M  ext/hash/hash_gost.c
  M  ext/hash/php_hash.h
  M  ext/hash/php_hash_gost.h
  M  ext/hash/php_hash_gost_tables.h
  M  ext/hash/tests/gost.phpt

diff --git a/ext/hash/hash.c b/ext/hash/hash.c
index 1172214..87f19c5 100644
--- a/ext/hash/hash.c
+++ b/ext/hash/hash.c
@@ -986,6 +986,7 @@ PHP_MINIT_FUNCTION(hash)
php_hash_register_algo("snefru",&php_hash_snefru_ops);
php_hash_register_algo("snefru256", &php_hash_snefru_ops);
php_hash_register_algo("gost",  &php_hash_gost_ops);
+   php_hash_register_algo("gost-crypto",   
&php_hash_gost_crypto_ops);
php_hash_register_algo("adler32",   &php_hash_adler32_ops);
php_hash_register_algo("crc32", &php_hash_crc32_ops);
php_hash_register_algo("crc32b",&php_hash_crc32b_ops);
diff --git a/ext/hash/hash_gost.c b/ext/hash/hash_gost.c
index 3961c4f..7546c8d 100644
--- a/ext/hash/hash_gost.c
+++ b/ext/hash/hash_gost.c
@@ -27,7 +27,7 @@
  * derived from gost_compress() by Markku-Juhani Saarinen 
  */
 
-#define round(k1, k2) \
+#define round(tables, k1, k2) \
t = (k1) + r; \
l ^= tables[0][t & 0xff] ^ tables[1][(t >> 8) & 0xff] ^ \
tables[2][(t >> 16) & 0xff] ^ tables[3][t >> 24]; \
@@ -35,25 +35,25 @@
r ^= tables[0][t & 0xff] ^ tables[1][(t >> 8) & 0xff] ^ \
tables[2][(t >> 16) & 0xff] ^ tables[3][t >> 24];
 
-#define R(key, h, i, t, l, r) \
+#define R(tables, key, h, i, t, l, r) \
r = h[i]; \
l = h[i + 1]; \
-   round(key[0], key[1]) \
-   round(key[2], key[3]) \
-   round(key[4], key[5]) \
-   round(key[6], key[7]) \
-   round(key[0], key[1]) \
-   round(key[2], key[3]) \
-   round(key[4], key[5]) \
-   round(key[6], key[7]) \
-   round(key[0], key[1]) \
-   round(key[2], key[3]) \
-   round(key[4], key[5]) \
-   round(key[6], key[7]) \
-   round(key[7], key[6]) \
-   round(key[5], key[4]) \
-   round(key[3], key[2]) \
-   round(key[1], key[0]) \
+   round(tables, key[0], key[1]) \
+   round(tables, key[2], key[3]) \
+   round(tables, key[4], key[5]) \
+   round(tables, key[6], key[7]) \
+   round(tables, key[0], key[1]) \
+   round(tables, key[2], key[3]) \
+   round(tables, key[4], key[5]) \
+   round(tables, key[6], key[7]) \
+   round(tables, key[0], key[1]) \
+   round(tables, key[2], key[3]) \
+   round(tables, key[4], key[5]) \
+   round(tables, key[6], key[7]) \
+   round(tables, key[7], key[6]) \
+   round(tables, key[5], key[4]) \
+   round(tables, key[3], key[2]) \
+   round(tables, key[1], key[0]) \
t = r; \
r = l; \
l = t; \
@@ -194,10 +194,10 @@
(v[3] >> 16) ^ v[3] ^ (v[4] << 16) ^ v[4] ^ (v[5] >> 16) ^ v[5] 
^ \
(v[6] << 16) ^ (v[6] >> 16) ^ (v[7] << 16) ^ v[7];
 
-#define PASS \
+#define PASS(tables) \
X(w, u, v); \
P(key, w); \
-   R(key, h, i, t, l, r); \
+   R((tables), key, h, i, t, l, r); \
S(s, l, r); \
if (i != 6) { \
A(u, l, r); \
@@ -207,16 +207,16 @@
AA(v, l, r); \
}
 
-static inline void Gost(php_hash_uint32 state[8], php_hash_uint32 data[8])
+static inline void Gost(PHP_GOST_CTX *context, php_hash_uint32 data[8])
 {
int i;
-   php_hash_uint32 l, r, t, key[8], u[8], v[8], w[8], s[8], *h = state, *m 
= data;
+   php_hash_uint32 l, r, t, key[8], u[8], v[8], w[8], s[8], *h = 
context->state, *m = data;

-   memcpy(u, state, sizeof(u));
+   memcpy(u, context->state, sizeof(u));
memcpy(v, data, sizeof(v));

for (i = 0; i < 8; i += 2) {
-   PASS;
+   PASS(*context->tables);
}
SHIFT12(u, m, s);
SHIFT16(h, v, u);
@@ -237,12 +237,19 @@ static inline void GostTransform(PHP_GOST_CTX *context, 
const unsigned char inpu
temp = ((context->state[i + 8] < data[i]) || (context->state[i 
+ 8] < save)) ? 1 : 0; 
}

-   Gost(context->state, data);
+   Gost(context, data);
 }
 
 PHP_HASH_API void PHP_GOSTInit(PHP_GOST_CTX *context)
 {
memset(context, 0, sizeof(*context));
+context->tables = &tables_test;
+}
+
+PHP_HASH_API void PHP_GOSTInitCrypto(PHP_GOST_CTX *context)
+{
+PHP_GOSTInit(context);
+context->tables = &tables_crypto;
 }
 

[PHP-CVS] com php-src: add NEWS and UPGRADING about gost-crypto: NEWS UPGRADING

2013-10-03 Thread Michael Wallner
Commit:099b295646b108ad56d1ec3b37dfcb5812fd378c
Author:Michael Wallner  Thu, 3 Oct 2013 16:23:59 +0200
Parents:   05f847da453fd14440df908d7bfca877142ed8fa
Branches:  master

Link:   
http://git.php.net/?p=php-src.git;a=commitdiff;h=099b295646b108ad56d1ec3b37dfcb5812fd378c

Log:
add NEWS and UPGRADING about gost-crypto

Changed paths:
  M  NEWS
  M  UPGRADING


Diff:
diff --git a/NEWS b/NEWS
index e1a191f..8113514 100644
--- a/NEWS
+++ b/NEWS
@@ -26,6 +26,9 @@ PHP   
 NEWS
 improvements based on this.
 (RFC: https://wiki.php.net/rfc/operator_overloading_gmp). (Nikita)
 
+- Hash:
+  . Added gost-crypto (CryptoPro S-box) GOST hash algo. (Manuel Mausz)
+
 - mysqlnd:
   . Disabled flag for SP OUT variables for 5.5+ servers as they are not 
natively
 supported by the overlying APIs. (Andrey)
diff --git a/UPGRADING b/UPGRADING
index f413887..fb8daab 100755
--- a/UPGRADING
+++ b/UPGRADING
@@ -40,6 +40,8 @@ PHP X.Y UPGRADE NOTES
 - The php://input stream is now re-usable and can be used concurrently with 
   enable_post_data_reading=0.
 
+- Added gost-crypto (CryptoPro S-box) hash algo.
+
 
 2. Changes in SAPI modules
 


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



[PHP-CVS] com php-src: fix failing tests: ext/hash/tests/hash_algos.phpt ext/hash/tests/hash_copy_001.phpt

2013-10-03 Thread Michael Wallner
Commit:7dbb1bba64c8a90df683e1a69df03cb2931f547a
Author:Manuel Mausz  Thu, 5 Sep 2013 09:32:12 +0200
Parents:   0be6ecb8621e32f6bb039dd178f4db17220de6e9
Branches:  master

Link:   
http://git.php.net/?p=php-src.git;a=commitdiff;h=7dbb1bba64c8a90df683e1a69df03cb2931f547a

Log:
fix failing tests

Changed paths:
  M  ext/hash/tests/hash_algos.phpt
  M  ext/hash/tests/hash_copy_001.phpt


Diff:
diff --git a/ext/hash/tests/hash_algos.phpt b/ext/hash/tests/hash_algos.phpt
index 55796ec..7773fe9 100644
--- a/ext/hash/tests/hash_algos.phpt
+++ b/ext/hash/tests/hash_algos.phpt
@@ -18,7 +18,7 @@ var_dump(hash_algos());
 ===Done===
 --EXPECTF--
 *** Testing hash_algos() : basic functionality ***
-array(43) {
+array(44) {
   [%d]=>
   string(3) "md2"
   [%d]=>
@@ -64,6 +64,8 @@ array(43) {
   [%d]=>
   string(4) "gost"
   [%d]=>
+  string(11) "gost-crypto"
+  [%d]=>
   string(7) "adler32"
   [%d]=>
   string(5) "crc32"
@@ -106,4 +108,4 @@ array(43) {
   [%d]=>
   string(10) "haval256,5"
 }
-===Done===
\ No newline at end of file
+===Done===
diff --git a/ext/hash/tests/hash_copy_001.phpt 
b/ext/hash/tests/hash_copy_001.phpt
index 638b7f5..bb4a49d 100644
--- a/ext/hash/tests/hash_copy_001.phpt
+++ b/ext/hash/tests/hash_copy_001.phpt
@@ -97,6 +97,9 @@ string(64) 
"fbe88daa74c89b9e29468fa3cd3a657d31845e21bb58dd3f8d806f5179a85c26"
 string(4) "gost"
 string(64) "5820c7c4a0650587538b30ef4099f2b5993069758d5c847a552e6ef7360766a5"
 string(64) "5820c7c4a0650587538b30ef4099f2b5993069758d5c847a552e6ef7360766a5"
+string(11) "gost-crypto"
+string(64) "f7c4e35548d66aabe2b106f20515d289fde90969225d3d7b83f6dd12d694f043"
+string(64) "f7c4e35548d66aabe2b106f20515d289fde90969225d3d7b83f6dd12d694f043"
 string(7) "adler32"
 string(8) "6f7c0928"
 string(8) "6f7c0928"
@@ -226,6 +229,9 @@ string(64) 
"614ca924864fa0e8fa309aa0944e047d5edbfd4964a35858f4d8ec66a0fb88b0"
 string(4) "gost"
 string(64) "5820c7c4a0650587538b30ef4099f2b5993069758d5c847a552e6ef7360766a5"
 string(64) "a00961e371287c71c527a41c14564f13b6ed12ac7cd9d5f5dfb3542a25e28d3b"
+string(11) "gost-crypto"
+string(64) "f7c4e35548d66aabe2b106f20515d289fde90969225d3d7b83f6dd12d694f043"
+string(64) "68ca9aea6729dc07d995fbe071a4b5c6490bb27fc4dc65ec0e96200d5e082996"
 string(7) "adler32"
 string(8) "6f7c0928"
 string(8) "d9141747"


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



[PHP-CVS] com php-src: fix indention: ext/hash/hash_gost.c

2013-10-03 Thread Michael Wallner
Commit:0be6ecb8621e32f6bb039dd178f4db17220de6e9
Author:Manuel Mausz  Thu, 5 Sep 2013 01:19:00 +0200
Parents:   8ca43527e8b7e076779560f1472518bd1fe4d6ca
Branches:  master

Link:   
http://git.php.net/?p=php-src.git;a=commitdiff;h=0be6ecb8621e32f6bb039dd178f4db17220de6e9

Log:
fix indention

Changed paths:
  M  ext/hash/hash_gost.c


Diff:
diff --git a/ext/hash/hash_gost.c b/ext/hash/hash_gost.c
index 7546c8d..da65bb5 100644
--- a/ext/hash/hash_gost.c
+++ b/ext/hash/hash_gost.c
@@ -243,13 +243,13 @@ static inline void GostTransform(PHP_GOST_CTX *context, 
const unsigned char inpu
 PHP_HASH_API void PHP_GOSTInit(PHP_GOST_CTX *context)
 {
memset(context, 0, sizeof(*context));
-context->tables = &tables_test;
+   context->tables = &tables_test;
 }
 
 PHP_HASH_API void PHP_GOSTInitCrypto(PHP_GOST_CTX *context)
 {
-PHP_GOSTInit(context);
-context->tables = &tables_crypto;
+   PHP_GOSTInit(context);
+   context->tables = &tables_crypto;
 }
 
 static const php_hash_uint32 MAX32 = 0xLU;


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



[PHP-CVS] com php-src: fix bug #55285 XMLReader::getAttribute/No/Ns methods inconsistency: NEWS UPGRADING ext/xmlreader/php_xmlreader.c

2013-10-03 Thread Michael Wallner
Commit:c7b1d76eb9d09b0331272143e44e5024468b0fea
Author:Michael Wallner  Thu, 3 Oct 2013 15:23:05 +0200
Parents:   2a1bd123d6397781082e00ccdfe2ff3ebd0d57fe
Branches:  master

Link:   
http://git.php.net/?p=php-src.git;a=commitdiff;h=c7b1d76eb9d09b0331272143e44e5024468b0fea

Log:
fix bug #55285 XMLReader::getAttribute/No/Ns methods inconsistency

Bugs:
https://bugs.php.net/55285

Changed paths:
  M  NEWS
  M  UPGRADING
  M  ext/xmlreader/php_xmlreader.c


Diff:
diff --git a/NEWS b/NEWS
index 95acaa6..e1a191f 100644
--- a/NEWS
+++ b/NEWS
@@ -55,4 +55,8 @@ PHP   
 NEWS
   . Implemented FR #65634 (HTTP wrapper is very slow with protocol_version
 1.1). (Adam)
 
+- XMLReader:
+  . Fixed bug #55285 (XMLReader::getAttribute/No/Ns methods inconsistency). 
+(Mike)
+
 <<< NOTE: Insert NEWS from last stable release here prior to actual release! 
>>>
diff --git a/UPGRADING b/UPGRADING
index 87b9eef..f413887 100755
--- a/UPGRADING
+++ b/UPGRADING
@@ -61,6 +61,10 @@ PHP X.Y UPGRADE NOTES
   CURLOPT_SAFE_UPLOAD is now turned on by default and uploads with @file 
   do not work unless it is explicitly set to false.
 
+- XMLReader:
+  XMLReader::getAttributeNs and XMLReader::getAttributeNo now return NULL if
+  the attribute could not be found, just like XMLReader::getAttribute.
+
 
 5. New Functions
 
diff --git a/ext/xmlreader/php_xmlreader.c b/ext/xmlreader/php_xmlreader.c
index 464998c..6ef25a2 100644
--- a/ext/xmlreader/php_xmlreader.c
+++ b/ext/xmlreader/php_xmlreader.c
@@ -588,9 +588,6 @@ PHP_METHOD(xmlreader, getAttributeNo)
if (retchar) {
RETVAL_STRING(retchar, 1);
xmlFree(retchar);
-   return;
-   } else {
-   RETURN_EMPTY_STRING();
}
 }
 /* }}} */
@@ -622,9 +619,6 @@ PHP_METHOD(xmlreader, getAttributeNs)
if (retchar) {
RETVAL_STRING(retchar, 1);
xmlFree(retchar);
-   return;
-   } else {
-   RETURN_EMPTY_STRING();
}
 }
 /* }}} */


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



[PHP-CVS] com php-src: typo: really fix bug #51936 Crash with clone xmlreader: NEWS ext/xmlreader/tests/bug51936.phpt ext/xmlreader/tests/bug51963.phpt

2013-10-03 Thread Michael Wallner
Commit:dc3d360a0ff8c17cb2ce2030813d30b578249be9
Author:Michael Wallner  Thu, 3 Oct 2013 13:34:31 +0200
Parents:   fc3f8a8f54d8b3c864125bf32028d4550882839c
Branches:  PHP-5.4 PHP-5.5 master

Link:   
http://git.php.net/?p=php-src.git;a=commitdiff;h=dc3d360a0ff8c17cb2ce2030813d30b578249be9

Log:
typo: really fix bug #51936 Crash with clone xmlreader

Bugs:
https://bugs.php.net/51936

Changed paths:
  M  NEWS
  A  ext/xmlreader/tests/bug51936.phpt
  D  ext/xmlreader/tests/bug51963.phpt


Diff:
diff --git a/NEWS b/NEWS
index c6961bd..ffde301 100644
--- a/NEWS
+++ b/NEWS
@@ -7,7 +7,7 @@ PHP 
   NEWS
 (Mike)
 
 - XMLReader:
-  . Fixed bug #59613 (Crash with clone XMLReader). (Mike)
+  . Fixed bug #51936 (Crash with clone XMLReader). (Mike)
 
 
 ?? ??? 2013, PHP 5.4.21
diff --git a/ext/xmlreader/tests/bug51936.phpt 
b/ext/xmlreader/tests/bug51936.phpt
new file mode 100644
index 000..4b5f101
--- /dev/null
+++ b/ext/xmlreader/tests/bug51936.phpt
@@ -0,0 +1,22 @@
+--TEST--
+Bug #51936 (Crash with clone XMLReader)
+--SKIPIF--
+
+--FILE--
+xml("");
+
+$xmlreader->next();
+$xmlreader2 = clone $xmlreader;
+$xmlreader2->next();
+?>
+Done
+--EXPECTF--
+Test
+
+Fatal error: Trying to clone an uncloneable object of class XMLReader in %s on 
line %d
diff --git a/ext/xmlreader/tests/bug51963.phpt 
b/ext/xmlreader/tests/bug51963.phpt
deleted file mode 100644
index af47f97..000
--- a/ext/xmlreader/tests/bug51963.phpt
+++ /dev/null
@@ -1,22 +0,0 @@
---TEST--
-Bug #59613 (Crash with clone XMLReader)
---SKIPIF--
-
---FILE--
-xml("");
-
-$xmlreader->next();
-$xmlreader2 = clone $xmlreader;
-$xmlreader2->next();
-?>
-Done
---EXPECTF--
-Test
-
-Fatal error: Trying to clone an uncloneable object of class XMLReader in %s on 
line %d


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



[PHP-CVS] com php-src: Merge branch 'PHP-5.4' into PHP-5.5: ext/xmlreader/php_xmlreader.c

2013-10-03 Thread Michael Wallner
Commit:86f2b336294b2ceaac76b9d0f5ed4eaf05e73156
Author:Michael Wallner  Thu, 3 Oct 2013 13:29:18 +0200
Parents:   60d9175280cbab5967966e38f42fced854d10408 
fc3f8a8f54d8b3c864125bf32028d4550882839c
Branches:  PHP-5.5 master

Link:   
http://git.php.net/?p=php-src.git;a=commitdiff;h=86f2b336294b2ceaac76b9d0f5ed4eaf05e73156

Log:
Merge branch 'PHP-5.4' into PHP-5.5

* PHP-5.4:
  fix bug #59613 (Crash with clone XMLReader)

Bugs:
https://bugs.php.net/59613

Changed paths:
  MM  ext/xmlreader/php_xmlreader.c


Diff:



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



[PHP-CVS] com php-src: fix bug #59613 (Crash with clone XMLReader): NEWS ext/xmlreader/php_xmlreader.c ext/xmlreader/tests/bug51963.phpt

2013-10-03 Thread Michael Wallner
Commit:fc3f8a8f54d8b3c864125bf32028d4550882839c
Author:Michael Wallner  Thu, 3 Oct 2013 13:28:41 +0200
Parents:   9209c19f8f7eef807cb457b32d3ab517ff8dc178
Branches:  PHP-5.4 PHP-5.5 master

Link:   
http://git.php.net/?p=php-src.git;a=commitdiff;h=fc3f8a8f54d8b3c864125bf32028d4550882839c

Log:
fix bug #59613 (Crash with clone XMLReader)

Bugs:
https://bugs.php.net/59613

Changed paths:
  M  NEWS
  M  ext/xmlreader/php_xmlreader.c
  A  ext/xmlreader/tests/bug51963.phpt


Diff:
diff --git a/NEWS b/NEWS
index c2086c07..c6961bd 100644
--- a/NEWS
+++ b/NEWS
@@ -6,6 +6,10 @@ PHP
NEWS
   . Fixed bug #65808 (the socket_connect() won't work with IPv6 address).
 (Mike)
 
+- XMLReader:
+  . Fixed bug #59613 (Crash with clone XMLReader). (Mike)
+
+
 ?? ??? 2013, PHP 5.4.21
 
 - Core:
diff --git a/ext/xmlreader/php_xmlreader.c b/ext/xmlreader/php_xmlreader.c
index f4c2643..8b80320 100644
--- a/ext/xmlreader/php_xmlreader.c
+++ b/ext/xmlreader/php_xmlreader.c
@@ -1320,6 +1320,7 @@ PHP_MINIT_FUNCTION(xmlreader)
xmlreader_object_handlers.read_property = xmlreader_read_property;
xmlreader_object_handlers.write_property = xmlreader_write_property;
xmlreader_object_handlers.get_property_ptr_ptr = 
xmlreader_get_property_ptr_ptr;
+   xmlreader_object_handlers.clone_obj = NULL;
 
INIT_CLASS_ENTRY(ce, "XMLReader", xmlreader_functions);
ce.create_object = xmlreader_objects_new;
diff --git a/ext/xmlreader/tests/bug51963.phpt 
b/ext/xmlreader/tests/bug51963.phpt
new file mode 100644
index 000..af47f97
--- /dev/null
+++ b/ext/xmlreader/tests/bug51963.phpt
@@ -0,0 +1,22 @@
+--TEST--
+Bug #59613 (Crash with clone XMLReader)
+--SKIPIF--
+
+--FILE--
+xml("");
+
+$xmlreader->next();
+$xmlreader2 = clone $xmlreader;
+$xmlreader2->next();
+?>
+Done
+--EXPECTF--
+Test
+
+Fatal error: Trying to clone an uncloneable object of class XMLReader in %s on 
line %d


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



Re: [PHP-CVS] com php-src: Merge branch 'PHP-5.4' into PHP-5.5: ext/sockets/multicast.c ext/sockets/multicast.h ext/sockets/sockaddr_conv.c

2013-10-02 Thread Michael Wallner
Gustavo, feel free to improve the aesthetics of my merge.
I was quite surprised by the amount of difference of the source layout :)

On 2 October 2013 15:55, Michael Wallner  wrote:
> Commit:2ba39268151549f03140ec3d260cf9489336ec93
> Author:Michael Wallner  Wed, 2 Oct 2013 15:55:38 
> +0200
> Parents:   60e38b3243577abc80ce6bbcfb0b4125b08acb85 
> 9209c19f8f7eef807cb457b32d3ab517ff8dc178
> Branches:  PHP-5.5 master
>
> Link:   
> http://git.php.net/?p=php-src.git;a=commitdiff;h=2ba39268151549f03140ec3d260cf9489336ec93
>
> Log:
> Merge branch 'PHP-5.4' into PHP-5.5
>
> * PHP-5.4:
>   fix bug #65808the socket_connect() won't work with IPv6 address
>   5.4.22-dev now
>
> Conflicts:
> configure.in
> ext/sockets/sockets.c
> main/php_version.h
>
> Bugs:
> https://bugs.php.net/65808
>
> Changed paths:
>   MM  ext/sockets/multicast.c
>   MM  ext/sockets/multicast.h
>   MA  ext/sockets/sockaddr_conv.c
>
>
> --
> PHP CVS Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php



-- 
Regards,
Mike

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



[PHP-CVS] com php-src: Merge branch 'PHP-5.4' into PHP-5.5: ext/sockets/multicast.c ext/sockets/multicast.h ext/sockets/sockaddr_conv.c

2013-10-02 Thread Michael Wallner
Commit:2ba39268151549f03140ec3d260cf9489336ec93
Author:Michael Wallner  Wed, 2 Oct 2013 15:55:38 +0200
Parents:   60e38b3243577abc80ce6bbcfb0b4125b08acb85 
9209c19f8f7eef807cb457b32d3ab517ff8dc178
Branches:  PHP-5.5 master

Link:   
http://git.php.net/?p=php-src.git;a=commitdiff;h=2ba39268151549f03140ec3d260cf9489336ec93

Log:
Merge branch 'PHP-5.4' into PHP-5.5

* PHP-5.4:
  fix bug #65808the socket_connect() won't work with IPv6 address
  5.4.22-dev now

Conflicts:
configure.in
ext/sockets/sockets.c
main/php_version.h

Bugs:
https://bugs.php.net/65808

Changed paths:
  MM  ext/sockets/multicast.c
  MM  ext/sockets/multicast.h
  MA  ext/sockets/sockaddr_conv.c

diff --cc ext/sockets/multicast.c
index 7466c62,43b6f7d..ecf3a65
--- a/ext/sockets/multicast.c
+++ b/ext/sockets/multicast.c
@@@ -63,309 -73,6 +63,317 @@@ static const char *_php_source_op_to_st
  static int _php_source_op_to_ipv4_op(enum source_op sop);
  #endif
  
++int php_string_to_if_index(const char *val, unsigned *out TSRMLS_DC)
++{
++#if HAVE_IF_NAMETOINDEX
++  unsigned int ind;
++
++  ind = if_nametoindex(val);
++  if (ind == 0) {
++  php_error_docref(NULL TSRMLS_CC, E_WARNING,
++  "no interface with name \"%s\" could be found", val);
++  return FAILURE;
++  } else {
++  *out = ind;
++  return SUCCESS;
++  }
++#else
++  php_error_docref(NULL TSRMLS_CC, E_WARNING,
++  "this platform does not support looking up an interface 
by "
++  "name, an integer interface index must be supplied 
instead");
++  return FAILURE;
++#endif
++}
++
 +static int php_get_if_index_from_zval(zval *val, unsigned *out TSRMLS_DC)
 +{
 +  int ret;
 +
 +  if (Z_TYPE_P(val) == IS_LONG) {
 +  if (Z_LVAL_P(val) < 0 || Z_LVAL_P(val) > UINT_MAX) {
 +  php_error_docref(NULL TSRMLS_CC, E_WARNING,
 +  "the interface index cannot be negative or 
larger than %u;"
 +  " given %ld", UINT_MAX, Z_LVAL_P(val));
 +  ret = FAILURE;
 +  } else {
 +  *out = Z_LVAL_P(val);
 +  ret = SUCCESS;
 +  }
 +  } else {
- #if HAVE_IF_NAMETOINDEX
-   unsigned int ind;
 +  zval_add_ref(&val);
 +  convert_to_string_ex(&val);
-   ind = if_nametoindex(Z_STRVAL_P(val));
-   if (ind == 0) {
-   php_error_docref(NULL TSRMLS_CC, E_WARNING,
-   "no interface with name \"%s\" could be found", 
Z_STRVAL_P(val));
-   ret = FAILURE;
-   } else {
-   *out = ind;
-   ret = SUCCESS;
-   }
++  ret = php_string_to_if_index(Z_STRVAL_P(val), out TSRMLS_CC);
 +  zval_ptr_dtor(&val);
- #else
-   php_error_docref(NULL TSRMLS_CC, E_WARNING,
-   "this platform does not support looking up an 
interface by "
-   "name, an integer interface index must be 
supplied instead");
-   ret = FAILURE;
- #endif
 +  }
 +
 +  return ret;
 +}
 +
++
++
 +static int php_get_if_index_from_array(const HashTable *ht, const char *key,
 +  php_socket *sock, unsigned int *if_index TSRMLS_DC)
 +{
 +  zval **val;
 +
 +  if (zend_hash_find(ht, key, strlen(key) + 1, (void **)&val) == FAILURE) 
{
 +  *if_index = 0; /* default: 0 */
 +  return SUCCESS;
 +  }
 +
 +  return php_get_if_index_from_zval(*val, if_index TSRMLS_CC);
 +}
 +
 +static int php_get_address_from_array(const HashTable *ht, const char *key,
 +  php_socket *sock, php_sockaddr_storage *ss, socklen_t *ss_len TSRMLS_DC)
 +{
 +  zval **val,
 +   *valcp;
 +
 +  if (zend_hash_find(ht, key, strlen(key) + 1, (void **)&val) == FAILURE) 
{
 +  php_error_docref(NULL TSRMLS_CC, E_WARNING, "no key \"%s\" 
passed in optval", key);
 +  return FAILURE;
 +  }
 +  valcp = *val;
 +  zval_add_ref(&valcp);
 +  convert_to_string_ex(val);
 +  if (!php_set_inet46_addr(ss, ss_len, Z_STRVAL_P(valcp), sock 
TSRMLS_CC)) {
 +  zval_ptr_dtor(&valcp);
 +  return FAILURE;
 +  }
 +  zval_ptr_dtor(&valcp);
 +  return SUCCESS;
 +}
 +
 +static int php_do_mcast_opt(php_socket *php_sock, int level, int optname, 
zval **arg4 TSRMLS_DC)
 +{
 +  HashTable   *opt_ht;
 +  unsigned intif_index;
 +  int retval;
 +  int (*mcast_req_fun)(

[PHP-CVS] com php-src: fix bug #65808 the socket_connect() won't work with IPv6 address: NEWS ext/sockets/sockets.c

2013-10-02 Thread Michael Wallner
Commit:9209c19f8f7eef807cb457b32d3ab517ff8dc178
Author:Michael Wallner  Wed, 2 Oct 2013 15:19:25 +0200
Parents:   b2f8f35a889e77c3123ade348907e73bf6d6689e
Branches:  PHP-5.4 PHP-5.5 master

Link:   
http://git.php.net/?p=php-src.git;a=commitdiff;h=9209c19f8f7eef807cb457b32d3ab517ff8dc178

Log:
fix bug #65808  the socket_connect() won't work with IPv6 address

Bugs:
https://bugs.php.net/65808

Changed paths:
  M  NEWS
  M  ext/sockets/sockets.c


Diff:
diff --git a/NEWS b/NEWS
index 9bef174..c2086c07 100644
--- a/NEWS
+++ b/NEWS
@@ -2,6 +2,10 @@ PHP
NEWS
 |||
 ?? ??? 2013, PHP 5.4.22
 
+- Sockets:
+  . Fixed bug #65808 (the socket_connect() won't work with IPv6 address).
+(Mike)
+
 ?? ??? 2013, PHP 5.4.21
 
 - Core:
diff --git a/ext/sockets/sockets.c b/ext/sockets/sockets.c
index d0d0294..d094b3c 100644
--- a/ext/sockets/sockets.c
+++ b/ext/sockets/sockets.c
@@ -607,6 +607,8 @@ static char *php_strerror(int error TSRMLS_DC) /* {{{ */
 /* }}} */
 
 #if HAVE_IPV6
+static int php_get_if_index_from_string(const char *val, unsigned *out 
TSRMLS_DC);
+
 /* Sets addr by hostname, or by ip in string form (AF_INET6) */
 static int php_set_inet6_addr(struct sockaddr_in6 *sin6, char *string, 
php_socket *php_sock TSRMLS_DC) /* {{{ */
 {
@@ -615,6 +617,7 @@ static int php_set_inet6_addr(struct sockaddr_in6 *sin6, 
char *string, php_socke
struct addrinfo hints;
struct addrinfo *addrinfo = NULL;
 #endif
+   char *scope = strchr(string, '%');
 
if (inet_pton(AF_INET6, string, &tmp)) {
memcpy(&(sin6->sin6_addr.s6_addr), &(tmp.s6_addr), 
sizeof(struct in6_addr));
@@ -649,6 +652,22 @@ static int php_set_inet6_addr(struct sockaddr_in6 *sin6, 
char *string, php_socke
 
}
 
+   if (scope++) {
+   long lval = 0;
+   double dval = 0;
+   unsigned scope_id = 0;
+
+   if (IS_LONG == is_numeric_string(scope, strlen(scope), &lval, 
&dval, 0)) {
+   if (lval > 0 && lval <= UINT_MAX) {
+   scope_id = lval;
+   }
+   } else {
+   php_get_if_index_from_string(scope, &scope_id 
TSRMLS_CC);
+   }
+
+   sin6->sin6_scope_id = scope_id;
+   }
+
return 1;
 }
 /* }}} */
@@ -714,6 +733,28 @@ static int php_set_inet46_addr(php_sockaddr_storage *ss, 
socklen_t *ss_len, char
return 0;
 }
 
+static int php_get_if_index_from_string(const char *val, unsigned *out 
TSRMLS_DC)
+{
+#if HAVE_IF_NAMETOINDEX
+   unsigned int ind;
+
+   ind = if_nametoindex(val);
+   if (ind == 0) {
+   php_error_docref(NULL TSRMLS_CC, E_WARNING,
+   "no interface with name \"%s\" could be found", val);
+   return FAILURE;
+   } else {
+   *out = ind;
+   return SUCCESS;
+   }
+#else
+   php_error_docref(NULL TSRMLS_CC, E_WARNING,
+   "this platform does not support looking up an interface 
by "
+   "name, an integer interface index must be supplied 
instead");
+   return FAILURE;
+#endif
+}
+
 static int php_get_if_index_from_zval(zval *val, unsigned *out TSRMLS_DC)
 {
int ret;
@@ -729,26 +770,10 @@ static int php_get_if_index_from_zval(zval *val, unsigned 
*out TSRMLS_DC)
ret = SUCCESS;
}
} else {
-#if HAVE_IF_NAMETOINDEX
-   unsigned int ind;
zval_add_ref(&val);
convert_to_string_ex(&val);
-   ind = if_nametoindex(Z_STRVAL_P(val));
-   if (ind == 0) {
-   php_error_docref(NULL TSRMLS_CC, E_WARNING,
-   "no interface with name \"%s\" could be found", 
Z_STRVAL_P(val));
-   ret = FAILURE;
-   } else {
-   *out = ind;
-   ret = SUCCESS;
-   }
+   ret = php_get_if_index_from_string(Z_STRVAL_P(val), out 
TSRMLS_CC);
zval_ptr_dtor(&val);
-#else
-   php_error_docref(NULL TSRMLS_CC, E_WARNING,
-   "this platform does not support looking up an 
interface by "
-   "name, an integer interface index must be 
supplied instead");
-   ret = FAILURE;
-#endif
}
 
return ret;


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



[PHP-CVS] com php-src: fix bug #62396 'make test' crashes starting with 5.3.14 (missing gzencode()): NEWS run-tests.php

2013-10-01 Thread Michael Wallner
Commit:cd1cab3f4726751a0476ac8701ce09cc37cb36df
Author:Michael Wallner  Tue, 1 Oct 2013 17:01:03 +0200
Parents:   18b04b480ebc41841b2004cc11797eda40fb3958
Branches:  PHP-5.4 PHP-5.5 master

Link:   
http://git.php.net/?p=php-src.git;a=commitdiff;h=cd1cab3f4726751a0476ac8701ce09cc37cb36df

Log:
fix bug #62396 'make test' crashes starting with 5.3.14
(missing gzencode())

Bugs:
https://bugs.php.net/62396

Changed paths:
  M  NEWS
  M  run-tests.php


Diff:
diff --git a/NEWS b/NEWS
index 9bb6032..b889e66 100644
--- a/NEWS
+++ b/NEWS
@@ -30,6 +30,11 @@ PHP  
  NEWS
   . Fixed bug #61548 (content-type must appear at the end of headers for 201 
 Location to work in http). (Mike)
 
+- Build system:
+  . Fixed bug #62396 ('make test' crashes starting with 5.3.14 (missing 
+gzencode())). (Mike)
+
+
 19 Sep 2013, PHP 5.4.20
 
 - Core:
diff --git a/run-tests.php b/run-tests.php
index 935f821..317f607 100755
--- a/run-tests.php
+++ b/run-tests.php
@@ -455,7 +455,7 @@ $pass_options = '';
 $compression = 0;
 $output_file = $CUR_DIR . '/php_test_results_' . date('Ymd_Hi') . '.txt';
 
-if ($compression) {
+if ($compression && in_array("compress.zlib", stream_get_filters())) {
$output_file = 'compress.zlib://' . $output_file . '.gz';
 }
 
@@ -1545,6 +1545,16 @@ TEST $file
}
}
}
+   
+   if (!extension_loaded("zlib")
+   && (array_key_exists("GZIP_POST", $section_text) 
+   ||  array_key_exists("DEFLATE_POST", $section_text))
+   ) {
+   $message = "ext/zlib required";
+   show_result('SKIP', $tested, $tested_file, "reason: $message", 
$temp_filenames);
+   junit_mark_test_as('SKIP', $shortname, $tested, null, 
"");
+   return 'SKIPPED';
+   }
 
if (@count($section_text['REDIRECTTEST']) == 1) {
$test_files = array();


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



[PHP-CVS] com php-src: Merge branch 'PHP-5.4' into PHP-5.5: run-tests.php

2013-10-01 Thread Michael Wallner
Commit:4b61203b013468992dc86dea74379a5688ba19c7
Author:Michael Wallner  Tue, 1 Oct 2013 17:01:44 +0200
Parents:   ad139d9a00d9de206c7aae4f85eff08eff2c429e 
cd1cab3f4726751a0476ac8701ce09cc37cb36df
Branches:  PHP-5.5 master

Link:   
http://git.php.net/?p=php-src.git;a=commitdiff;h=4b61203b013468992dc86dea74379a5688ba19c7

Log:
Merge branch 'PHP-5.4' into PHP-5.5

* PHP-5.4:
  fix bug #62396 'make test' crashes starting with 5.3.14 (missing gzencode())

Bugs:
https://bugs.php.net/62396

Changed paths:
  MM  run-tests.php


Diff:



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



[PHP-CVS] com php-src: Merge branch 'PHP-5.5': ext/standard/http_fopen_wrapper.c

2013-10-01 Thread Michael Wallner
Commit:d29a01de3f35a33c539a805e28a22a6514924a19
Author:Michael Wallner  Tue, 1 Oct 2013 11:11:48 +0200
Parents:   66cd9ef04cf20ead3db58f0bb387bb2070dbc591 
ad139d9a00d9de206c7aae4f85eff08eff2c429e
Branches:  master

Link:   
http://git.php.net/?p=php-src.git;a=commitdiff;h=d29a01de3f35a33c539a805e28a22a6514924a19

Log:
Merge branch 'PHP-5.5'

* PHP-5.5:
  Fixed bug #61548

Conflicts:
ext/standard/http_fopen_wrapper.c

Bugs:
https://bugs.php.net/61548

Changed paths:
  MM  ext/standard/http_fopen_wrapper.c


Diff:
diff --cc ext/standard/http_fopen_wrapper.c
index 8762fa4,4605e74..f5184ce
--- a/ext/standard/http_fopen_wrapper.c
+++ b/ext/standard/http_fopen_wrapper.c
@@@ -85,8 -84,31 +85,33 @@@
  #define HTTP_WRAPPER_HEADER_INIT1
  #define HTTP_WRAPPER_REDIRECTED 2
  
- php_stream *php_stream_url_wrap_http_ex(php_stream_wrapper *wrapper, const 
char *path, const char *mode, int options,
-   
char **opened_path, php_stream_context *context, int redirect_max, int flags 
STREAMS_DC TSRMLS_DC) /* {{{ */
+ static inline void strip_header(char *header_bag, char *lc_header_bag,
+   const char *lc_header_name)
+ {
+   char *lc_header_start = strstr(lc_header_bag, lc_header_name);
+   char *header_start = header_bag + (lc_header_start - lc_header_bag);
+ 
+   if (lc_header_start
+   && (lc_header_start == lc_header_bag || *(lc_header_start-1) == '\n')
+   ) {
+   char *lc_eol = strchr(lc_header_start, '\n');
+   char *eol = header_start + (lc_eol - lc_header_start);
+ 
+   if (lc_eol) {
+   size_t eollen = strlen(lc_eol);
+ 
+   memmove(lc_header_start, lc_eol+1, eollen);
+   memmove(header_start, eol+1, eollen);
+   } else {
+   *lc_header_start = '\0';
+   *header_start = '\0';
+   }
+   }
+ }
+ 
 -php_stream *php_stream_url_wrap_http_ex(php_stream_wrapper *wrapper, char 
*path, char *mode, int options, char **opened_path, php_stream_context 
*context, int redirect_max, int flags STREAMS_DC TSRMLS_DC) /* {{{ */
++php_stream *php_stream_url_wrap_http_ex(php_stream_wrapper *wrapper, 
++  const char *path, const char *mode, int options, char 
**opened_path, 
++  php_stream_context *context, int redirect_max, int flags 
STREAMS_DC TSRMLS_DC) /* {{{ */
  {
php_stream *stream = NULL;
php_url *resource = NULL;


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



[PHP-CVS] com php-src: Fixed bug #61548: NEWS ext/standard/http_fopen_wrapper.c ext/standard/tests/http/bug61548.phpt

2013-10-01 Thread Michael Wallner
Commit:18b04b480ebc41841b2004cc11797eda40fb3958
Author:Michael Wallner  Tue, 1 Oct 2013 11:07:55 +0200
Parents:   679bf479b63356f977c0bb04b5650b86cd4e15a1
Branches:  PHP-5.4 PHP-5.5 master

Link:   
http://git.php.net/?p=php-src.git;a=commitdiff;h=18b04b480ebc41841b2004cc11797eda40fb3958

Log:
Fixed bug #61548

Bugs:
https://bugs.php.net/61548

Changed paths:
  M  NEWS
  M  ext/standard/http_fopen_wrapper.c
  A  ext/standard/tests/http/bug61548.phpt


Diff:
diff --git a/NEWS b/NEWS
index 4dc7ef7..9bb6032 100644
--- a/NEWS
+++ b/NEWS
@@ -26,6 +26,10 @@ PHP  
  NEWS
   . Fixed bug #65721 (configure script broken in 5.5.4 and 5.4.20 when enabling
 imap). (ryotakatsuki at gmail dot com)
 
+- Standard:
+  . Fixed bug #61548 (content-type must appear at the end of headers for 201 
+Location to work in http). (Mike)
+
 19 Sep 2013, PHP 5.4.20
 
 - Core:
diff --git a/ext/standard/http_fopen_wrapper.c 
b/ext/standard/http_fopen_wrapper.c
index b8676bb..4605e74 100644
--- a/ext/standard/http_fopen_wrapper.c
+++ b/ext/standard/http_fopen_wrapper.c
@@ -84,6 +84,30 @@
 #define HTTP_WRAPPER_HEADER_INIT1
 #define HTTP_WRAPPER_REDIRECTED 2
 
+static inline void strip_header(char *header_bag, char *lc_header_bag,
+   const char *lc_header_name)
+{
+   char *lc_header_start = strstr(lc_header_bag, lc_header_name);
+   char *header_start = header_bag + (lc_header_start - lc_header_bag);
+
+   if (lc_header_start
+   && (lc_header_start == lc_header_bag || *(lc_header_start-1) == '\n')
+   ) {
+   char *lc_eol = strchr(lc_header_start, '\n');
+   char *eol = header_start + (lc_eol - lc_header_start);
+
+   if (lc_eol) {
+   size_t eollen = strlen(lc_eol);
+
+   memmove(lc_header_start, lc_eol+1, eollen);
+   memmove(header_start, eol+1, eollen);
+   } else {
+   *lc_header_start = '\0';
+   *header_start = '\0';
+   }
+   }
+}
+
 php_stream *php_stream_url_wrap_http_ex(php_stream_wrapper *wrapper, char 
*path, char *mode, int options, char **opened_path, php_stream_context 
*context, int redirect_max, int flags STREAMS_DC TSRMLS_DC) /* {{{ */
 {
php_stream *stream = NULL;
@@ -425,40 +449,17 @@ finish:
if (tmp && strlen(tmp) > 0) {
char *s;
 
-   if (!header_init) { /* Remove post headers for 
redirects */
-   int l = strlen(tmp);
-   char *s2, *tmp_c = estrdup(tmp);
-   
-   php_strtolower(tmp_c, l);
-   if ((s = strstr(tmp_c, "content-length:"))) {
-   if ((s2 = memchr(s, '\n', tmp_c + l - 
s))) {
-   int b = tmp_c + l - 1 - s2;
-   memmove(tmp, tmp + (s2 + 1 - 
tmp_c), b);
-   memmove(tmp_c, s2 + 1, b);
-   
-   } else {
-   tmp[s - tmp_c] = *s = '\0';
-   }
-   l = strlen(tmp_c);
-   }
-   if ((s = strstr(tmp_c, "content-type:"))) {
-   if ((s2 = memchr(s, '\n', tmp_c + l - 
s))) {
-   memmove(tmp, tmp + (s2 + 1 - 
tmp_c), tmp_c + l - 1 - s2);
-   } else {
-   tmp[s - tmp_c] = '\0';
-   }
-   }
-
-   efree(tmp_c);
-   tmp_c = php_trim(tmp, strlen(tmp), NULL, 0, 
NULL, 3 TSRMLS_CC);
-   efree(tmp);
-   tmp = tmp_c;
-   }
-
user_headers = estrdup(tmp);
 
/* Make lowercase for easy comparison against 
'standard' headers */
php_strtolower(tmp, strlen(tmp));
+
+   if (!header_init) {
+   /* strip POST headers on redirect */
+   strip_header(user_headers, tmp, 
"content-length:");
+   strip_header(user_headers, tmp, 
"content-type:");
+   }
+
if ((s = strstr(tmp, "user-agent:")) && 

[PHP-CVS] com php-src: fix memleak on resetting rebind_proc: ext/ldap/ldap.c

2013-09-30 Thread Michael Wallner
Commit:e9e63f922303d852b6899cadd68d7ec73e8f6134
Author:Michael Wallner  Mon, 30 Sep 2013 11:23:33 
+0200
Parents:   f0c926564c5f7de9462d9ca7bd75014b14a63f56
Branches:  PHP-5.4 PHP-5.5 master

Link:   
http://git.php.net/?p=php-src.git;a=commitdiff;h=e9e63f922303d852b6899cadd68d7ec73e8f6134

Log:
fix memleak on resetting rebind_proc

Changed paths:
  M  ext/ldap/ldap.c


Diff:
diff --git a/ext/ldap/ldap.c b/ext/ldap/ldap.c
index 3cfa209..71d57d6 100644
--- a/ext/ldap/ldap.c
+++ b/ext/ldap/ldap.c
@@ -2107,6 +2107,7 @@ PHP_FUNCTION(ldap_set_rebind_proc)
/* unregister rebind procedure */
if (ld->rebindproc != NULL) {
zval_dtor(ld->rebindproc);
+   FREE_ZVAL(ld->rebindproc);
ld->rebindproc = NULL;
ldap_set_rebind_proc(ld->link, NULL, NULL);
}


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



[PHP-CVS] com php-src: fix test: ext/ldap/tests/ldap_search_variation6.phpt

2013-09-30 Thread Michael Wallner
Commit:2b78edfba25afac8f34ca65e18f98d23a4b8bcce
Author:Michael Wallner  Mon, 30 Sep 2013 11:41:35 
+0200
Parents:   e9e63f922303d852b6899cadd68d7ec73e8f6134
Branches:  PHP-5.4 PHP-5.5 master

Link:   
http://git.php.net/?p=php-src.git;a=commitdiff;h=2b78edfba25afac8f34ca65e18f98d23a4b8bcce

Log:
fix test

Changed paths:
  M  ext/ldap/tests/ldap_search_variation6.phpt


Diff:
diff --git a/ext/ldap/tests/ldap_search_variation6.phpt 
b/ext/ldap/tests/ldap_search_variation6.phpt
index a29e452..5139ebb 100644
--- a/ext/ldap/tests/ldap_search_variation6.phpt
+++ b/ext/ldap/tests/ldap_search_variation6.phpt
@@ -217,14 +217,26 @@ array(2) {
   [1]=>
   resource(%d) of type (ldap result)
 }
-NULL
-NULL
+array(1) {
+  ["count"]=>
+  int(0)
+}
+array(1) {
+  ["count"]=>
+  int(0)
+}
 array(2) {
   [0]=>
   resource(%d) of type (ldap result)
   [1]=>
   resource(%d) of type (ldap result)
 }
-NULL
-NULL
+array(1) {
+  ["count"]=>
+  int(0)
+}
+array(1) {
+  ["count"]=>
+  int(0)
+}
 ===DONE===


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



[PHP-CVS] com php-src: add note about request_body and php://input: main/SAPI.h

2013-09-19 Thread Michael Wallner
Commit:11d60447f9f22944dd08d8dacba1230fc4caabd8
Author:Michael Wallner  Thu, 19 Sep 2013 15:40:10 
+0200
Parents:   b6d0cb05533d1c7a8f0cce5cffc20352669a2506
Branches:  master

Link:   
http://git.php.net/?p=php-src.git;a=commitdiff;h=11d60447f9f22944dd08d8dacba1230fc4caabd8

Log:
add note about request_body and php://input

Changed paths:
  M  main/SAPI.h


Diff:
diff --git a/main/SAPI.h b/main/SAPI.h
index 5525a2a..928fca9 100644
--- a/main/SAPI.h
+++ b/main/SAPI.h
@@ -85,6 +85,7 @@ typedef struct {
char *path_translated;
char *request_uri;
 
+   /* Do not use request_body directly, but the php://input stream wrapper 
instead */
struct _php_stream *request_body;
 
const char *content_type;


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



[PHP-CVS] com php-src: Merge branch 'PHP-5.5': main/fopen_wrappers.c

2013-09-18 Thread Michael Wallner
Commit:33c4b61c7f477994d4f30fff349cb1815680642d
Author:Michael Wallner  Wed, 18 Sep 2013 11:12:44 
+0200
Parents:   cdf5d201ab570284d8865a4b8366bddb662410eb 
a34b141e08f02c34a100676080dddf7d9be84544
Branches:  master

Link:   
http://git.php.net/?p=php-src.git;a=commitdiff;h=33c4b61c7f477994d4f30fff349cb1815680642d

Log:
Merge branch 'PHP-5.5'

* PHP-5.5:
  fix a very rare case of use of uninitialized value combined with a memleak

Changed paths:
  MM  main/fopen_wrappers.c


Diff:



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



[PHP-CVS] com php-src: fix a very rare case of use of uninitialized value combined with a memleak: main/fopen_wrappers.c

2013-09-18 Thread Michael Wallner
Commit:9bfd55cda3bd66b56af84a569fafd8a77cbb3726
Author:Michael Wallner  Wed, 18 Sep 2013 11:10:55 
+0200
Parents:   dfd7d1063a5292b04f6134284337550f4f513749
Branches:  PHP-5.4 PHP-5.5 master

Link:   
http://git.php.net/?p=php-src.git;a=commitdiff;h=9bfd55cda3bd66b56af84a569fafd8a77cbb3726

Log:
fix a very rare case of use of uninitialized value combined with a
memleak

Changed paths:
  M  main/fopen_wrappers.c


Diff:
diff --git a/main/fopen_wrappers.c b/main/fopen_wrappers.c
index 6f11cf3..9b8645a 100644
--- a/main/fopen_wrappers.c
+++ b/main/fopen_wrappers.c
@@ -775,7 +775,12 @@ PHPAPI char *expand_filepath_with_mode(const char 
*filepath, char *real_path, co
 * we cannot cannot getcwd() and the requested,
 * relatively referenced file is accessible */
copy_len = strlen(filepath) > MAXPATHLEN - 1 ? 
MAXPATHLEN - 1 : strlen(filepath);
-   real_path = estrndup(filepath, copy_len);
+   if (real_path) {
+   memcpy(real_path, filepath, copy_len);
+   real_path[copy_len] = '\0';
+   } else {
+   real_path = estrndup(filepath, 
copy_len);
+   }
close(fdtest);
return real_path;
} else {


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



[PHP-CVS] com php-src: fix test concurrency: ext/phar/tests/phar_extract2.phpt

2013-09-18 Thread Michael Wallner
Commit:cdf5d201ab570284d8865a4b8366bddb662410eb
Author:Michael Wallner  Wed, 18 Sep 2013 11:02:45 
+0200
Parents:   e9877fe92e8f9a0cc212362f6c35550b92036b3e
Branches:  master

Link:   
http://git.php.net/?p=php-src.git;a=commitdiff;h=cdf5d201ab570284d8865a4b8366bddb662410eb

Log:
fix test concurrency

Changed paths:
  M  ext/phar/tests/phar_extract2.phpt


Diff:
diff --git a/ext/phar/tests/phar_extract2.phpt 
b/ext/phar/tests/phar_extract2.phpt
index fafe254..7de8cee 100644
--- a/ext/phar/tests/phar_extract2.phpt
+++ b/ext/phar/tests/phar_extract2.phpt
@@ -23,7 +23,7 @@ $phar->extractTo(dirname(__FILE__) . '/extract2', 'mount2');
 $phar->extractTo(dirname(__FILE__) . '/extract2');
 $out = array();
 
-foreach (new RecursiveIteratorIterator(new 
RecursiveDirectoryIterator(dirname(__FILE__) . '/extract', 0x3000), 
RecursiveIteratorIterator::CHILD_FIRST) as $path => $file) {
+foreach (new RecursiveIteratorIterator(new 
RecursiveDirectoryIterator(dirname(__FILE__) . '/extract2', 0x3000), 
RecursiveIteratorIterator::CHILD_FIRST) as $path => $file) {
$extracted[] = $path;
 }
 
@@ -51,10 +51,10 @@ $dir = dirname(__FILE__) . '/extract1/';
 @rmdir($dir);
 ?>
 --EXPECTF--
-%sextract%cfile1.txt
-%sextract%cfile2.txt
-%sextract%cone
-%sextract%csubdir
-%sextract%csubdir%cectory
-%sextract%csubdir%cectory%cfile.txt
+%sextract2%cfile1.txt
+%sextract2%cfile2.txt
+%sextract2%cone
+%sextract2%csubdir
+%sextract2%csubdir%cectory
+%sextract2%csubdir%cectory%cfile.txt
 ===DONE===


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



Re: [PHP-CVS] com php-src: fix build - PRIu64 vs %I64u: main/php_variables.c

2013-09-18 Thread Michael Wallner
Hi Anatol!

On 18 September 2013 10:34, Anatol Belski  wrote:
> That's a good idea, i also thought about macrifying all those at once. Not
> sure it belongs to stdint, it's actually more like printf format. I'll do
> this anyway, have to look for a right place.

POSIX has it in inttypes.h



-- 
Regards,
Mike

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



[PHP-CVS] com php-src: fix test concurrency: ext/phar/tests/031.phpt ext/phar/tests/032.phpt ext/phar/tests/files/phar_oo_test.inc ext/phar/tests/phar_buildfromdirectory1.phpt ext/phar/tests/phar_buil

2013-09-18 Thread Michael Wallner
Commit:14d53417879256044c40b2ef8d0aa32b1f215acb
Author:Michael Wallner  Wed, 18 Sep 2013 10:52:51 
+0200
Parents:   6866b45a48a773f434c04828c9d0a05ae9d9cf3f
Branches:  master

Link:   
http://git.php.net/?p=php-src.git;a=commitdiff;h=14d53417879256044c40b2ef8d0aa32b1f215acb

Log:
fix test concurrency

Changed paths:
  M  ext/phar/tests/031.phpt
  M  ext/phar/tests/032.phpt
  M  ext/phar/tests/files/phar_oo_test.inc
  M  ext/phar/tests/phar_buildfromdirectory1.phpt
  M  ext/phar/tests/phar_buildfromdirectory2-win.phpt
  M  ext/phar/tests/phar_buildfromdirectory2.phpt
  M  ext/phar/tests/phar_buildfromdirectory3.phpt
  M  ext/phar/tests/phar_buildfromdirectory4.phpt
  M  ext/phar/tests/phar_buildfromdirectory5.phpt
  M  ext/phar/tests/phar_buildfromdirectory6.phpt
  M  ext/phar/tests/phar_buildfromiterator1.phpt
  M  ext/phar/tests/phar_buildfromiterator10.phpt
  M  ext/phar/tests/phar_buildfromiterator2.phpt
  M  ext/phar/tests/phar_buildfromiterator3.phpt
  M  ext/phar/tests/phar_buildfromiterator4.phpt
  M  ext/phar/tests/phar_buildfromiterator5.phpt
  M  ext/phar/tests/phar_buildfromiterator6.phpt
  M  ext/phar/tests/phar_buildfromiterator7.phpt
  M  ext/phar/tests/phar_buildfromiterator8.phpt
  M  ext/phar/tests/phar_buildfromiterator9.phpt
  M  ext/phar/tests/phar_extract.phpt
  M  ext/phar/tests/phar_extract2.phpt
  M  ext/phar/tests/phar_extract3.phpt
  M  ext/phar/tests/phar_oo_001.phpt
  M  ext/phar/tests/phar_oo_001U.phpt
  M  ext/phar/tests/phar_oo_002.phpt
  M  ext/phar/tests/phar_oo_002U.phpt
  M  ext/phar/tests/phar_oo_003.phpt
  M  ext/phar/tests/phar_oo_004.phpt
  M  ext/phar/tests/phar_oo_004U.phpt
  M  ext/phar/tests/phar_oo_005.phpt
  M  ext/phar/tests/phar_oo_005U.phpt
  M  ext/phar/tests/phar_oo_005_5.2.phpt
  M  ext/phar/tests/phar_oo_006.phpt
  M  ext/phar/tests/phar_oo_007.phpt
  M  ext/phar/tests/phar_oo_008.phpt
  M  ext/phar/tests/phar_oo_009.phpt
  M  ext/phar/tests/phar_oo_010.phpt
  M  ext/phar/tests/phar_oo_011.phpt
  M  ext/phar/tests/phar_oo_011b.phpt
  M  ext/phar/tests/phar_oo_012.phpt
  M  ext/phar/tests/phar_oo_012_confirm.phpt
  M  ext/phar/tests/phar_oo_012b.phpt

diff --git a/ext/phar/tests/031.phpt b/ext/phar/tests/031.phpt
index 4d59886..d458f06 100644
--- a/ext/phar/tests/031.phpt
+++ b/ext/phar/tests/031.phpt
@@ -22,10 +22,10 @@ require $pname;
 ===DONE===
 --CLEAN--
 
 --EXPECTF--
 string(25) "getMessage();
 ===DONE===
 --CLEAN--
 
 --EXPECTF--
 
-phar "%sphar_oo_test.phar.php" does not have a signature===DONE===
\ No newline at end of file
+phar "%s032.phar.php" does not have a signature===DONE===
\ No newline at end of file
diff --git a/ext/phar/tests/files/phar_oo_test.inc 
b/ext/phar/tests/files/phar_oo_test.inc
index e92b444..4542156 100644
--- a/ext/phar/tests/files/phar_oo_test.inc
+++ b/ext/phar/tests/files/phar_oo_test.inc
@@ -2,7 +2,8 @@
 
 ini_set('date.timezone', 'GMT');
 
-$fname = dirname(__FILE__) . '/phar_oo_test.phar.php';
+$tname = basename(current(get_included_files()), ".php");
+$fname = dirname(__FILE__) . "/$tname.phar.php";
 $pname = 'phar://' . $fname;
 $file = (binary)'';
 
diff --git a/ext/phar/tests/phar_buildfromdirectory1.phpt 
b/ext/phar/tests/phar_buildfromdirectory1.phpt
index 63e06fa..957f246 100644
--- a/ext/phar/tests/phar_buildfromdirectory1.phpt
+++ b/ext/phar/tests/phar_buildfromdirectory1.phpt
@@ -7,7 +7,7 @@ phar.require_hash=0
 phar.readonly=0
 --FILE--
 buildFromDirectory(1);
@@ -19,7 +19,7 @@ try {
 ===DONE===
 --CLEAN--
 
 --EXPECTF--
diff --git a/ext/phar/tests/phar_buildfromdirectory2-win.phpt 
b/ext/phar/tests/phar_buildfromdirectory2-win.phpt
index 9dbcf96..5ed890a 100644
--- a/ext/phar/tests/phar_buildfromdirectory2-win.phpt
+++ b/ext/phar/tests/phar_buildfromdirectory2-win.phpt
@@ -11,7 +11,7 @@ phar.readonly=0
 --FILE--
 buildFromDirectory(1);
 } catch (Exception $e) {
var_dump(get_class($e));
@@ -21,7 +21,7 @@ try {
 ===DONE===
 --CLEAN--
 
 --EXPECTF--
diff --git a/ext/phar/tests/phar_buildfromdirectory2.phpt 
b/ext/phar/tests/phar_buildfromdirectory2.phpt
index 639ff0b..a33e50a 100644
--- a/ext/phar/tests/phar_buildfromdirectory2.phpt
+++ b/ext/phar/tests/phar_buildfromdirectory2.phpt
@@ -11,7 +11,7 @@ phar.readonly=0
 --FILE--
 buildFromDirectory(1);
 } catch (Exception $e) {
var_dump(get_class($e));
@@ -21,7 +21,7 @@ try {
 ===DONE===
 --CLEAN--
 
 --EXPECTF--
diff --git a/ext/phar/tests/phar_buildfromdirectory3.phpt 
b/ext/phar/tests/phar_buildfromdirectory3.phpt
index 2134cbd..921e395 100644
--- a/ext/phar/tests/phar_buildfromdirectory3.phpt
+++ b/ext/phar/tests/phar_buildfromdirectory3.phpt
@@ -9,7 +9,7 @@ phar.readonly=0
 buildFromDirectory('files', new stdClass);
 } catch (Exception $e) {
var_dump(get_class($e));
@@ -19,7 +19,7 @@ try {
 ===DONE===
 --CLEAN--
 
 --EXPECTF--
diff --git a/ext/phar/tests/phar_buildfromdirectory4.phpt 
b/ext/phar/tests/phar_

[PHP-CVS] com php-src: fix test concurrency: ext/standard/tests/dir/chdir_basic.phpt ext/standard/tests/dir/chdir_variation2.phpt ext/standard/tests/file/bug41655_2.phpt ext/standard/tests/file/fopen_

2013-09-18 Thread Michael Wallner
Commit:002763fb7b603b30fab3955c0acd132298926c1b
Author:Michael Wallner  Wed, 18 Sep 2013 10:52:18 
+0200
Parents:   4a85b5e190d6651bee26bbbeff4ed09d2932f352
Branches:  master

Link:   
http://git.php.net/?p=php-src.git;a=commitdiff;h=002763fb7b603b30fab3955c0acd132298926c1b

Log:
fix test concurrency

Changed paths:
  M  ext/standard/tests/dir/chdir_basic.phpt
  M  ext/standard/tests/dir/chdir_variation2.phpt
  M  ext/standard/tests/file/bug41655_2.phpt
  M  ext/standard/tests/file/fopen_include_path.inc
  M  ext/standard/tests/file/fopen_variation16.phpt
  M  ext/standard/tests/file/fopen_variation17.phpt
  M  ext/standard/tests/file/fscanf_variation53.phpt
  M  ext/standard/tests/file/rename_variation1.phpt
  M  ext/standard/tests/file/rename_variation2-win32.phpt
  M  ext/standard/tests/file/rename_variation2.phpt
  M  ext/standard/tests/file/rename_variation3.phpt
  M  ext/standard/tests/file/rename_variation4.phpt
  M  ext/standard/tests/file/rename_variation5.phpt
  M  ext/standard/tests/streams/stream_get_meta_data_socket_basic.phpt
  M  ext/standard/tests/streams/stream_get_meta_data_socket_variation1.phpt
  M  ext/standard/tests/streams/stream_get_meta_data_socket_variation2.phpt
  M  ext/standard/tests/streams/stream_get_meta_data_socket_variation3.phpt
  M  ext/standard/tests/streams/stream_get_meta_data_socket_variation4.phpt

diff --git a/ext/standard/tests/dir/chdir_basic.phpt 
b/ext/standard/tests/dir/chdir_basic.phpt
index 5fc0e5b..81d3c7c 100644
--- a/ext/standard/tests/dir/chdir_basic.phpt
+++ b/ext/standard/tests/dir/chdir_basic.phpt
@@ -14,40 +14,40 @@ Test chdir() function : basic functionality
 echo "*** Testing chdir() : basic functionality ***\n";
 $base_dir_path = dirname(__FILE__);
 
-$level_one_dir_name = "level_one";
-$level_one_dir_path = "$base_dir_path/$level_one_dir_name";
+$level1_one_dir_name = "level1_one";
+$level1_one_dir_path = "$base_dir_path/$level1_one_dir_name";
 
-$level_two_dir_name = "level_two";
-$level_two_dir_path = "$base_dir_path/$level_one_dir_name/$level_two_dir_name";
+$level1_two_dir_name = "level1_two";
+$level1_two_dir_path = 
"$base_dir_path/$level1_one_dir_name/$level1_two_dir_name";
 
 // create directories
-mkdir($level_one_dir_path);
-mkdir($level_two_dir_path);
+mkdir($level1_one_dir_path);
+mkdir($level1_two_dir_path);
 
 echo "\n-- Testing chdir() with absolute path: --\n";
 chdir($base_dir_path);
-var_dump(chdir($level_one_dir_path));
+var_dump(chdir($level1_one_dir_path));
 var_dump(getcwd());
 
 echo "\n-- Testing chdir() with relative paths: --\n";
-var_dump(chdir($level_two_dir_name));
+var_dump(chdir($level1_two_dir_name));
 var_dump(getcwd());
 ?>
 ===DONE===
 --CLEAN--
 
 --EXPECTF--
 *** Testing chdir() : basic functionality ***
 
 -- Testing chdir() with absolute path: --
 bool(true)
-string(%d) "%slevel_one"
+string(%d) "%slevel1_one"
 
 -- Testing chdir() with relative paths: --
 bool(true)
-string(%d) "%slevel_one%elevel_two"
+string(%d) "%slevel1_one%elevel1_two"
 ===DONE===
diff --git a/ext/standard/tests/dir/chdir_variation2.phpt 
b/ext/standard/tests/dir/chdir_variation2.phpt
index fa70f9e..9ca6a97 100644
--- a/ext/standard/tests/dir/chdir_variation2.phpt
+++ b/ext/standard/tests/dir/chdir_variation2.phpt
@@ -15,32 +15,32 @@ echo "*** Testing chdir() : usage variations ***\n";
 
 $base_dir_path = dirname(__FILE__);
 
-$level_one_dir_name = "level_one";
-$level_one_dir_path = "$base_dir_path/$level_one_dir_name";
+$level2_one_dir_name = "level2_one";
+$level2_one_dir_path = "$base_dir_path/$level2_one_dir_name";
 
-$level_two_dir_name = "level_two";
-$level_two_dir_path = "$base_dir_path/$level_one_dir_name/$level_two_dir_name";
+$level2_two_dir_name = "level2_two";
+$level2_two_dir_path = 
"$base_dir_path/$level2_one_dir_name/$level2_two_dir_name";
 
 // create directories
-mkdir($level_one_dir_path);
-mkdir($level_two_dir_path);
+mkdir($level2_one_dir_path);
+mkdir($level2_two_dir_path);
 
-echo "\n-- \$directory = './level_one': --\n";
+echo "\n-- \$directory = './level2_one': --\n";
 var_dump(chdir($base_dir_path));
-var_dump(chdir("./$level_one_dir_name"));
+var_dump(chdir("./$level2_one_dir_name"));
 var_dump(getcwd());
 
-echo "\n-- \$directory = 'level_one/level_two': --\n";
+echo "\n-- \$directory = 'level2_one/level2_two': --\n";
 var_dump(chdir($base_dir_path));
-var_dump(chdir("$level_one_dir_name/$level_two_dir_name"));
+var_dump(chdir("$level2_one_dir_name/$level2_two_dir_name"));
 var_dump(getcwd());
 
 echo "\n-- \$directory = '..': --\n";
 var_dump(chdir('..'));
 var_dump(getcwd());
 
-echo "\n--

[PHP-CVS] com php-src: fix test concurrency: ext/spl/tests/DirectoryIterator_getBasename_basic_test.phpt ext/spl/tests/DirectoryIterator_getBasename_pass_array.phpt ext/spl/tests/RecursiveDirectoryIte

2013-09-18 Thread Michael Wallner
Commit:6866b45a48a773f434c04828c9d0a05ae9d9cf3f
Author:Michael Wallner  Wed, 18 Sep 2013 10:52:35 
+0200
Parents:   002763fb7b603b30fab3955c0acd132298926c1b
Branches:  master

Link:   
http://git.php.net/?p=php-src.git;a=commitdiff;h=6866b45a48a773f434c04828c9d0a05ae9d9cf3f

Log:
fix test concurrency

Changed paths:
  M  ext/spl/tests/DirectoryIterator_getBasename_basic_test.phpt
  M  ext/spl/tests/DirectoryIterator_getBasename_pass_array.phpt
  M  ext/spl/tests/RecursiveDirectoryIterator_getSubPath_basic.phpt
  M  ext/spl/tests/RecursiveDirectoryIterator_getSubPathname_basic.phpt
  M  ext/spl/tests/SplFileObject_fgetcsv_basic.phpt
  M  ext/spl/tests/SplFileObject_fgetcsv_delimiter_basic.phpt
  M  ext/spl/tests/SplFileObject_fgetcsv_delimiter_error.phpt
  M  ext/spl/tests/SplFileObject_fgetcsv_enclosure_basic.phpt
  M  ext/spl/tests/SplFileObject_fgetcsv_enclosure_error.phpt
  M  ext/spl/tests/SplFileObject_fgetcsv_escape_basic.phpt
  M  ext/spl/tests/SplFileObject_fgetcsv_escape_default.phpt
  M  ext/spl/tests/SplFileObject_fgetcsv_escape_error.phpt
  M  ext/spl/tests/SplFileObject_fputcsv_002.phpt
  M  ext/spl/tests/SplFileObject_fputcsv_error.phpt
  M  ext/spl/tests/dit_006.phpt

diff --git a/ext/spl/tests/DirectoryIterator_getBasename_basic_test.phpt 
b/ext/spl/tests/DirectoryIterator_getBasename_basic_test.phpt
index ed1f473..d4f22f6 100644
--- a/ext/spl/tests/DirectoryIterator_getBasename_basic_test.phpt
+++ b/ext/spl/tests/DirectoryIterator_getBasename_basic_test.phpt
@@ -4,7 +4,7 @@ DirectoryIterator::getBasename() - Basic Test
 PHPNW Testfest 2009 - Adrian Hardy
 --FILE--
 
 --CLEAN--
 
diff --git a/ext/spl/tests/DirectoryIterator_getBasename_pass_array.phpt 
b/ext/spl/tests/DirectoryIterator_getBasename_pass_array.phpt
index b2df8a5..ef13520 100644
--- a/ext/spl/tests/DirectoryIterator_getBasename_pass_array.phpt
+++ b/ext/spl/tests/DirectoryIterator_getBasename_pass_array.phpt
@@ -4,7 +4,7 @@ DirectoryIterator::getBasename() - Pass unexpected array
 PHPNW Testfest 2009 - Adrian Hardy
 --FILE--
 
 --CLEAN--
 
diff --git a/ext/spl/tests/RecursiveDirectoryIterator_getSubPath_basic.phpt 
b/ext/spl/tests/RecursiveDirectoryIterator_getSubPath_basic.phpt
index f0b2b01..f6bc266 100644
--- a/ext/spl/tests/RecursiveDirectoryIterator_getSubPath_basic.phpt
+++ b/ext/spl/tests/RecursiveDirectoryIterator_getSubPath_basic.phpt
@@ -5,7 +5,7 @@ Pawel Krynicki 
 #testfest AmsterdamPHP 2012-06-23
 --FILE--
 
 
diff --git a/ext/spl/tests/RecursiveDirectoryIterator_getSubPathname_basic.phpt 
b/ext/spl/tests/RecursiveDirectoryIterator_getSubPathname_basic.phpt
index 7b12672..6527d84 100644
--- a/ext/spl/tests/RecursiveDirectoryIterator_getSubPathname_basic.phpt
+++ b/ext/spl/tests/RecursiveDirectoryIterator_getSubPathname_basic.phpt
@@ -5,7 +5,7 @@ Pawel Krynicki 
 #testfest AmsterdamPHP 2012-06-23
 --FILE--
 
 --EXPECTF--
diff --git a/ext/spl/tests/SplFileObject_fgetcsv_basic.phpt 
b/ext/spl/tests/SplFileObject_fgetcsv_basic.phpt
index abfe5f2..84b5403 100644
--- a/ext/spl/tests/SplFileObject_fgetcsv_basic.phpt
+++ b/ext/spl/tests/SplFileObject_fgetcsv_basic.phpt
@@ -2,7 +2,7 @@
 SplFileObject::fgetcsv default path
 --FILE--
 fgetcsv());
 ?>
 --CLEAN--
 
 --EXPECTF--
 array(4) {
diff --git a/ext/spl/tests/SplFileObject_fgetcsv_delimiter_basic.phpt 
b/ext/spl/tests/SplFileObject_fgetcsv_delimiter_basic.phpt
index 4402d6c..a8125a0 100644
--- a/ext/spl/tests/SplFileObject_fgetcsv_delimiter_basic.phpt
+++ b/ext/spl/tests/SplFileObject_fgetcsv_delimiter_basic.phpt
@@ -2,7 +2,7 @@
 SplFileObject::fgetcsv with alternative delimiter
 --FILE--
 fgetcsv('|'));
 ?>
 --CLEAN--
 
 --EXPECTF--
 array(4) {
diff --git a/ext/spl/tests/SplFileObject_fgetcsv_delimiter_error.phpt 
b/ext/spl/tests/SplFileObject_fgetcsv_delimiter_error.phpt
index 64d6514..169ded7 100644
--- a/ext/spl/tests/SplFileObject_fgetcsv_delimiter_error.phpt
+++ b/ext/spl/tests/SplFileObject_fgetcsv_delimiter_error.phpt
@@ -2,7 +2,7 @@
 SplFileObject::fgetcsv with alternative delimiter
 --FILE--
 fgetcsv('invalid'));
 ?>
 --CLEAN--
 
 --EXPECTF--
 Warning: SplFileObject::fgetcsv(): delimiter must be a character in %s on line 
%d
diff --git a/ext/spl/tests/SplFileObject_fgetcsv_enclosure_basic.phpt 
b/ext/spl/tests/SplFileObject_fgetcsv_enclosure_basic.phpt
index efbb5fb..efe765c 100644
--- a/ext/spl/tests/SplFileObject_fgetcsv_enclosure_basic.phpt
+++ b/ext/spl/tests/SplFileObject_fgetcsv_enclosure_basic.phpt
@@ -2,7 +2,7 @@
 SplFileObject::fgetcsv with alternative delimiter
 --FILE--
 fgetcsv(',', '"'));
 ?>
 --CLEAN--
 
 --EXPECTF--
 array(4) {
diff --git a/ext/spl/tests/SplFileObject_fgetcsv_enclosure_error.phpt 
b/ext/spl/tests/SplFileObject_fgetcsv_enclosure_error.phpt
index 7487b83..f8c14f0 100644
--- a/ext/spl/tests/SplFileObject_fgetcsv_enclosure_error.phpt
+++ b/ext/spl/tests/SplFileObject_fgetcsv_enclosure_error.phpt
@@ -2,7 +2,7 @@
 SplFileObject::fgetcsv with alternative de

[PHP-CVS] com php-src: fix test concurrency: ext/libxml/tests/bug61367-read.phpt ext/libxml/tests/bug61367-write.phpt

2013-09-18 Thread Michael Wallner
Commit:e9877fe92e8f9a0cc212362f6c35550b92036b3e
Author:Michael Wallner  Wed, 18 Sep 2013 10:53:11 
+0200
Parents:   14d53417879256044c40b2ef8d0aa32b1f215acb
Branches:  master

Link:   
http://git.php.net/?p=php-src.git;a=commitdiff;h=e9877fe92e8f9a0cc212362f6c35550b92036b3e

Log:
fix test concurrency

Changed paths:
  M  ext/libxml/tests/bug61367-read.phpt
  M  ext/libxml/tests/bug61367-write.phpt


Diff:
diff --git a/ext/libxml/tests/bug61367-read.phpt 
b/ext/libxml/tests/bug61367-read.phpt
index 75d0006..b4ecaa0 100644
--- a/ext/libxml/tests/bug61367-read.phpt
+++ b/ext/libxml/tests/bug61367-read.phpt
@@ -32,10 +32,10 @@ XML
}
 }
 
-var_dump(mkdir('test_bug_61367'));
-var_dump(mkdir('test_bug_61367/base'));
-var_dump(file_put_contents('test_bug_61367/bad', 'blah'));
-var_dump(chdir('test_bug_61367/base'));
+var_dump(mkdir('test_bug_61367-read'));
+var_dump(mkdir('test_bug_61367-read/base'));
+var_dump(file_put_contents('test_bug_61367-read/bad', 'blah'));
+var_dump(chdir('test_bug_61367-read/base'));
 
 stream_wrapper_register( 'exploit', 'StreamExploiter' );
 $s = fopen( 'exploit://', 'r' );
@@ -43,9 +43,9 @@ $s = fopen( 'exploit://', 'r' );
 ?>
 --CLEAN--
 
 --EXPECTF--
 bool(true)
@@ -53,7 +53,7 @@ bool(true)
 int(4)
 bool(true)
 
-Warning: DOMDocument::loadXML(): I/O warning : failed to load external entity 
"file:///%s/test_bug_61367/bad" in %s on line %d
+Warning: DOMDocument::loadXML(): I/O warning : failed to load external entity 
"file:///%s/test_bug_61367-read/bad" in %s on line %d
 
 Warning: DOMDocument::loadXML(): Failure to process entity file in Entity, 
line: 4 in %s on line %d
 
diff --git a/ext/libxml/tests/bug61367-write.phpt 
b/ext/libxml/tests/bug61367-write.phpt
index e18b071..63e99a8 100644
--- a/ext/libxml/tests/bug61367-write.phpt
+++ b/ext/libxml/tests/bug61367-write.phpt
@@ -19,10 +19,10 @@ class StreamExploiter {
}
 }
 
-var_dump(mkdir('test_bug_61367'));
-var_dump(mkdir('test_bug_61367/base'));
-var_dump(file_put_contents('test_bug_61367/bad', 'blah'));
-var_dump(chdir('test_bug_61367/base'));
+var_dump(mkdir('test_bug_61367-write'));
+var_dump(mkdir('test_bug_61367-write/base'));
+var_dump(file_put_contents('test_bug_61367-write/bad', 'blah'));
+var_dump(chdir('test_bug_61367-write/base'));
 
 stream_wrapper_register( 'exploit', 'StreamExploiter' );
 $s = fopen( 'exploit://', 'r' );
@@ -30,9 +30,9 @@ $s = fopen( 'exploit://', 'r' );
 ?>
 --CLEAN--
 
 --EXPECTF--
 bool(true)


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



Re: [PHP-CVS] com php-src: NEWS/UPGRADING{,.INTERNALS} notes about temp POST stream: NEWS UPGRADING UPGRADING.INTERNALS

2013-09-18 Thread Michael Wallner
On 18 September 2013 07:45, Jacques Marneweck  wrote:

> Hi Michael:
>
> Can you fix the typo of $HTTP_ROW_POST_DATA to $HTTP_RAW_POST_DATA in the 
> UPGRADING
> file.
>

Sure! Thanks for the hint.


Re: [PHP-CVS] com php-src: fix build - PRIu64 vs %I64u: main/php_variables.c

2013-09-18 Thread Michael Wallner
On 17 September 2013 16:02, Anatol Belski  wrote:
> Commit:4a85b5e190d6651bee26bbbeff4ed09d2932f352
> Author:Anatol Belski  Tue, 17 Sep 2013 16:02:08 
> +0200
> Parents:   e6084da4735c945cb071c4d9259ea0d702eb77c6
> Branches:  master
>
> Link:   
> http://git.php.net/?p=php-src.git;a=commitdiff;h=4a85b5e190d6651bee26bbbeff4ed09d2932f352
>
> Log:
> fix build - PRIu64 vs %I64u
>

How about adding such constants to win32/php_stdint.h instead?

-- 
Regards,
Mike

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



Re: [PHP-CVS] com php-src: NEWS/UPGRADING{,.INTERNALS} notes about temp POST stream: NEWS UPGRADING UPGRADING.INTERNALS

2013-09-17 Thread Michael Wallner
HiYasuo!

On Sep 17, 2013 9:39 PM, "Yasuo Ohgaki"  wrote:
>
> Hi Mike,
>
> The code looks great!
> I need to get SG(request_info).post_data and
SG(request_info).raw_post_data in a module at RINIT and runtime.
>
> I asked it internals ML. Could you give me some pointers?

Did you try to open and use a php://input wrapper instead of using
SG(request_info).request_body directly like said in UPGRADING.INTERNALS?

Mike


[PHP-CVS] com php-src: revert stream cast: main/php_streams.h

2013-09-17 Thread Michael Wallner
Commit:e3e4d1b144a818b68e9332e75a35b2870c7253b8
Author:Michael Wallner  Tue, 10 Sep 2013 13:13:09 
+0200
Parents:   d4b673a34c873a7d732507ce5f83385acff8a59c
Branches:  master

Link:   
http://git.php.net/?p=php-src.git;a=commitdiff;h=e3e4d1b144a818b68e9332e75a35b2870c7253b8

Log:
revert stream cast

Changed paths:
  M  main/php_streams.h


Diff:
diff --git a/main/php_streams.h b/main/php_streams.h
index c9732b4..c56014c 100644
--- a/main/php_streams.h
+++ b/main/php_streams.h
@@ -242,7 +242,7 @@ PHPAPI php_stream *_php_stream_alloc(php_stream_ops *ops, 
void *abstract,
 END_EXTERN_C()
 #define php_stream_alloc(ops, thisptr, persistent_id, mode)
_php_stream_alloc((ops), (thisptr), (persistent_id), (mode) STREAMS_CC 
TSRMLS_CC)
 
-#define php_stream_get_resource_id(stream) ((php_stream 
*)(stream))->rsrc_id
+#define php_stream_get_resource_id(stream) (stream)->rsrc_id
 #if ZEND_DEBUG
 /* use this to tell the stream that it is OK if we don't explicitly close it */
 # define php_stream_auto_cleanup(stream)   { (stream)->__exposed++; }


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



[PHP-CVS] com php-src: we need to use the full stream wrapper for filters: ext/standard/php_fopen_wrapper.c

2013-09-17 Thread Michael Wallner
Commit:0f78d8612a7b16f1bbe3fb80a99896d7163c0aa7
Author:Michael Wallner  Tue, 17 Sep 2013 13:44:02 
+0200
Parents:   41d78110ffd576a9afa352426ed2c15ab7308bec
Branches:  master

Link:   
http://git.php.net/?p=php-src.git;a=commitdiff;h=0f78d8612a7b16f1bbe3fb80a99896d7163c0aa7

Log:
we need to use the full stream wrapper for filters

Changed paths:
  M  ext/standard/php_fopen_wrapper.c


Diff:
diff --git a/ext/standard/php_fopen_wrapper.c b/ext/standard/php_fopen_wrapper.c
index ca0b92e..f624cf4 100644
--- a/ext/standard/php_fopen_wrapper.c
+++ b/ext/standard/php_fopen_wrapper.c
@@ -73,8 +73,8 @@ static size_t php_stream_input_read(php_stream *stream, char 
*buf, size_t count
 {
php_stream *inner = stream->abstract;
 
-   if (inner && inner->ops->read) {
-   size_t read = inner->ops->read(inner, buf, count TSRMLS_CC);
+   if (inner) {
+   size_t read = php_stream_read(inner, buf, count);
stream->eof = inner->eof;
return read;
}
@@ -99,8 +99,10 @@ static int php_stream_input_seek(php_stream *stream, off_t 
offset, int whence, o
 {
php_stream *inner = stream->abstract;
 
-   if (inner && inner->ops->seek) {
-   return inner->ops->seek(inner, offset, whence, newoffset 
TSRMLS_CC);
+   if (inner) {
+   int sought = php_stream_seek(inner, offset, whence);
+   *newoffset = inner->position;
+   return sought;
}
 
return -1;


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



[PHP-CVS] com php-src: fix ZTS build: ext/soap/soap.c

2013-09-17 Thread Michael Wallner
Commit:d4b673a34c873a7d732507ce5f83385acff8a59c
Author:Michael Wallner  Tue, 27 Aug 2013 14:01:59 
+0200
Parents:   bb1f9d3826c968ce0c099598ded6f646b3da6429
Branches:  master

Link:   
http://git.php.net/?p=php-src.git;a=commitdiff;h=d4b673a34c873a7d732507ce5f83385acff8a59c

Log:
fix ZTS build

Changed paths:
  M  ext/soap/soap.c


Diff:
diff --git a/ext/soap/soap.c b/ext/soap/soap.c
index d10c17e..c5900dc 100644
--- a/ext/soap/soap.c
+++ b/ext/soap/soap.c
@@ -1580,7 +1580,7 @@ PHP_METHOD(SoapServer, handle)
array_init_size(&filter_params, 1);
add_assoc_long_ex(&filter_params, 
ZEND_STRS("window"), 0x2f); /* ANY WBITS */
 
-   zf = 
php_stream_filter_create("zlib.inflate", &filter_params, 0);
+   zf = 
php_stream_filter_create("zlib.inflate", &filter_params, 0 TSRMLS_CC);
zval_dtor(&filter_params);
 
if (zf) {
@@ -1595,10 +1595,10 @@ PHP_METHOD(SoapServer, handle)
}
}
 
-   doc_request = soap_xmlParseFile("php://input");
+   doc_request = soap_xmlParseFile("php://input" 
TSRMLS_CC);
 
if (zf) {
-   php_stream_filter_remove(zf, 1);
+   php_stream_filter_remove(zf, 1 TSRMLS_CC);
}
} else {
zval_ptr_dtor(&retval);


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



[PHP-CVS] com php-src: make reading php://input JIT if enable_post_data_reading=0: ext/standard/php_fopen_wrapper.c main/SAPI.c main/SAPI.h

2013-09-17 Thread Michael Wallner
Commit:449d4c0b1c6ea0f5dfe7b56c99d9fc4f2033d27c
Author:Michael Wallner  Tue, 10 Sep 2013 13:13:33 
+0200
Parents:   e3e4d1b144a818b68e9332e75a35b2870c7253b8
Branches:  master

Link:   
http://git.php.net/?p=php-src.git;a=commitdiff;h=449d4c0b1c6ea0f5dfe7b56c99d9fc4f2033d27c

Log:
make reading php://input JIT if enable_post_data_reading=0

Changed paths:
  M  ext/standard/php_fopen_wrapper.c
  M  main/SAPI.c
  M  main/SAPI.h

diff --git a/ext/standard/php_fopen_wrapper.c b/ext/standard/php_fopen_wrapper.c
index ca0b92e..aa7924d 100644
--- a/ext/standard/php_fopen_wrapper.c
+++ b/ext/standard/php_fopen_wrapper.c
@@ -63,6 +63,12 @@ php_stream_ops php_stream_output_ops = {
NULL  /* set_option */
 };
 
+typedef struct php_stream_input { /* {{{ */
+   php_stream **body_ptr;
+   off_t position;
+} php_stream_input_t;
+/* }}} */
+
 static size_t php_stream_input_write(php_stream *stream, const char *buf, 
size_t count TSRMLS_DC) /* {{{ */
 {
return -1;
@@ -71,20 +77,52 @@ static size_t php_stream_input_write(php_stream *stream, 
const char *buf, size_t
 
 static size_t php_stream_input_read(php_stream *stream, char *buf, size_t 
count TSRMLS_DC) /* {{{ */
 {
-   php_stream *inner = stream->abstract;
+   php_stream_input_t *input = stream->abstract;
+   size_t read;
+   //fprintf(stderr, "Attempt to read %lu bytes (%lu)\n", count, 
SG(read_post_bytes));
+
+   if (!SG(post_read) && SG(read_post_bytes) < input->position + count) {
+   /* read requested data from SAPI */
+   int read_bytes = sapi_read_post_block(buf, count TSRMLS_CC);
+
+   //fprintf(stderr, "Did read %d bytes\n", read_bytes);
+   if (read_bytes > 0) {
+   php_stream_seek(*input->body_ptr, 0, SEEK_END);
+   php_stream_write(*input->body_ptr, buf, read_bytes);
+   }
+   }
+
+   php_stream_seek(*input->body_ptr, input->position, SEEK_SET);
+   read = (*input->body_ptr)->ops->read(*input->body_ptr, buf, count 
TSRMLS_CC);
+
+   if (!read || read == (size_t) -1) {
+   stream->eof = 1;
+   } else {
+   input->position += read;
+   }
+
+   return read;
+}
+/* }}} */
+
+static size_t php_stream_input_read_x(php_stream *stream, char *buf, size_t 
count TSRMLS_DC) /* {{{ */
+{
+   php_stream_input_t *input = stream->abstract;
+   php_stream *inner = *input->body_ptr;
 
if (inner && inner->ops->read) {
size_t read = inner->ops->read(inner, buf, count TSRMLS_CC);
stream->eof = inner->eof;
return read;
}
-
return -1;
 }
 /* }}} */
 
 static int php_stream_input_close(php_stream *stream, int close_handle 
TSRMLS_DC) /* {{{ */
 {
+   efree(stream->abstract);
+
return 0;
 }
 /* }}} */
@@ -193,18 +231,23 @@ php_stream * php_stream_url_wrap_php(php_stream_wrapper 
*wrapper, const char *pa
}
 
if (!strcasecmp(path, "input")) {
+   php_stream_input_t *input;
+
if ((options & STREAM_OPEN_FOR_INCLUDE) && 
!PG(allow_url_include) ) {
if (options & REPORT_ERRORS) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, 
"URL file-access is disabled in the server configuration");
}
return NULL;
}
-   if (SG(request_info).request_body) {
-   php_stream_rewind(SG(request_info).request_body);
+
+   input = ecalloc(1, sizeof(*input));
+   if (*(input->body_ptr = &SG(request_info).request_body)) {
+   php_stream_rewind(*input->body_ptr);
} else {
-   sapi_read_standard_form_data(TSRMLS_C);
+   *input->body_ptr = 
php_stream_temp_create(TEMP_STREAM_DEFAULT, SAPI_POST_BLOCK_SIZE);
}
-   return php_stream_alloc(&php_stream_input_ops, 
SG(request_info).request_body, 0, "rb");
+
+   return php_stream_alloc(&php_stream_input_ops, input, 0, "rb");
}
 
if (!strcasecmp(path, "stdin")) {
diff --git a/main/SAPI.c b/main/SAPI.c
index ccfb1e5..9c8bcb1 100644
--- a/main/SAPI.c
+++ b/main/SAPI.c
@@ -180,10 +180,6 @@ SAPI_API void sapi_handle_post(void *arg TSRMLS_DC)
 {
if (SG(request_info).post_entry && SG(request_info).content_type_dup) {

SG(request_info).post_entry->post_handler(SG(request_info).content_type_dup, 
arg TSRMLS_CC);
-   /*if (SG(request_info).request_body) {
-   php_stream_close(SG(request_info).request_body);
-   SG(request_info).request_body = NULL;
- 

[PHP-CVS] com php-src: remove unused code: ext/standard/php_fopen_wrapper.c

2013-09-17 Thread Michael Wallner
Commit:71bee63fad5418642c87c588cc9e22ca44186ce6
Author:Michael Wallner  Tue, 10 Sep 2013 13:16:24 
+0200
Parents:   832e2d0d8c8bb11644fe34ec1685fc68d9b3a475
Branches:  master

Link:   
http://git.php.net/?p=php-src.git;a=commitdiff;h=71bee63fad5418642c87c588cc9e22ca44186ce6

Log:
remove unused code

Changed paths:
  M  ext/standard/php_fopen_wrapper.c


Diff:
diff --git a/ext/standard/php_fopen_wrapper.c b/ext/standard/php_fopen_wrapper.c
index aa7924d..27acb28 100644
--- a/ext/standard/php_fopen_wrapper.c
+++ b/ext/standard/php_fopen_wrapper.c
@@ -79,13 +79,11 @@ static size_t php_stream_input_read(php_stream *stream, 
char *buf, size_t count
 {
php_stream_input_t *input = stream->abstract;
size_t read;
-   //fprintf(stderr, "Attempt to read %lu bytes (%lu)\n", count, 
SG(read_post_bytes));
 
if (!SG(post_read) && SG(read_post_bytes) < input->position + count) {
/* read requested data from SAPI */
int read_bytes = sapi_read_post_block(buf, count TSRMLS_CC);
 
-   //fprintf(stderr, "Did read %d bytes\n", read_bytes);
if (read_bytes > 0) {
php_stream_seek(*input->body_ptr, 0, SEEK_END);
php_stream_write(*input->body_ptr, buf, read_bytes);
@@ -105,20 +103,6 @@ static size_t php_stream_input_read(php_stream *stream, 
char *buf, size_t count
 }
 /* }}} */
 
-static size_t php_stream_input_read_x(php_stream *stream, char *buf, size_t 
count TSRMLS_DC) /* {{{ */
-{
-   php_stream_input_t *input = stream->abstract;
-   php_stream *inner = *input->body_ptr;
-
-   if (inner && inner->ops->read) {
-   size_t read = inner->ops->read(inner, buf, count TSRMLS_CC);
-   stream->eof = inner->eof;
-   return read;
-   }
-   return -1;
-}
-/* }}} */
-
 static int php_stream_input_close(php_stream *stream, int close_handle 
TSRMLS_DC) /* {{{ */
 {
efree(stream->abstract);


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



[PHP-CVS] com php-src: slim post data: ext/mbstring/mb_gpc.c ext/soap/soap.c ext/standard/php_fopen_wrapper.c main/SAPI.c main/SAPI.h main/main.c main/php_content_types.c main/php_globals.h main/php_s

2013-09-17 Thread Michael Wallner
Commit:bb1f9d3826c968ce0c099598ded6f646b3da6429
Author:Michael Wallner  Wed, 14 Aug 2013 14:42:36 
+0200
Parents:   a13c00cd14179971efd60e8acb450a615c2aff22
Branches:  master

Link:   
http://git.php.net/?p=php-src.git;a=commitdiff;h=bb1f9d3826c968ce0c099598ded6f646b3da6429

Log:
slim post data

Changed paths:
  M  ext/mbstring/mb_gpc.c
  M  ext/soap/soap.c
  M  ext/standard/php_fopen_wrapper.c
  M  main/SAPI.c
  M  main/SAPI.h
  M  main/main.c
  M  main/php_content_types.c
  M  main/php_globals.h
  M  main/php_streams.h
  M  main/php_variables.c
  M  sapi/cli/php_cli_server.c
  D  tests/basic/024.phpt
  D  tests/basic/026.phpt

diff --git a/ext/mbstring/mb_gpc.c b/ext/mbstring/mb_gpc.c
index 5ecc8f3..30764dc 100644
--- a/ext/mbstring/mb_gpc.c
+++ b/ext/mbstring/mb_gpc.c
@@ -364,6 +364,7 @@ SAPI_POST_HANDLER_FUNC(php_mb_post_handler)
 {
const mbfl_encoding *detected;
php_mb_encoding_handler_info_t info;
+   char *post_data_str = NULL;
 
MBSTRG(http_input_identify_post) = NULL;
 
@@ -376,7 +377,10 @@ SAPI_POST_HANDLER_FUNC(php_mb_post_handler)
info.num_from_encodings = MBSTRG(http_input_list_size); 
info.from_language  = MBSTRG(language);
 
-   detected = _php_mb_encoding_handler_ex(&info, arg, 
SG(request_info).post_data TSRMLS_CC);
+   php_stream_rewind(SG(request_info).request_body);
+   php_stream_copy_to_mem(SG(request_info).request_body, &post_data_str, 
PHP_STREAM_COPY_ALL, 0);
+   detected = _php_mb_encoding_handler_ex(&info, arg, post_data_str 
TSRMLS_CC);
+   STR_FREE(post_data_str);
 
MBSTRG(http_input_identify) = detected;
if (detected) {
diff --git a/ext/soap/soap.c b/ext/soap/soap.c
index 00e80ef..d10c17e 100644
--- a/ext/soap/soap.c
+++ b/ext/soap/soap.c
@@ -1560,48 +1560,45 @@ PHP_METHOD(SoapServer, handle)
}
 
if (ZEND_NUM_ARGS() == 0) {
-   if (SG(request_info).raw_post_data) {
-   char *post_data = SG(request_info).raw_post_data;
-   int post_data_length = 
SG(request_info).raw_post_data_length;
+   if (SG(request_info).request_body && 0 == 
php_stream_rewind(SG(request_info).request_body)) {
zval **server_vars, **encoding;
+   php_stream_filter *zf = NULL;
 
zend_is_auto_global("_SERVER", sizeof("_SERVER")-1 
TSRMLS_CC);
if (zend_hash_find(&EG(symbol_table), "_SERVER", 
sizeof("_SERVER"), (void **) &server_vars) == SUCCESS &&
Z_TYPE_PP(server_vars) == IS_ARRAY &&
zend_hash_find(Z_ARRVAL_PP(server_vars), 
"HTTP_CONTENT_ENCODING", sizeof("HTTP_CONTENT_ENCODING"), (void **) 
&encoding)==SUCCESS &&
Z_TYPE_PP(encoding) == IS_STRING) {
-   zval func;
-   zval retval;
-   zval param;
-   zval *params[1];
-
-   if ((strcmp(Z_STRVAL_PP(encoding),"gzip") == 0 
||
-strcmp(Z_STRVAL_PP(encoding),"x-gzip") == 
0) &&
-   zend_hash_exists(EG(function_table), 
"gzinflate", sizeof("gzinflate"))) {
-   ZVAL_STRING(&func, "gzinflate", 0);
-   params[0] = ¶m;
-   ZVAL_STRINGL(params[0], post_data+10, 
post_data_length-10, 0);
-   INIT_PZVAL(params[0]);
-   } else if 
(strcmp(Z_STRVAL_PP(encoding),"deflate") == 0 &&
-  zend_hash_exists(EG(function_table), "gzuncompress", 
sizeof("gzuncompress"))) {
-   ZVAL_STRING(&func, "gzuncompress", 0);
-   params[0] = ¶m;
-   ZVAL_STRINGL(params[0], post_data, 
post_data_length, 0);
-   INIT_PZVAL(params[0]);
+
+   if (strcmp(Z_STRVAL_PP(encoding),"gzip") == 0
+   ||  strcmp(Z_STRVAL_PP(encoding),"x-gzip") == 0
+   ||  strcmp(Z_STRVAL_PP(encoding),"deflate") == 0
+   ) {
+   zval filter_params;
+
+   INIT_PZVAL(&filter_params);
+   array_init_size(&filter_params, 1);
+   add_assoc_long_ex(&filter_param

[PHP-CVS] com php-src: Merge branch 'slim-postdata-merge': ext/soap/soap.c ext/standard/php_fopen_wrapper.c main/SAPI.c

2013-09-17 Thread Michael Wallner
Commit:423c70fb4d79b7831b1db41ea217c8e1afd5cf8e
Author:Michael Wallner  Tue, 17 Sep 2013 13:52:25 
+0200
Parents:   0f78d8612a7b16f1bbe3fb80a99896d7163c0aa7 
71bee63fad5418642c87c588cc9e22ca44186ce6
Branches:  master

Link:   
http://git.php.net/?p=php-src.git;a=commitdiff;h=423c70fb4d79b7831b1db41ea217c8e1afd5cf8e

Log:
Merge branch 'slim-postdata-merge'

* slim-postdata-merge:
  remove unused code
  tests
  make reading php://input JIT if enable_post_data_reading=0
  revert stream cast
  fix ZTS build
  slim post data

Conflicts:
ext/soap/soap.c
ext/standard/php_fopen_wrapper.c
main/SAPI.c

Changed paths:
  MM  ext/soap/soap.c
  MM  ext/standard/php_fopen_wrapper.c
  MM  main/SAPI.c


Diff:
diff --cc ext/soap/soap.c
index d10c17e,c5900dc..980c924
--- a/ext/soap/soap.c
+++ b/ext/soap/soap.c
@@@ -1595,11 -1595,11 +1595,10 @@@ PHP_METHOD(SoapServer, handle
}
}
  
-   doc_request = soap_xmlParseFile("php://input");
+   doc_request = soap_xmlParseFile("php://input" 
TSRMLS_CC);
  
if (zf) {
-   php_stream_filter_remove(zf, 1);
-   }
+   php_stream_filter_remove(zf, 1 TSRMLS_CC);
 -  }
} else {
zval_ptr_dtor(&retval);
return;
diff --cc main/SAPI.c
index ccfb1e5,9c8bcb1..8ee7649
--- a/main/SAPI.c
+++ b/main/SAPI.c
@@@ -259,6 -274,7 +274,8 @@@ SAPI_API SAPI_POST_READER_FUNC(sapi_rea
SG(request_info).content_length, 
SG(post_max_size));
return;
}
+ 
++
SG(request_info).request_body = 
php_stream_temp_create(TEMP_STREAM_DEFAULT, SAPI_POST_BLOCK_SIZE);
  
if (sapi_module.read_post) {


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



[PHP-CVS] com php-src: final bits: ext/soap/soap.c ext/standard/php_fopen_wrapper.c

2013-09-17 Thread Michael Wallner
Commit:e6084da4735c945cb071c4d9259ea0d702eb77c6
Author:Michael Wallner  Tue, 17 Sep 2013 13:59:49 
+0200
Parents:   423c70fb4d79b7831b1db41ea217c8e1afd5cf8e
Branches:  master

Link:   
http://git.php.net/?p=php-src.git;a=commitdiff;h=e6084da4735c945cb071c4d9259ea0d702eb77c6

Log:
final bits

Changed paths:
  M  ext/soap/soap.c
  M  ext/standard/php_fopen_wrapper.c


Diff:
diff --git a/ext/soap/soap.c b/ext/soap/soap.c
index 980c924..c5900dc 100644
--- a/ext/soap/soap.c
+++ b/ext/soap/soap.c
@@ -1599,6 +1599,7 @@ PHP_METHOD(SoapServer, handle)
 
if (zf) {
php_stream_filter_remove(zf, 1 TSRMLS_CC);
+   }
} else {
zval_ptr_dtor(&retval);
return;
diff --git a/ext/standard/php_fopen_wrapper.c b/ext/standard/php_fopen_wrapper.c
index 064eee2..76f77eb 100644
--- a/ext/standard/php_fopen_wrapper.c
+++ b/ext/standard/php_fopen_wrapper.c
@@ -91,7 +91,7 @@ static size_t php_stream_input_read(php_stream *stream, char 
*buf, size_t count
}
 
php_stream_seek(*input->body_ptr, input->position, SEEK_SET);
-   read = (*input->body_ptr)->ops->read(*input->body_ptr, buf, count 
TSRMLS_CC);
+   read = php_stream_read(*input->body_ptr, buf, count);
 
if (!read || read == (size_t) -1) {
stream->eof = 1;
@@ -105,6 +105,9 @@ static size_t php_stream_input_read(php_stream *stream, 
char *buf, size_t count
 
 static int php_stream_input_close(php_stream *stream, int close_handle 
TSRMLS_DC) /* {{{ */
 {
+   efree(stream->abstract);
+   stream->abstract = NULL;
+
return 0;
 }
 /* }}} */


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



[PHP-CVS] com php-src: tests: tests/basic/enable_post_data_reading_01.phpt tests/basic/enable_post_data_reading_02.phpt tests/basic/enable_post_data_reading_03.phpt tests/basic/enable_post_data_readin

2013-09-17 Thread Michael Wallner
Commit:832e2d0d8c8bb11644fe34ec1685fc68d9b3a475
Author:Michael Wallner  Tue, 10 Sep 2013 13:14:02 
+0200
Parents:   449d4c0b1c6ea0f5dfe7b56c99d9fc4f2033d27c
Branches:  master

Link:   
http://git.php.net/?p=php-src.git;a=commitdiff;h=832e2d0d8c8bb11644fe34ec1685fc68d9b3a475

Log:
tests

Changed paths:
  M  tests/basic/enable_post_data_reading_01.phpt
  M  tests/basic/enable_post_data_reading_02.phpt
  M  tests/basic/enable_post_data_reading_03.phpt
  M  tests/basic/enable_post_data_reading_04.phpt
  A  tests/basic/enable_post_data_reading_05.phpt
  A  tests/basic/enable_post_data_reading_06.phpt

diff --git a/tests/basic/enable_post_data_reading_01.phpt 
b/tests/basic/enable_post_data_reading_01.phpt
index 1a0e33f..19ee5d5 100644
--- a/tests/basic/enable_post_data_reading_01.phpt
+++ b/tests/basic/enable_post_data_reading_01.phpt
@@ -11,6 +11,7 @@ var_dump($_FILES);
 var_dump($_POST);
 var_dump($HTTP_RAW_POST_DATA);
 var_dump(file_get_contents("php://input"));
+var_dump(file_get_contents("php://input"));
 --EXPECTF--
 array(0) {
 }
@@ -20,3 +21,4 @@ array(0) {
 Notice: Undefined variable: HTTP_RAW_POST_DATA in %s on line %d
 NULL
 string(9) "a=1&b=ZYX"
+string(9) "a=1&b=ZYX"
diff --git a/tests/basic/enable_post_data_reading_02.phpt 
b/tests/basic/enable_post_data_reading_02.phpt
index dc7f6b1..4e1643e 100644
--- a/tests/basic/enable_post_data_reading_02.phpt
+++ b/tests/basic/enable_post_data_reading_02.phpt
@@ -15,6 +15,7 @@ Content-Type: text/plain-file
 var_dump($_FILES);
 var_dump($_POST);
 var_dump(file_get_contents("php://input"));
+var_dump(file_get_contents("php://input"));
 --EXPECTF--
 array(0) {
 }
@@ -26,3 +27,9 @@ Content-Type: text/plain-file
 
 1
 -20896060251896012921717172737--"
+string(%d) "-20896060251896012921717172737
+Content-Disposition: form-data; name="file1"; filename="file1.txt"
+Content-Type: text/plain-file
+
+1
+-20896060251896012921717172737--"
diff --git a/tests/basic/enable_post_data_reading_03.phpt 
b/tests/basic/enable_post_data_reading_03.phpt
index cdabe91..6a62282 100644
--- a/tests/basic/enable_post_data_reading_03.phpt
+++ b/tests/basic/enable_post_data_reading_03.phpt
@@ -12,6 +12,7 @@ var_dump($_FILES);
 var_dump($_POST);
 var_dump($HTTP_RAW_POST_DATA);
 var_dump(file_get_contents("php://input"));
+var_dump(file_get_contents("php://input"));
 --EXPECTF--
 array(0) {
 }
@@ -21,3 +22,4 @@ array(0) {
 Notice: Undefined variable: HTTP_RAW_POST_DATA in %s on line %d
 NULL
 string(9) "a=1&b=ZYX"
+string(9) "a=1&b=ZYX"
diff --git a/tests/basic/enable_post_data_reading_04.phpt 
b/tests/basic/enable_post_data_reading_04.phpt
index a168504..a7c7e49 100644
--- a/tests/basic/enable_post_data_reading_04.phpt
+++ b/tests/basic/enable_post_data_reading_04.phpt
@@ -12,6 +12,7 @@ var_dump($_FILES);
 var_dump($_POST);
 var_dump($HTTP_RAW_POST_DATA);
 var_dump(file_get_contents("php://input"));
+var_dump(file_get_contents("php://input"));
 --EXPECTF--
 array(0) {
 }
@@ -21,3 +22,4 @@ array(0) {
 Notice: Undefined variable: HTTP_RAW_POST_DATA in %s on line %d
 NULL
 string(9) "a=1&b=ZYX"
+string(9) "a=1&b=ZYX"
diff --git a/tests/basic/enable_post_data_reading_05.phpt 
b/tests/basic/enable_post_data_reading_05.phpt
new file mode 100644
index 000..d8efa01
--- /dev/null
+++ b/tests/basic/enable_post_data_reading_05.phpt
@@ -0,0 +1,26 @@
+--TEST--
+enable_post_data_reading: using multiple input streams
+--INI--
+enable_post_data_reading=0
+max_execution_time=2
+--POST_RAW--
+Content-Type: application/unknown
+One line of data
+--FILE--
+
+
+Done
+--EXPECT--
+Test
+OOnnee  lliinnee  ooff  ddaattaa
+Done
diff --git a/tests/basic/enable_post_data_reading_06.phpt 
b/tests/basic/enable_post_data_reading_06.phpt
new file mode 100644
index 000..fbed195
--- /dev/null
+++ b/tests/basic/enable_post_data_reading_06.phpt
@@ -0,0 +1,271 @@
+--TEST--
+enable_post_data_reading: using multiple input streams (more than 8k data)
+--INI--
+enable_post_data_reading=0
+--POST_RAW--
+Content-Type: application/unknown
+0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789
+0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789
+0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789
+0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789
+0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789
+0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789
+012

Re: [PHP-CVS] com php-src: slim post data: ext/mbstring/mb_gpc.c ext/soap/soap.c ext/standard/php_fopen_wrapper.c main/SAPI.c main/SAPI.h main/main.c main/php_content_types.c main/php_globals.h main/p

2013-09-17 Thread Michael Wallner
There seem to still be issues with soap -- I'm on it.

On 27 August 2013 13:31, Michael Wallner  wrote:
> Commit:2438490addfbfba51e12246a74588b2382caa08a
> Author:    Michael Wallner  Wed, 14 Aug 2013 14:42:36 
> +0200
> Parents:   fddc82dd0ebb4f7bb24921682251b79970315fbf
> Branches:  master
>
> Link:   
> http://git.php.net/?p=php-src.git;a=commitdiff;h=2438490addfbfba51e12246a74588b2382caa08a
>
> Log:
> slim post data
>
> Changed paths:
>   M  ext/mbstring/mb_gpc.c
>   M  ext/soap/soap.c
>   M  ext/standard/php_fopen_wrapper.c
>   M  main/SAPI.c
>   M  main/SAPI.h
>   M  main/main.c
>   M  main/php_content_types.c
>   M  main/php_globals.h
>   M  main/php_streams.h
>   M  main/php_variables.c
>   M  sapi/cli/php_cli_server.c
>   D  tests/basic/024.phpt
>   D  tests/basic/026.phpt
>
>
> --
> PHP CVS Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php



-- 
Regards,
Mike

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



[PHP-CVS] com php-src: Patch for https://bugs.php.net/bug.php?id=44522 to allow uploading files above 2G.: main/SAPI.h main/rfc1867.c sapi/cgi/cgi_main.c

2013-09-17 Thread Michael Wallner
Commit:da04b2e28c6ccc73bfab542ed4dd5eada343e592
Author:Ralf Lang  Fri, 28 Jun 2013 08:32:10 
+0200
Parents:   a441d9274b0045de20402b3912d04ca3de57365d
Branches:  master

Link:   
http://git.php.net/?p=php-src.git;a=commitdiff;h=da04b2e28c6ccc73bfab542ed4dd5eada343e592

Log:
Patch for https://bugs.php.net/bug.php?id=44522 to allow uploading files
above 2G.

This is essentially the same as the patch
"uploads_larger_than_2g_HEAD_v2 (last revision 2012-03-26 03:59 UTC) by
jason at infininull dot com)" but using off_t instead of signed long
(originally: uint)

I tested this on 64bit linux and succeeded uploading a file of 4.8 G.
The File did not get corrupted or truncated in any way.

I did not yet test this under windows or 32 bit linux

Note that there are still limitations:

* Did not test for files > 8 G
* php does not yet reject absurdly high values
* Still limited by underlying file system specific limits and free space
* in upload
* tmp dir and destination dir

Changed paths:
  M  main/SAPI.h
  M  main/rfc1867.c
  M  sapi/cgi/cgi_main.c


Diff:
diff --git a/main/SAPI.h b/main/SAPI.h
index 92b7329..c3cacb5 100644
--- a/main/SAPI.h
+++ b/main/SAPI.h
@@ -82,7 +82,7 @@ typedef struct {
char *post_data, *raw_post_data;
char *cookie_data;
long content_length;
-   uint post_data_length, raw_post_data_length;
+   off_t post_data_length, raw_post_data_length;
 
char *path_translated;
char *request_uri;
@@ -119,7 +119,7 @@ typedef struct _sapi_globals_struct {
void *server_context;
sapi_request_info request_info;
sapi_headers_struct sapi_headers;
-   int read_post_bytes;
+   off_t read_post_bytes;
unsigned char headers_sent;
struct stat global_stat;
char *default_mimetype;
diff --git a/main/rfc1867.c b/main/rfc1867.c
index ed7ce9c..78a7ad2 100644
--- a/main/rfc1867.c
+++ b/main/rfc1867.c
@@ -676,8 +676,9 @@ SAPI_API SAPI_POST_HANDLER_FUNC(rfc1867_post_handler) /* 
{{{ */
 {
char *boundary, *s = NULL, *boundary_end = NULL, *start_arr = NULL, 
*array_index = NULL;
char *temp_filename = NULL, *lbuf = NULL, *abuf = NULL;
-   int boundary_len = 0, total_bytes = 0, cancel_upload = 0, is_arr_upload 
= 0, array_len = 0;
-   int max_file_size = 0, skip_upload = 0, anonindex = 0, is_anonymous;
+   int boundary_len = 0, cancel_upload = 0, is_arr_upload = 0, array_len = 
0;
+   off_t total_bytes = 0, max_file_size = 0;
+   int skip_upload = 0, anonindex = 0, is_anonymous;
zval *http_post_files = NULL;
HashTable *uploaded_files = NULL;
multipart_buffer *mbuff;
diff --git a/sapi/cgi/cgi_main.c b/sapi/cgi/cgi_main.c
index 9e6b74a..ec7b963 100644
--- a/sapi/cgi/cgi_main.c
+++ b/sapi/cgi/cgi_main.c
@@ -508,7 +508,7 @@ static int sapi_cgi_read_post(char *buffer, uint 
count_bytes TSRMLS_DC)
uint read_bytes = 0;
int tmp_read_bytes;
 
-   count_bytes = MIN(count_bytes, (uint) SG(request_info).content_length - 
SG(read_post_bytes));
+   count_bytes = MIN(count_bytes, SG(request_info).content_length - 
SG(read_post_bytes));
while (read_bytes < count_bytes) {
tmp_read_bytes = read(STDIN_FILENO, buffer + read_bytes, 
count_bytes - read_bytes);
if (tmp_read_bytes <= 0) {


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



[PHP-CVS] com php-src: Use int64_t and atoll() after discussion with johannes: main/SAPI.h main/rfc1867.c

2013-09-17 Thread Michael Wallner
Commit:a2394df90e86a24a61f1267b5767017e2e769b2a
Author:Ralf Lang  Mon, 22 Jul 2013 18:03:11 
+0200
Parents:   f978f11e2e599258cdbdc699cfccd5d961eb8c36
Branches:  master

Link:   
http://git.php.net/?p=php-src.git;a=commitdiff;h=a2394df90e86a24a61f1267b5767017e2e769b2a

Log:
Use int64_t and atoll() after discussion with johannes

Changed paths:
  M  main/SAPI.h
  M  main/rfc1867.c


Diff:
diff --git a/main/SAPI.h b/main/SAPI.h
index c3cacb5..6d5434d 100644
--- a/main/SAPI.h
+++ b/main/SAPI.h
@@ -82,7 +82,7 @@ typedef struct {
char *post_data, *raw_post_data;
char *cookie_data;
long content_length;
-   off_t post_data_length, raw_post_data_length;
+   int64_t post_data_length, raw_post_data_length;
 
char *path_translated;
char *request_uri;
@@ -119,7 +119,7 @@ typedef struct _sapi_globals_struct {
void *server_context;
sapi_request_info request_info;
sapi_headers_struct sapi_headers;
-   off_t read_post_bytes;
+   int64_t read_post_bytes;
unsigned char headers_sent;
struct stat global_stat;
char *default_mimetype;
diff --git a/main/rfc1867.c b/main/rfc1867.c
index 452b6a3..d3adf47 100644
--- a/main/rfc1867.c
+++ b/main/rfc1867.c
@@ -677,7 +677,7 @@ SAPI_API SAPI_POST_HANDLER_FUNC(rfc1867_post_handler) /* 
{{{ */
char *boundary, *s = NULL, *boundary_end = NULL, *start_arr = NULL, 
*array_index = NULL;
char *temp_filename = NULL, *lbuf = NULL, *abuf = NULL;
int boundary_len = 0, cancel_upload = 0, is_arr_upload = 0, array_len = 
0;
-   off_t total_bytes = 0, max_file_size = 0;
+   int64_t total_bytes = 0, max_file_size = 0;
int skip_upload = 0, anonindex = 0, is_anonymous;
zval *http_post_files = NULL;
HashTable *uploaded_files = NULL;
@@ -899,7 +899,7 @@ SAPI_API SAPI_POST_HANDLER_FUNC(rfc1867_post_handler) /* 
{{{ */
}
 
if (!strcasecmp(param, "MAX_FILE_SIZE")) {
-   max_file_size = atol(value);
+   max_file_size = atoll(value);
}
 
efree(param);


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



[PHP-CVS] com php-src: make this work in vc11 too: main/SAPI.h main/rfc1867.c

2013-09-17 Thread Michael Wallner
Commit:b07e55fdeba5d3e415671c0981e3041841b2485e
Author:Ralf Lang  Mon, 22 Jul 2013 21:26:38 
+0200
Parents:   a2394df90e86a24a61f1267b5767017e2e769b2a
Branches:  master

Link:   
http://git.php.net/?p=php-src.git;a=commitdiff;h=b07e55fdeba5d3e415671c0981e3041841b2485e

Log:
make this work in vc11 too

Changed paths:
  M  main/SAPI.h
  M  main/rfc1867.c


Diff:
diff --git a/main/SAPI.h b/main/SAPI.h
index 6d5434d..6fc60c8 100644
--- a/main/SAPI.h
+++ b/main/SAPI.h
@@ -27,6 +27,7 @@
 #include "zend_operators.h"
 #ifdef PHP_WIN32
 #include "win95nt.h"
+#include "win32/php_stdint.h"
 #endif
 #include 
 
diff --git a/main/rfc1867.c b/main/rfc1867.c
index d3adf47..8460929 100644
--- a/main/rfc1867.c
+++ b/main/rfc1867.c
@@ -34,6 +34,10 @@
 #include "rfc1867.h"
 #include "ext/standard/php_string.h"
 
+#if defined(_MSC_VER)
+# define atoll(s) _atoi64(s)
+#endif
+
 #define DEBUG_FILE_UPLOAD ZEND_DEBUG
 
 static int dummy_encoding_translation(TSRMLS_D)


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



[PHP-CVS] com php-src: ws: main/rfc1867.c

2013-09-17 Thread Michael Wallner
Commit:f978f11e2e599258cdbdc699cfccd5d961eb8c36
Author:Ralf Lang  Fri, 28 Jun 2013 08:38:34 
+0200
Parents:   da04b2e28c6ccc73bfab542ed4dd5eada343e592
Branches:  master

Link:   
http://git.php.net/?p=php-src.git;a=commitdiff;h=f978f11e2e599258cdbdc699cfccd5d961eb8c36

Log:
ws

Changed paths:
  M  main/rfc1867.c


Diff:
diff --git a/main/rfc1867.c b/main/rfc1867.c
index 78a7ad2..452b6a3 100644
--- a/main/rfc1867.c
+++ b/main/rfc1867.c
@@ -677,7 +677,7 @@ SAPI_API SAPI_POST_HANDLER_FUNC(rfc1867_post_handler) /* 
{{{ */
char *boundary, *s = NULL, *boundary_end = NULL, *start_arr = NULL, 
*array_index = NULL;
char *temp_filename = NULL, *lbuf = NULL, *abuf = NULL;
int boundary_len = 0, cancel_upload = 0, is_arr_upload = 0, array_len = 
0;
-   off_t total_bytes = 0, max_file_size = 0;
+   off_t total_bytes = 0, max_file_size = 0;
int skip_upload = 0, anonindex = 0, is_anonymous;
zval *http_post_files = NULL;
HashTable *uploaded_files = NULL;


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



[PHP-CVS] com php-src: add NEWS entry; add simple test: NEWS sapi/cli/tests/php_cli_server.inc sapi/cli/tests/upload_2G.phpt

2013-09-17 Thread Michael Wallner
Commit:15c351cc52971eb9a1a6c16a760cc0f681c5
Author:Michael Wallner  Mon, 5 Aug 2013 13:53:35 +0200
Parents:   69aed1b61fd87633a4decc75e190abc24848172a
Branches:  master

Link:   
http://git.php.net/?p=php-src.git;a=commitdiff;h=15c351cc52971eb9a1a6c16a760cc0f681c5

Log:
add NEWS entry; add simple test

Changed paths:
  M  NEWS
  M  sapi/cli/tests/php_cli_server.inc
  A  sapi/cli/tests/upload_2G.phpt


Diff:
diff --git a/NEWS b/NEWS
index c679b90..3ef4a97 100644
--- a/NEWS
+++ b/NEWS
@@ -6,6 +6,7 @@ PHP 
   NEWS
   . Improved IS_VAR operands fetching. (Laruence, Dmitry)
   . Implemented internal operator overloading
 (RFC: https://wiki.php.net/rfc/operator_overloading_gmp). (Nikita)
+  . Enabled file uploads greater than 2G (Ralf Lang, Mike)
 
 - mysqlnd:
   . Disabled flag for SP OUT variables for 5.5+ servers as they are not 
natively
diff --git a/sapi/cli/tests/php_cli_server.inc 
b/sapi/cli/tests/php_cli_server.inc
index 40c5361..77a79e0 100644
--- a/sapi/cli/tests/php_cli_server.inc
+++ b/sapi/cli/tests/php_cli_server.inc
@@ -3,7 +3,7 @@ define ("PHP_CLI_SERVER_HOSTNAME", "localhost");
 define ("PHP_CLI_SERVER_PORT", 8964);
 define ("PHP_CLI_SERVER_ADDRESS", 
PHP_CLI_SERVER_HOSTNAME.":".PHP_CLI_SERVER_PORT);
 
-function php_cli_server_start($code = 'echo "Hello world";', $no_router = 
FALSE) {
+function php_cli_server_start($code = 'echo "Hello world";', $no_router = 
FALSE, $cmd_args = null) {
$php_executable = getenv('TEST_PHP_EXECUTABLE');
$doc_root = __DIR__;
$router = "index.php";
@@ -19,14 +19,14 @@ function php_cli_server_start($code = 'echo "Hello 
world";', $no_router = FALSE)
);
 
if (substr(PHP_OS, 0, 3) == 'WIN') {
-   $cmd = "{$php_executable} -t {$doc_root} -n -S " . 
PHP_CLI_SERVER_ADDRESS;
+   $cmd = "{$php_executable} -t {$doc_root} -n {$cmd_args} -S " . 
PHP_CLI_SERVER_ADDRESS;
if (!$no_router) {
$cmd .= " {$router}";
}
 
$handle = proc_open(addslashes($cmd), $descriptorspec, $pipes, 
$doc_root, NULL, array("bypass_shell" => true,  "suppress_errors" => true));
} else {
-   $cmd = "exec {$php_executable} -t {$doc_root} -n -S " . 
PHP_CLI_SERVER_ADDRESS;
+   $cmd = "exec {$php_executable} -t {$doc_root} -n {$cmd_args} -S 
" . PHP_CLI_SERVER_ADDRESS;
if (!$no_router) {
$cmd .= " {$router}";
}
diff --git a/sapi/cli/tests/upload_2G.phpt b/sapi/cli/tests/upload_2G.phpt
new file mode 100644
index 000..c7ae5c6
--- /dev/null
+++ b/sapi/cli/tests/upload_2G.phpt
@@ -0,0 +1,99 @@
+--TEST--
+file upload greater than 2G
+--SKIPIF--
+=8");
+}
+
+if ($f = fopen("/proc/meminfo","r")) {
+   while (!feof($f)) {
+   if (!strncmp($line = fgets($f), "MemFree", 7)) {
+   if (substr($line,8)/1024/1024 > 3) {
+   $enough_free_ram = true;
+   }
+   }
+   }
+}
+   
+if (empty($enough_free_ram)) {
+   die("need +3G free RAM");
+}
+?>
+--FILE--
+
+Done
+--EXPECTF--
+Test
+
+HTTP/1.1 200 OK
+Host: %s
+Connection: close
+X-Powered-By: PHP/%s
+Content-type: text/html
+
+array(1) {
+  ["file1"]=>
+  array(5) {
+["name"]=>
+string(9) "file1.txt"
+["type"]=>
+string(10) "text/plain"
+["tmp_name"]=>
+string(14) "/tmp/php%s"
+["error"]=>
+int(0)
+["size"]=>
+int(215000)
+  }
+}
+Done


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



[PHP-CVS] com php-src: NEWS/UPGRADING{,.INTERNALS} notes about temp POST stream: NEWS UPGRADING UPGRADING.INTERNALS

2013-09-17 Thread Michael Wallner
Commit:4a3936ef4abdeb72c7d323fe4b6a65e1ae0ef181
Author:Michael Wallner  Tue, 17 Sep 2013 11:08:23 
+0200
Parents:   1c15d70cbd91e3f502694a31704e959cf734d8da
Branches:  master

Link:   
http://git.php.net/?p=php-src.git;a=commitdiff;h=4a3936ef4abdeb72c7d323fe4b6a65e1ae0ef181

Log:
NEWS/UPGRADING{,.INTERNALS} notes about temp POST stream

Changed paths:
  M  NEWS
  M  UPGRADING
  M  UPGRADING.INTERNALS


Diff:
diff --git a/NEWS b/NEWS
index 60fac8c..540f896 100644
--- a/NEWS
+++ b/NEWS
@@ -11,6 +11,9 @@ PHP   
 NEWS
(Gustavo)
   . Uploads equal or greater than 2GB in size are now accepted.
 (Ralf Lang, Mike)
+  . Reduced POST data memory usage by 200-300%. Removed INI setting
+always_populate_raw_post_data and the $HTTP_RAW_POST_DATA global
+variable. (Mike)
 
 - cURL:
   . Implemented FR #65646 (re-enable CURLOPT_FOLLOWLOCATION with open_basedir
diff --git a/UPGRADING b/UPGRADING
index e9fba51..f5e7cd0 100755
--- a/UPGRADING
+++ b/UPGRADING
@@ -20,11 +20,23 @@ PHP X.Y UPGRADE NOTES
 1. Backward Incompatible Changes
 
 
+- Core:
+  Removed $HTTP_RAW_POST_DATA global variable. Restore backwards compatibility 
+  by:
+  
 
 
 2. New Features
 
 
+- Core:
+  The php://input stream is now re-usable and can be used concurrently with 
+  enable_post_data_reading=0.
 
 
 2. Changes in SAPI modules
@@ -91,6 +103,8 @@ PHP X.Y UPGRADE NOTES
 10. Changes to INI File Handling
 
 
+- Core:
+  Removed always_populate_raw_post_data.
 
 
 11. Other Changes
diff --git a/UPGRADING.INTERNALS b/UPGRADING.INTERNALS
index 7cb5539..90202f0 100644
--- a/UPGRADING.INTERNALS
+++ b/UPGRADING.INTERNALS
@@ -5,6 +5,7 @@ UPGRADE NOTES - PHP X.Y
 1. Internal API changes
   a. Addition of do_operation and compare object handlers
   b. return_value_ptr now always available, RETVAL_ZVAL_FAST macros
+  c. POST data handling
 
 2. Build system changes
   a. Unix build system changes
@@ -57,6 +58,15 @@ UPGRADE NOTES - PHP X.Y
   The macros behave similarly to the non-FAST variants with copy=1 and
   dtor=0, but will try to return the zval without making a copy by utilizing
   return_value_ptr.
+  
+  c. POST data handling
+  
+  The sapi_request_info's members post_data, post_data_len and raw_post_data 
as 
+  well as raw_post_data_len have been replaced with a temp PHP stream 
+  request_body.
+  
+  The recommended way to access raw POST data is to open and use a php://input 
+  stream wrapper.  It is safe to be used concurrently and more than once. 
 
 
 2. Build system changes


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



[PHP-CVS] com php-src: Merge branch 'slim-postdata': main/main.c main/php_variables.c sapi/cli/php_cli_server.c

2013-09-17 Thread Michael Wallner
Commit:1c15d70cbd91e3f502694a31704e959cf734d8da
Author:Michael Wallner  Tue, 17 Sep 2013 10:50:49 
+0200
Parents:   52ff129607a7193cccbc6bdfbf1c1e8586e8d0d2 
2438490addfbfba51e12246a74588b2382caa08a
Branches:  master

Link:   
http://git.php.net/?p=php-src.git;a=commitdiff;h=1c15d70cbd91e3f502694a31704e959cf734d8da

Log:
Merge branch 'slim-postdata'

* slim-postdata:
  slim post data
  add NEWS entry; add simple test
  more precise condition
  make this work in vc11 too
  Use int64_t and atoll() after discussion with johannes
  ws
  Patch for https://bugs.php.net/bug.php?id=44522 to allow uploading files 
above 2G.

Changed paths:
  MM  main/main.c
  MM  main/php_variables.c
  MM  sapi/cli/php_cli_server.c


Diff:
diff --cc sapi/cli/php_cli_server.c
index d50cc4f,5ec4143..5e0f6e95
--- a/sapi/cli/php_cli_server.c
+++ b/sapi/cli/php_cli_server.c
@@@ -1723,10 -1726,9 +1723,9 @@@ static void php_cli_server_client_popul
request_info->request_uri = client->request.request_uri;
request_info->path_translated = client->request.path_translated;
request_info->query_string = client->request.query_string;
-   request_info->post_data = client->request.content;
-   request_info->content_length = request_info->post_data_length = 
client->request.content_len;
+   request_info->content_length = client->request.content_len;
request_info->auth_user = request_info->auth_password = 
request_info->auth_digest = NULL;
 -  if (SUCCESS == zend_hash_find(&client->request.headers, "Content-Type", 
sizeof("Content-Type"), (void**)&val)) {
 +  if (SUCCESS == zend_hash_find(&client->request.headers, "content-type", 
sizeof("content-type"), (void**)&val)) {
request_info->content_type = *val;
}
  } /* }}} */


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



  1   2   3   4   5   >