[PHP-CVS] svn: /php/php-src/ branches/PHP_5_3/ext/phar/phar_object.c trunk/ext/phar/phar_object.c

2011-03-14 Thread Felipe Pena
felipe   Mon, 14 Mar 2011 14:12:42 +

Revision: http://svn.php.net/viewvc?view=revisionrevision=309222

Log:
- Missing fixes for bug #54247

Bug: http://bugs.php.net/54247 (error getting bug information)
  
Changed paths:
U   php/php-src/branches/PHP_5_3/ext/phar/phar_object.c
U   php/php-src/trunk/ext/phar/phar_object.c

Modified: php/php-src/branches/PHP_5_3/ext/phar/phar_object.c
===
--- php/php-src/branches/PHP_5_3/ext/phar/phar_object.c 2011-03-14 13:54:41 UTC 
(rev 309221)
+++ php/php-src/branches/PHP_5_3/ext/phar/phar_object.c 2011-03-14 14:12:42 UTC 
(rev 309222)
@@ -307,7 +307,7 @@
char *error;
if (!phar_open_jit(phar, info, error 
TSRMLS_CC)) {
if (error) {
-   
zend_throw_exception_ex(phar_ce_PharException, 0 TSRMLS_CC, error);
+   
zend_throw_exception_ex(phar_ce_PharException, 0 TSRMLS_CC, %s, error);
efree(error);
}
return -1;
@@ -673,7 +673,7 @@

if (phar_open_executed_filename(alias, alias_len, error TSRMLS_CC) != 
SUCCESS) {
if (error) {
-   zend_throw_exception_ex(phar_ce_PharException, 0 
TSRMLS_CC, error);
+   zend_throw_exception_ex(phar_ce_PharException, 0 
TSRMLS_CC, %s, error);
efree(error);
}
return;
@@ -1095,7 +1095,7 @@
stub = phar_create_default_stub(index, webindex, stub_len, error 
TSRMLS_CC);

if (error) {
-   zend_throw_exception_ex(phar_ce_PharException, 0 TSRMLS_CC, 
error);
+   zend_throw_exception_ex(phar_ce_PharException, 0 TSRMLS_CC, 
%s, error);
efree(error);
return;
}
@@ -1120,7 +1120,7 @@
RETVAL_BOOL(phar_open_executed_filename(alias, alias_len, error 
TSRMLS_CC) == SUCCESS);

if (error) {
-   zend_throw_exception_ex(phar_ce_PharException, 0 TSRMLS_CC, 
error);
+   zend_throw_exception_ex(phar_ce_PharException, 0 TSRMLS_CC, 
%s, error);
efree(error);
}
 } /* }}} */

Modified: php/php-src/trunk/ext/phar/phar_object.c
===
--- php/php-src/trunk/ext/phar/phar_object.c2011-03-14 13:54:41 UTC (rev 
309221)
+++ php/php-src/trunk/ext/phar/phar_object.c2011-03-14 14:12:42 UTC (rev 
309222)
@@ -308,7 +308,7 @@
char *error;
if (!phar_open_jit(phar, info, error 
TSRMLS_CC)) {
if (error) {
-   
zend_throw_exception_ex(phar_ce_PharException, 0 TSRMLS_CC, error);
+   
zend_throw_exception_ex(phar_ce_PharException, 0 TSRMLS_CC, %s, error);
efree(error);
}
return -1;
@@ -675,7 +675,7 @@

if (phar_open_executed_filename(alias, alias_len, error TSRMLS_CC) != 
SUCCESS) {
if (error) {
-   zend_throw_exception_ex(phar_ce_PharException, 0 
TSRMLS_CC, error);
+   zend_throw_exception_ex(phar_ce_PharException, 0 
TSRMLS_CC, %s, error);
efree(error);
}
return;
@@ -1097,7 +1097,7 @@
stub = phar_create_default_stub(index, webindex, stub_len, error 
TSRMLS_CC);

if (error) {
-   zend_throw_exception_ex(phar_ce_PharException, 0 TSRMLS_CC, 
error);
+   zend_throw_exception_ex(phar_ce_PharException, 0 TSRMLS_CC, 
%s, error);
efree(error);
return;
}
@@ -1122,7 +1122,7 @@
RETVAL_BOOL(phar_open_executed_filename(alias, alias_len, error 
TSRMLS_CC) == SUCCESS);

if (error) {
-   zend_throw_exception_ex(phar_ce_PharException, 0 TSRMLS_CC, 
error);
+   zend_throw_exception_ex(phar_ce_PharException, 0 TSRMLS_CC, 
%s, error);
efree(error);
}
 } /* }}} */

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

[PHP-CVS] svn: /php/php-src/trunk/ Zend/tests/multibyte/multibyte_encoding_002.phpt Zend/zend_language_scanner.l ext/exif/exif.c ext/mbstring/libmbfl/filters/mbfilter_ascii.c ext/mbstring/libmbfl/filt

2011-03-14 Thread Dmitry Stogov
dmitry   Mon, 14 Mar 2011 16:00:59 +

Revision: http://svn.php.net/viewvc?view=revisionrevision=309227

Log:
Fixed multibyte related issues

Changed paths:
U   php/php-src/trunk/Zend/tests/multibyte/multibyte_encoding_002.phpt
U   php/php-src/trunk/Zend/zend_language_scanner.l
U   php/php-src/trunk/ext/exif/exif.c
U   php/php-src/trunk/ext/mbstring/libmbfl/filters/mbfilter_ascii.c
U   php/php-src/trunk/ext/mbstring/libmbfl/filters/mbfilter_cp5022x.c
U   php/php-src/trunk/ext/mbstring/libmbfl/filters/mbfilter_cp850.c
U   php/php-src/trunk/ext/mbstring/libmbfl/filters/mbfilter_cp866.c
U   php/php-src/trunk/ext/mbstring/libmbfl/mbfl/mbfl_memory_device.c
U   php/php-src/trunk/ext/mbstring/mb_gpc.c
U   php/php-src/trunk/ext/mbstring/mbstring.c
U   php/php-src/trunk/ext/mbstring/tests/mb_encoding_aliases.phpt

Modified: php/php-src/trunk/Zend/tests/multibyte/multibyte_encoding_002.phpt
===
--- php/php-src/trunk/Zend/tests/multibyte/multibyte_encoding_002.phpt	2011-03-14 14:43:16 UTC (rev 309226)
+++ php/php-src/trunk/Zend/tests/multibyte/multibyte_encoding_002.phpt	2011-03-14 16:00:59 UTC (rev 309227)
@@ -11,7 +11,7 @@
 ?
 --INI--
 zend.multibyte=1
-zend.internal_encoding=iso-8859-1
+mbstring.internal_encoding=iso-8859-1
 --FILE--
 ?php
 print Hello World\n;

Modified: php/php-src/trunk/Zend/zend_language_scanner.l
===
--- php/php-src/trunk/Zend/zend_language_scanner.l	2011-03-14 14:43:16 UTC (rev 309226)
+++ php/php-src/trunk/Zend/zend_language_scanner.l	2011-03-14 16:00:59 UTC (rev 309227)
@@ -346,9 +346,7 @@

 	if (script_encoding) {
 		/* remove BOM */
-		script = (unsigned char*)emalloc(LANG_SCNG(script_org_size)+1-bom_size);
-		memcpy(script, LANG_SCNG(script_org)+bom_size, LANG_SCNG(script_org_size)+1-bom_size);
-		LANG_SCNG(script_org) = script;
+		LANG_SCNG(script_org) += bom_size;
 		LANG_SCNG(script_org_size) -= bom_size;

 		return script_encoding;

Modified: php/php-src/trunk/ext/exif/exif.c
===
--- php/php-src/trunk/ext/exif/exif.c	2011-03-14 14:43:16 UTC (rev 309226)
+++ php/php-src/trunk/ext/exif/exif.c	2011-03-14 16:00:59 UTC (rev 309227)
@@ -2664,13 +2664,13 @@
 decode = ImageInfo-decode_unicode_le;
 			}
 			if (zend_multibyte_encoding_converter(
-	pszInfoPtr,
+	(unsigned char**)pszInfoPtr,
 	len,
-	szValuePtr,
+	(unsigned char*)szValuePtr,
 	ByteCount,
-	ImageInfo-encode_unicode,
-	decode
-	TSRMLS_CC) != 0) {
+	zend_multibyte_fetch_encoding(ImageInfo-encode_unicode TSRMLS_CC),
+	zend_multibyte_fetch_encoding(decode TSRMLS_CC)
+	TSRMLS_CC)  0) {
 len = exif_process_string_raw(pszInfoPtr, szValuePtr, ByteCount);
 			}
 			return len;
@@ -2684,13 +2684,13 @@
 			szValuePtr = szValuePtr+8;
 			ByteCount -= 8;
 			if (zend_multibyte_encoding_converter(
-	pszInfoPtr,
+	(unsigned char**)pszInfoPtr,
 	len,
-	szValuePtr,
+	(unsigned char*)szValuePtr,
 	ByteCount,
-	ImageInfo-encode_jis,
-	ImageInfo-motorola_intel ? ImageInfo-decode_jis_be : ImageInfo-decode_jis_le
-	TSRMLS_CC) != 0) {
+	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) {
 len = exif_process_string_raw(pszInfoPtr, szValuePtr, ByteCount);
 			}
 			return len;
@@ -2723,13 +2723,13 @@

 	/* Copy the comment */
 	if (zend_multibyte_encoding_converter(
-			xp_field-value,
+			(unsigned char**)xp_field-value,
 			xp_field-size,
-			szValuePtr,
+			(unsigned char*)szValuePtr,
 			ByteCount,
-			ImageInfo-encode_unicode,
-			ImageInfo-motorola_intel ? ImageInfo-decode_unicode_be : ImageInfo-decode_unicode_le
-			TSRMLS_CC) != 0) {
+			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) {
 		xp_field-size = exif_process_string_raw(xp_field-value, szValuePtr, ByteCount);
 	}
 	return xp_field-size;

Modified: php/php-src/trunk/ext/mbstring/libmbfl/filters/mbfilter_ascii.c
===
--- php/php-src/trunk/ext/mbstring/libmbfl/filters/mbfilter_ascii.c	2011-03-14 14:43:16 UTC (rev 309226)
+++ php/php-src/trunk/ext/mbstring/libmbfl/filters/mbfilter_ascii.c	2011-03-14 16:00:59 UTC (rev 309227)
@@ -37,7 +37,7 @@

 static int mbfl_filt_ident_ascii(int c, mbfl_identify_filter *filter);

-static const char *mbfl_encoding_ascii_aliases[] = {ANSI_X3.4-1968, iso-ir-6, ANSI_X3.4-1986, ISO_646.irv:1991, US-ASCII, ISO646-US, us, IBM367, cp367, csASCII, NULL};
+static const char *mbfl_encoding_ascii_aliases[] = 

Re: [PHP-CVS] svn: /php/php-src/trunk/ Zend/zend_compile.c Zend/zend_language_scanner.c Zend/zend_language_scanner.l Zend/zend_language_scanner_defs.h Zend/zend_multibyte.c Zend/zend_multibyte.h ext/m

2011-03-14 Thread Dmitry Stogov

Hi Moriyoshi,

Thank you for fixing it. You have fixed the most problems.
I hope I've just fixed the rest, so all the broken tests work again.

Thanks. Dmitry.


On 03/06/2011 10:00 AM, Moriyoshi Koizumi wrote:

moriyoshiSun, 06 Mar 2011 07:00:30 +

Revision: http://svn.php.net/viewvc?view=revisionrevision=308950

Log:
Fix zend.multibyte oddities. Hope this will address all the known problems.

Changed paths:
 U   php/php-src/trunk/Zend/zend_compile.c
 U   php/php-src/trunk/Zend/zend_language_scanner.c
 U   php/php-src/trunk/Zend/zend_language_scanner.l
 U   php/php-src/trunk/Zend/zend_language_scanner_defs.h
 U   php/php-src/trunk/Zend/zend_multibyte.c
 U   php/php-src/trunk/Zend/zend_multibyte.h
 U   php/php-src/trunk/ext/mbstring/mbstring.c
 U   php/php-src/trunk/ext/mbstring/mbstring.h
 U   php/php-src/trunk/main/rfc1867.c
 U   php/php-src/trunk/main/rfc1867.h





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



[PHP-CVS] svn: /php/php-src/ branches/PHP_5_3/ext/date/lib/timezonedb.h trunk/ext/date/lib/timezonedb.h

2011-03-14 Thread Derick Rethans
derick   Mon, 14 Mar 2011 18:56:02 +

Revision: http://svn.php.net/viewvc?view=revisionrevision=309231

Log:
- Updated to version 2011.4 (2011d)

Changed paths:
U   php/php-src/branches/PHP_5_3/ext/date/lib/timezonedb.h
U   php/php-src/trunk/ext/date/lib/timezonedb.h

Modified: php/php-src/branches/PHP_5_3/ext/date/lib/timezonedb.h
===
--- php/php-src/branches/PHP_5_3/ext/date/lib/timezonedb.h	2011-03-14 18:15:41 UTC (rev 309230)
+++ php/php-src/branches/PHP_5_3/ext/date/lib/timezonedb.h	2011-03-14 18:56:02 UTC (rev 309231)
@@ -3415,7 +3415,7 @@
 0x3E, 0x8F, 0xB4, 0x50, 0x3F, 0x9B, 0x54, 0xD0, 0x40, 0x6F, 0x96, 0x50, 0x45, 0x44, 0x35, 0x50,
 0x45, 0xF3, 0x8C, 0xD0, 0x47, 0x24, 0x17, 0x50, 0x47, 0xDC, 0xA9, 0x50, 0x49, 0x03, 0xF9, 0x50,
 0x49, 0xB3, 0x50, 0xD0, 0x4A, 0xE3, 0xDB, 0x50, 0x4B, 0x9C, 0x6D, 0x50, 0x4C, 0xCC, 0xF7, 0xD0,
-0x4D, 0x7C, 0x4F, 0x50, 0x4E, 0xAC, 0xD9, 0xD0, 0x4F, 0x5C, 0x31, 0x50, 0x50, 0x8C, 0xBB, 0xD0,
+0x4D, 0x85, 0x89, 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4B, 0xAE, 0xAA, 0x10, 0x4C, 0xCC, 0xBF, 0x90,
-0x4D, 0x8E, 0x8C, 0x10, 0x4E, 0xAC, 0xA1, 0x90, 0x4F, 0x6E, 0x6E, 0x10, 0x50, 0x8C, 0x83, 0x90,
+0x4D, 0x8F, 0xDD, 0x90, 0x4E, 0xAC, 0xA1, 0x90, 0x4F, 0x6E, 0x6E, 0x10, 0x50, 0x8C, 0x83, 0x90,
 0x51, 0x57, 0x8A, 0x90, 0x52, 0x6C, 0x65, 0x90, 0x53, 0x37, 0x6C, 0x90, 0x54, 0x4C, 0x47, 0x90,
 0x55, 0x17, 0x4E, 0x90, 0x56, 0x2C, 0x29, 0x90, 0x56, 0xF7, 0x30, 0x90, 0x58, 0x15, 0x46, 0x10,
 0x58, 0xD7, 0x12, 0x90, 0x59, 0xF5, 0x28, 0x10, 0x5A, 0xB6, 0xF4, 0x90, 0x5B, 0xD5, 0x0A, 0x10,
@@ -16819,7 +16819,7 @@
 0x50, 0x48, 0x50, 0x31, 0x01, 0x57, 0x53, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00,
 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x12, 0x91, 0x05, 0xFC, 0x00,
-0xDA, 0x62, 0x04, 0x38, 0x4C, 0x9F, 0x27, 0xB0, 0x4D, 0x98, 0x53, 0x30, 0x01, 0x02, 0x03, 0x02,
+0xDA, 0x62, 0x04, 0x38, 0x4C, 0x9F, 0x27, 0xB0, 0x4D, 0x97, 0x2B, 0xE0, 0x01, 0x02, 0x03, 0x02,
 0xFF, 0xFF, 0x5F, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0x5E, 0x48, 0x00, 0x04, 0xFF, 0xFF, 0x65, 0x50,
 0x00, 0x09, 0xFF, 0xFF, 0x73, 0x60, 0x01, 0x0D, 0x4C, 0x4D, 0x54, 0x00, 0x53, 0x41, 0x4D, 0x54,
 0x00, 0x57, 0x53, 0x54, 0x00, 0x57, 0x53, 0x44, 0x54, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
@@ -17630,7 +17630,7 @@
 0x43, 0x63, 0xFE, 0xF0, 0x44, 0x25, 0xCB, 0x70, 0x45, 0x43, 0xE0, 0xF0, 0x45, 0x98, 0x32, 0xE0,
 0x46, 0x05, 0xC9, 0x90, 0x47, 0x23, 0xDF, 0x10, 0x47, 0xEE, 0xE6, 0x10, 0x49, 0x03, 0xC1, 0x10,
 0x49, 0xCE, 0xC8, 0x10, 0x4A, 0xE3, 0xA3, 0x10, 0x4B, 0xAE, 0xAA, 0x10, 0x4C, 0xCC, 0xBF, 0x90,
-0x4D, 0x8E, 0x8C, 0x10, 0x4E, 0xAC, 0xA1, 0x90, 

[PHP-CVS] svn: /php/php-src/branches/PHP_5_3/ NEWS

2011-03-14 Thread Felipe Pena
felipe   Mon, 14 Mar 2011 22:27:40 +

Revision: http://svn.php.net/viewvc?view=revisionrevision=309237

Log:
- BFN

Changed paths:
U   php/php-src/branches/PHP_5_3/NEWS

Modified: php/php-src/branches/PHP_5_3/NEWS
===
--- php/php-src/branches/PHP_5_3/NEWS   2011-03-14 21:46:16 UTC (rev 309236)
+++ php/php-src/branches/PHP_5_3/NEWS   2011-03-14 22:27:40 UTC (rev 309237)
@@ -1,5 +1,10 @@
 PHP
NEWS
 |||
+?? Mar 2011, PHP 5.3.6
+- Phar extension:
+  . Fixed bug #54247 (format-string vulnerability on Phar). (Felipe)
+(CVE-2011-1153)
+
 10 Mar 2011, PHP 5.3.6RC3
 - Shmop extension:
   . Fixed bug #54193 (Integer overflow in shmop_read()). (Felipe)

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

[PHP-CVS] svn: /php/php-src/trunk/ext/sockets/ sockets.c tests/bug51958.phpt

2011-03-14 Thread Gustavo André dos Santos Lopes
cataphract   Mon, 14 Mar 2011 22:59:05 +

Revision: http://svn.php.net/viewvc?view=revisionrevision=309238

Log:
- Fixed bug #51958: socket_accept() fails on IPv6 sockets.
#On hold for 5.3

Bug: http://bugs.php.net/51958 (Assigned) socket_accept() fails on IPv6 server 
sockets
  
Changed paths:
U   php/php-src/trunk/ext/sockets/sockets.c
A   php/php-src/trunk/ext/sockets/tests/bug51958.phpt

Modified: php/php-src/trunk/ext/sockets/sockets.c
===
--- php/php-src/trunk/ext/sockets/sockets.c 2011-03-14 22:27:40 UTC (rev 
309237)
+++ php/php-src/trunk/ext/sockets/sockets.c 2011-03-14 22:59:05 UTC (rev 
309238)
@@ -402,16 +402,13 @@
 }
 /* }}} */

-static int php_accept_connect(php_socket *in_sock, php_socket **new_sock, 
struct sockaddr *la TSRMLS_DC) /* {{{ */
+static int php_accept_connect(php_socket *in_sock, php_socket **new_sock, 
struct sockaddr *la, socklen_t *la_len TSRMLS_DC) /* {{{ */
 {
-   socklen_t   salen;
php_socket  *out_sock = (php_socket*)emalloc(sizeof(php_socket));

*new_sock = out_sock;
-   salen = sizeof(*la);
-   out_sock-blocking = 1;

-   out_sock-bsd_socket = accept(in_sock-bsd_socket, la, salen);
+   out_sock-bsd_socket = accept(in_sock-bsd_socket, la, la_len);

if (IS_INVALID_SOCKET(out_sock)) {
PHP_SOCKET_ERROR(out_sock, unable to accept incoming 
connection, errno);
@@ -419,6 +416,10 @@
return 0;
}

+   out_sock-error = 0;
+   out_sock-blocking = 1;
+   out_sock-type = la-sa_family;
+
return 1;
 }
 /* }}} */
@@ -1023,9 +1024,10 @@
Accepts a connection on the listening socket fd */
 PHP_FUNCTION(socket_accept)
 {
-   zval*arg1;
-   php_socket  *php_sock, *new_sock;
-   struct sockaddr_in  sa;
+   zval *arg1;
+   php_socket   *php_sock, *new_sock;
+   php_sockaddr_storage sa;
+   socklen_tsa_len = sizeof(sa);

if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, r, arg1) == 
FAILURE) {
return;
@@ -1033,13 +1035,10 @@

ZEND_FETCH_RESOURCE(php_sock, php_socket *, arg1, -1, le_socket_name, 
le_socket);

-   if (!php_accept_connect(php_sock, new_sock, (struct sockaddr *) sa 
TSRMLS_CC)) {
+   if (!php_accept_connect(php_sock, new_sock, (struct sockaddr*)sa, 
sa_len TSRMLS_CC)) {
RETURN_FALSE;
}

-   new_sock-error = 0;
-   new_sock-blocking = 1;
-
ZEND_REGISTER_RESOURCE(return_value, new_sock, le_socket);
 }
 /* }}} */

Added: php/php-src/trunk/ext/sockets/tests/bug51958.phpt
===
--- php/php-src/trunk/ext/sockets/tests/bug51958.phpt   
(rev 0)
+++ php/php-src/trunk/ext/sockets/tests/bug51958.phpt   2011-03-14 22:59:05 UTC 
(rev 309238)
@@ -0,0 +1,22 @@
+--TEST--
+Bug #51958: socket_accept() fails on IPv6 server sockets
+--SKIPIF--
+?php
+if (!extension_loaded('sockets')) {
+die('skip sockets extension not available.');
+}
+if (!defined('IPPROTO_IPV6')) {
+   die('skip IPv6 not available.');
+}
+if (PHP_OS != WINNT)
+   die('skip test relies Winsock's error code for WSAEWOULDBLOCK/EAGAIN');
+--FILE--
+?php
+$listenfd = socket_create(AF_INET6, SOCK_STREAM, SOL_TCP);
+socket_bind($listenfd, ::1, 13579);
+socket_listen($listenfd);
+socket_set_nonblock($listenfd);
+$connfd = @socket_accept($listenfd);
+echo socket_last_error();
+--EXPECT--
+10035

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

[PHP-CVS] svn: /php/php-src/ branches/PHP_5_3/ext/phar/phar_object.c trunk/ext/phar/phar_object.c

2011-03-14 Thread Felipe Pena
felipe   Mon, 14 Mar 2011 13:54:41 +

Revision: http://svn.php.net/viewvc?view=revisionrevision=309221

Log:
- Fixed bug #54247 (format-string vulnerability on Phar)

Bug: http://bugs.php.net/54247 (error getting bug information)
  
Changed paths:
U   php/php-src/branches/PHP_5_3/ext/phar/phar_object.c
U   php/php-src/trunk/ext/phar/phar_object.c

Modified: php/php-src/branches/PHP_5_3/ext/phar/phar_object.c
===
--- php/php-src/branches/PHP_5_3/ext/phar/phar_object.c	2011-03-14 13:53:44 UTC (rev 309220)
+++ php/php-src/branches/PHP_5_3/ext/phar/phar_object.c	2011-03-14 13:54:41 UTC (rev 309221)
@@ -1141,7 +1141,7 @@
 	RETVAL_BOOL(phar_open_from_filename(fname, fname_len, alias, alias_len, REPORT_ERRORS, NULL, error TSRMLS_CC) == SUCCESS);

 	if (error) {
-		zend_throw_exception_ex(phar_ce_PharException, 0 TSRMLS_CC, error);
+		zend_throw_exception_ex(phar_ce_PharException, 0 TSRMLS_CC, %s, error);
 		efree(error);
 	}
 } /* }}} */
@@ -2007,7 +2007,7 @@
 		phar_flush(phar_obj-arc.archive, 0, 0, 0, error TSRMLS_CC);

 		if (error) {
-			zend_throw_exception_ex(phar_ce_PharException, 0 TSRMLS_CC, error);
+			zend_throw_exception_ex(phar_ce_PharException, 0 TSRMLS_CC, %s, error);
 			efree(error);
 		}

@@ -2070,7 +2070,7 @@
 		phar_obj-arc.archive-ufp = pass.fp;
 		phar_flush(phar_obj-arc.archive, 0, 0, 0, error TSRMLS_CC);
 		if (error) {
-			zend_throw_exception_ex(phar_ce_PharException, 0 TSRMLS_CC, error);
+			zend_throw_exception_ex(phar_ce_PharException, 0 TSRMLS_CC, %s, error);
 			efree(error);
 		}
 	} else {
@@ -2327,7 +2327,7 @@
 	phar_flush(phar, 0, 0, 1, error TSRMLS_CC);

 	if (error) {
-		zend_throw_exception_ex(spl_ce_BadMethodCallException, 0 TSRMLS_CC, error);
+		zend_throw_exception_ex(spl_ce_BadMethodCallException, 0 TSRMLS_CC, %s, error);
 		efree(error);
 		efree(oldpath);
 		return NULL;
@@ -2787,7 +2787,7 @@

 	phar_flush(phar_obj-arc.archive, NULL, 0, 0, error TSRMLS_CC);
 	if (error) {
-		zend_throw_exception_ex(phar_ce_PharException, 0 TSRMLS_CC, error);
+		zend_throw_exception_ex(phar_ce_PharException, 0 TSRMLS_CC, %s, error);
 		efree(error);
 	}

@@ -2862,7 +2862,7 @@
 efree(error);
 goto valid_alias;
 			}
-			zend_throw_exception_ex(phar_ce_PharException, 0 TSRMLS_CC, error);
+			zend_throw_exception_ex(phar_ce_PharException, 0 TSRMLS_CC, %s, error);
 			efree(error);
 			RETURN_FALSE;
 		}
@@ -2899,7 +2899,7 @@
 			phar_obj-arc.archive-alias = oldalias;
 			phar_obj-arc.archive-alias_len = oldalias_len;
 			phar_obj-arc.archive-is_temporary_alias = old_temp;
-			zend_throw_exception_ex(phar_ce_PharException, 0 TSRMLS_CC, error);
+			zend_throw_exception_ex(phar_ce_PharException, 0 TSRMLS_CC, %s, error);
 			if (readd) {
 zend_hash_add((PHAR_GLOBALS-phar_alias_map), oldalias, oldalias_len, (void*)(phar_obj-arc.archive), sizeof(phar_archive_data*), NULL);
 			}
@@ -2972,7 +2972,7 @@
 	phar_flush(phar_obj-arc.archive, 0, 0, 0, error TSRMLS_CC);

 	if (error) {
-		zend_throw_exception_ex(phar_ce_PharException, 0 TSRMLS_CC, error);
+		zend_throw_exception_ex(phar_ce_PharException, 0 TSRMLS_CC, %s, error);
 		efree(error);
 	}
 }
@@ -3021,7 +3021,7 @@
 			}
 			phar_flush(phar_obj-arc.archive, (char *) zstub, len, 0, error TSRMLS_CC);
 			if (error) {
-zend_throw_exception_ex(phar_ce_PharException, 0 TSRMLS_CC, error);
+zend_throw_exception_ex(phar_ce_PharException, 0 TSRMLS_CC, %s, error);
 efree(error);
 			}
 			RETURN_TRUE;
@@ -3037,7 +3037,7 @@
 		phar_flush(phar_obj-arc.archive, stub, stub_len, 0, error TSRMLS_CC);

 		if (error) {
-			zend_throw_exception_ex(phar_ce_PharException, 0 TSRMLS_CC, error);
+			zend_throw_exception_ex(phar_ce_PharException, 0 TSRMLS_CC, %s, error);
 			efree(error);
 		}

@@ -3098,7 +3098,7 @@
 		stub = phar_create_default_stub(index, webindex, stub_len, error TSRMLS_CC);

 		if (error) {
-			zend_throw_exception_ex(spl_ce_UnexpectedValueException, 0 TSRMLS_CC, error);
+			zend_throw_exception_ex(spl_ce_UnexpectedValueException, 0 TSRMLS_CC, %s, error);
 			efree(error);
 			if (stub) {
 efree(stub);
@@ -3120,7 +3120,7 @@
 	}

 	if (error) {
-		zend_throw_exception_ex(phar_ce_PharException, 0 TSRMLS_CC, error);
+		zend_throw_exception_ex(phar_ce_PharException, 0 TSRMLS_CC, %s, error);
 		efree(error);
 		RETURN_FALSE;
 	}
@@ -3175,7 +3175,7 @@

 			phar_flush(phar_obj-arc.archive, 0, 0, 0, error TSRMLS_CC);
 			if (error) {
-zend_throw_exception_ex(phar_ce_PharException, 0 TSRMLS_CC, error);
+zend_throw_exception_ex(phar_ce_PharException, 0 TSRMLS_CC, %s, error);
 efree(error);
 			}
 			break;
@@ -3477,7 +3477,7 @@
 	phar_flush(phar_obj-arc.archive, 0, 0, 0, error TSRMLS_CC);

 	if (error) {
-		zend_throw_exception_ex(spl_ce_BadMethodCallException, 0 TSRMLS_CC, error);
+		zend_throw_exception_ex(spl_ce_BadMethodCallException, 0 TSRMLS_CC, %s, error);
 		efree(error);
 	}
 }
@@ -3517,7 +3517,7 @@