[PHP-CVS] com php-src: Fix test: ext/spl/tests/RecursiveDirectoryIterator_getSubPath_basic.phpt

2012-09-30 Thread Xinchen Hui
Commit:175a9de47fcbb3807671415ae58429b20915daaf
Author:Xinchen Hui larue...@php.net Mon, 1 Oct 2012 00:15:47 +0800
Parents:   36c10242cd3babee807178def14485bd4b13bbc6
Branches:  PHP-5.4

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

Log:
Fix test

Changed paths:
  M  ext/spl/tests/RecursiveDirectoryIterator_getSubPath_basic.phpt


Diff:
diff --git a/ext/spl/tests/RecursiveDirectoryIterator_getSubPath_basic.phpt 
b/ext/spl/tests/RecursiveDirectoryIterator_getSubPath_basic.phpt
index 1602da5..f0b2b01 100644
--- a/ext/spl/tests/RecursiveDirectoryIterator_getSubPath_basic.phpt
+++ b/ext/spl/tests/RecursiveDirectoryIterator_getSubPath_basic.phpt
@@ -48,5 +48,3 @@ depth1
 depth1%cdepth2
 depth1%cdepth2
 depth1%cdepth2
-==DONE==
-


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



[PHP-CVS] com php-src: Remove meaningless md5 string Attempt to fix #63184: ext/spl/tests/RecursiveDirectoryIterator_getSubPath_basic.phpt ext/spl/tests/RecursiveDirectoryIterator_getSubPathname_ba

2012-09-29 Thread Xinchen Hui
Commit:36c10242cd3babee807178def14485bd4b13bbc6
Author:Xinchen Hui larue...@php.net Sat, 29 Sep 2012 14:38:29 
+0800
Parents:   f495e9305716a6b2ce448e56cf463169b196d08c
Branches:  PHP-5.4

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

Log:
Remove meaningless md5 string  Attempt to fix #63184

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

Changed paths:
  M  ext/spl/tests/RecursiveDirectoryIterator_getSubPath_basic.phpt
  M  ext/spl/tests/RecursiveDirectoryIterator_getSubPathname_basic.phpt


Diff:
diff --git a/ext/spl/tests/RecursiveDirectoryIterator_getSubPath_basic.phpt 
b/ext/spl/tests/RecursiveDirectoryIterator_getSubPath_basic.phpt
index a4b0073..1602da5 100644
--- a/ext/spl/tests/RecursiveDirectoryIterator_getSubPath_basic.phpt
+++ b/ext/spl/tests/RecursiveDirectoryIterator_getSubPath_basic.phpt
@@ -5,9 +5,9 @@ Pawel Krynicki pawel [dot] krynicki [at] xsolve [dot] pl
 #testfest AmsterdamPHP 2012-06-23
 --FILE--
 ?php
-$depth0 = md5('recursiveDirectoryIterator::getSubPath');
-$depth1 = md5('depth1');
-$depth2 = md5('depth2');
+$depth0 = depth0;
+$depth1 = 'depth1';
+$depth2 = 'depth2';
 $targetDir = __DIR__ . DIRECTORY_SEPARATOR . $depth0 . DIRECTORY_SEPARATOR . 
$depth1 . DIRECTORY_SEPARATOR . $depth2;
 mkdir($targetDir, 0777, true);
 touch($targetDir . DIRECTORY_SEPARATOR . 'getSubPath_test.tmp');
@@ -24,29 +24,29 @@ foreach ($list as $item) {
echo $item . \n;
 }
 ?
-==DONE==
 --CLEAN--
 ?php
 function rrmdir($dir) {
-   foreach(glob($dir . '/*') as $file) {
-  if(is_dir($file)) {
+foreach(glob($dir . '/*') as $file) {
+if(is_dir($file)) {
 rrmdir($file);
-  } else {
+} else {
 unlink($file);
-  }
-   }
+}
+}
 
-   rmdir($dir);
-   }
+rmdir($dir);
+}
 
-   $targetDir = 
__DIR__.DIRECTORY_SEPARATOR.md5('recursiveDirectoryIterator::getSubPath');
-   rrmdir($targetDir);
+$targetDir = __DIR__.DIRECTORY_SEPARATOR . depth0;
+rrmdir($targetDir);
 ?
 
 --EXPECTF--
-a0c967a6c2c34786e4802f59af9356f5
-a0c967a6c2c34786e4802f59af9356f5
-a0c967a6c2c34786e4802f59af9356f5%c9925aabb545352472e4d77942627b507
-a0c967a6c2c34786e4802f59af9356f5%c9925aabb545352472e4d77942627b507
-a0c967a6c2c34786e4802f59af9356f5%c9925aabb545352472e4d77942627b507
+depth1
+depth1
+depth1%cdepth2
+depth1%cdepth2
+depth1%cdepth2
 ==DONE==
+
diff --git a/ext/spl/tests/RecursiveDirectoryIterator_getSubPathname_basic.phpt 
b/ext/spl/tests/RecursiveDirectoryIterator_getSubPathname_basic.phpt
index 5c294a9..e08bd34 100644
--- a/ext/spl/tests/RecursiveDirectoryIterator_getSubPathname_basic.phpt
+++ b/ext/spl/tests/RecursiveDirectoryIterator_getSubPathname_basic.phpt
@@ -5,9 +5,9 @@ Pawel Krynicki pawel [dot] krynicki [at] xsolve [dot] pl
 #testfest AmsterdamPHP 2012-06-23
 --FILE--
 ?php
-$depth0 = md5('recursiveDirectoryIterator::getSubPathname');
-$depth1 = md5('depth1');
-$depth2 = md5('depth2');
+$depth0 = depth0;
+$depth1 = depth1;
+$depth2 = depth2;
 $targetDir = __DIR__ . DIRECTORY_SEPARATOR . $depth0 . DIRECTORY_SEPARATOR . 
$depth1 . DIRECTORY_SEPARATOR . $depth2;
 mkdir($targetDir, 0777, true);
 touch($targetDir . DIRECTORY_SEPARATOR . 'getSubPathname_test_2.tmp');
@@ -26,7 +26,6 @@ foreach ($list as $item) {
echo $item . \n;
 }
 ?
-==DONE==
 --CLEAN--
 ?php
 function rrmdir($dir) {
@@ -41,18 +40,17 @@ function rrmdir($dir) {
rmdir($dir);
 }
 
-$targetDir = __DIR__ . DIRECTORY_SEPARATOR . 
md5('recursiveDirectoryIterator::getSubPathname');
+$targetDir = __DIR__ . DIRECTORY_SEPARATOR . depth0;
 rrmdir($targetDir);
 ?
 --EXPECTF--
 .
-.
 ..
-a0c967a6c2c34786e4802f59af9356f5%c.
-a0c967a6c2c34786e4802f59af9356f5%c..
-a0c967a6c2c34786e4802f59af9356f5%c9925aabb545352472e4d77942627b507%c.
-a0c967a6c2c34786e4802f59af9356f5%c9925aabb545352472e4d77942627b507%c..
-a0c967a6c2c34786e4802f59af9356f5%c9925aabb545352472e4d77942627b507%cgetSubPathname_test_2.tmp
-a0c967a6c2c34786e4802f59af9356f5%cgetSubPathname_test_3.tmp
+..
+depth1%c.
+depth1%c..
+depth1%cdepth2%c.
+depth1%cdepth2%c..
+depth1%cdepth2%cgetSubPathname_test_2.tmp
+depth1%cgetSubPathname_test_3.tmp
 getSubPathname_test_1.tmp
-==DONE==


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



[PHP-CVS] com php-src: Correct the test summary: ext/standard/tests/general_functions/bug60723.phpt

2012-09-24 Thread Xinchen Hui
Commit:2cbc4053ae33245f8e13502ed289292aee19ef36
Author:Xinchen Hui larue...@php.net Mon, 24 Sep 2012 19:46:40 
+0800
Parents:   923511d364ad84500bb097aca15385129ce6e336
Branches:  PHP-5.3

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

Log:
Correct the test summary

Changed paths:
  M  ext/standard/tests/general_functions/bug60723.phpt


Diff:
diff --git a/ext/standard/tests/general_functions/bug60723.phpt 
b/ext/standard/tests/general_functions/bug60723.phpt
index cd73c8c..07b801b 100644
--- a/ext/standard/tests/general_functions/bug60723.phpt
+++ b/ext/standard/tests/general_functions/bug60723.phpt
@@ -1,5 +1,5 @@
 --TEST--
-Bug #55371 (get_magic_quotes_gpc() and get_magic_quotes_runtime() throw 
deprecated warning)
+Bug #60723  (error_log error time has changed to UTC ignoring default timezo)
 --INI--
 date.timezone=ASIA/Chongqing
 log_errors=On


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



[PHP-CVS] com php-src: Fixed bug #60723 (error_log error time has changed to UTC ignoring default timezo): NEWS ext/standard/tests/general_functions/bug60723.phpt main/main.c

2012-09-23 Thread Xinchen Hui
Commit:395d77c540a2d9d0745c8b4c75d60599c6e17c87
Author:Xinchen Hui larue...@php.net Sun, 23 Sep 2012 22:59:31 
+0800
Parents:   c8687ee63b0aa0cbe8da1e8d5c65a338eb69f83a
Branches:  PHP-5.4

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

Log:
Fixed bug #60723 (error_log error time has changed to UTC ignoring default 
timezo)

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

Changed paths:
  M  NEWS
  A  ext/standard/tests/general_functions/bug60723.phpt
  M  main/main.c


Diff:
diff --git a/NEWS b/NEWS
index 0082ae9..3a5cf66 100644
--- a/NEWS
+++ b/NEWS
@@ -24,6 +24,8 @@ PHP   
 NEWS
 situation). (Dmitry)
   . Fixed bug #60909 (custom error handler throwing Exception + fatal error
 = no shutdown function). (Dmitry)
+  . Fixed bug #60723 (error_log error time has changed to UTC ignoring default
+timezo). (Laruence)
 
 - DOM:
   . Fixed bug #63015 (Incorrect arginfo for DOMErrorHandler). (Rob)
diff --git a/ext/standard/tests/general_functions/bug60723.phpt 
b/ext/standard/tests/general_functions/bug60723.phpt
new file mode 100644
index 000..1d9ef6a
--- /dev/null
+++ b/ext/standard/tests/general_functions/bug60723.phpt
@@ -0,0 +1,17 @@
+--TEST--
+Bug #55371 (get_magic_quotes_gpc() and get_magic_quotes_runtime() throw 
deprecated warning)
+--INI--
+date.timezone=ASIA/Chongqing
+log_errors=On
+--FILE--
+?php
+$dir = dirname(__FILE__);
+$log = $dir . /tmp.err;
+ini_set(error_log, $log);
+echo $aa;
+readfile($log);
+unlink($log);
+?
+--EXPECTF--
+Notice: Undefined variable: aa in %sbug60723.php on line %d
+[%s ASIA/Chongqing] PHP Notice:  Undefined variable: aa in %sbug60723.php on 
line %d
diff --git a/main/main.c b/main/main.c
index 8d97581..44c61c6 100644
--- a/main/main.c
+++ b/main/main.c
@@ -628,7 +628,15 @@ PHPAPI void php_log_err(char *log_message TSRMLS_DC)
char *error_time_str;
 
time(error_time);
-   error_time_str = php_format_date(d-M-Y H:i:s e, 13, 
error_time, 0 TSRMLS_CC);
+#ifdef ZTS
+   if (!php_during_module_startup()) {
+   error_time_str = php_format_date(d-M-Y H:i:s 
e, 13, error_time, 1 TSRMLS_CC);
+   } else {
+   error_time_str = php_format_date(d-M-Y H:i:s 
e, 13, error_time, 0 TSRMLS_CC);
+   }
+#else
+   error_time_str = php_format_date(d-M-Y H:i:s e, 13, 
error_time, 1 TSRMLS_CC);
+#endif
len = spprintf(tmp, 0, [%s] %s%s, error_time_str, 
log_message, PHP_EOL);
 #ifdef PHP_WIN32
php_flock(fd, 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': main/main.c

2012-09-23 Thread Xinchen Hui
Commit:8fcb4f110794b14ebd9c46524fab1837a00a071f
Author:Xinchen Hui larue...@php.net Sun, 23 Sep 2012 23:00:15 
+0800
Parents:   5de79f9f0717d147b02033e270bea20561707db8 
395d77c540a2d9d0745c8b4c75d60599c6e17c87
Branches:  master

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

Log:
Merge branch 'PHP-5.4'

Changed paths:
  MM  main/main.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 #60723 (error_log error time has changed to UTC ignoring default timezo): ext/standard/tests/general_functions/bug60723.phpt main/main.c

2012-09-23 Thread Xinchen Hui
Commit:923511d364ad84500bb097aca15385129ce6e336
Author:Xinchen Hui larue...@php.net Sun, 23 Sep 2012 22:59:31 
+0800
Parents:   2e8ab65270e7d1ebe1ef0dfe13836c29d72c7010
Branches:  PHP-5.3

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

Log:
Fixed bug #60723 (error_log error time has changed to UTC ignoring default 
timezo)

Cherry pick to 5.3

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

Changed paths:
  A  ext/standard/tests/general_functions/bug60723.phpt
  M  main/main.c


Diff:
diff --git a/ext/standard/tests/general_functions/bug60723.phpt 
b/ext/standard/tests/general_functions/bug60723.phpt
new file mode 100644
index 000..cd73c8c
--- /dev/null
+++ b/ext/standard/tests/general_functions/bug60723.phpt
@@ -0,0 +1,19 @@
+--TEST--
+Bug #55371 (get_magic_quotes_gpc() and get_magic_quotes_runtime() throw 
deprecated warning)
+--INI--
+date.timezone=ASIA/Chongqing
+log_errors=On
+--FILE--
+?php
+$dir = dirname(__FILE__);
+$log = $dir . /tmp.err;
+ini_set(error_log, $log);
+echo $aa;
+error_log(dummy);
+readfile($log);
+unlink($log);
+?
+--EXPECTF--
+Notice: Undefined variable: aa in %sbug60723.php on line %d
+[%s ASIA/Chongqing] PHP Notice:  Undefined variable: aa in %sbug60723.php on 
line %d
+[%s ASIA/Chongqing] dummy
diff --git a/main/main.c b/main/main.c
index 6506e10..631a6a9 100644
--- a/main/main.c
+++ b/main/main.c
@@ -600,7 +600,15 @@ PHPAPI void php_log_err(char *log_message TSRMLS_DC)
char *error_time_str;
 
time(error_time);
-   error_time_str = php_format_date(d-M-Y H:i:s e, 13, 
error_time, 0 TSRMLS_CC);
+#ifdef ZTS
+   if (!php_during_module_startup()) {
+   error_time_str = php_format_date(d-M-Y H:i:s 
e, 13, error_time, 1 TSRMLS_CC);
+   } else {
+   error_time_str = php_format_date(d-M-Y H:i:s 
e, 13, error_time, 0 TSRMLS_CC);
+   }
+#else
+   error_time_str = php_format_date(d-M-Y H:i:s e, 13, 
error_time, 1 TSRMLS_CC);
+#endif
len = spprintf(tmp, 0, [%s] %s%s, error_time_str, 
log_message, PHP_EOL);
 #ifdef PHP_WIN32
php_flock(fd, 2);


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



[PHP-CVS] com php-src: Fixed bug #61442 (exception threw in __autoload can not be catched): NEWS Zend/tests/bug61442.phpt Zend/zend_vm_def.h Zend/zend_vm_execute.h

2012-09-19 Thread Xinchen Hui
Commit:fd0b3ea663431b7adaedde11668fbc0b6ba07494
Author:Xinchen Hui larue...@php.net Wed, 19 Sep 2012 19:40:59 
+0800
Parents:   6752f38ccca37213865f330a2f0dc49d834dc92e
Branches:  PHP-5.3

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

Log:
Fixed bug #61442 (exception threw in __autoload can not be catched)

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

Changed paths:
  M  NEWS
  A  Zend/tests/bug61442.phpt
  M  Zend/zend_vm_def.h
  M  Zend/zend_vm_execute.h

diff --git a/NEWS b/NEWS
index 181e66d..787d76d 100644
--- a/NEWS
+++ b/NEWS
@@ -9,6 +9,8 @@ PHP 
   NEWS
 some builtin classes). (Laruence)
   . Fixed bug #61767 (Shutdown functions not called in certain error
 situation). (Dmitry)
+  . Fixed bug #61442 (exception threw in __autoload can not be catched).
+(Laruence)
   . Fixed bug #60909 (custom error handler throwing Exception + fatal error
 = no shutdown function). (Dmitry)
 
diff --git a/Zend/tests/bug61442.phpt b/Zend/tests/bug61442.phpt
new file mode 100644
index 000..3af534f
--- /dev/null
+++ b/Zend/tests/bug61442.phpt
@@ -0,0 +1,30 @@
+--TEST--
+Bug #61442 (exception threw in __autoload can not be catched)
+--FILE--
+?php
+function __autoload($name) {
+throw new Exception(Unable to load $name);
+}
+
+try {
+$obj = new NonLoadableClass();
+} catch (Exception $e) {
+var_dump($e-getMessage());
+}
+
+try {
+$obj = NonLoadableClass::a();
+} catch (Exception $e) {
+var_dump($e-getMessage());
+}
+
+try {
+$obj = NonLoadableClass::UNDEFINED_CONST;
+} catch (Exception $e) {
+var_dump($e-getMessage());
+}
+
+--EXPECTF--
+string(31) Unable to load NonLoadableClass
+string(31) Unable to load NonLoadableClass
+string(31) Unable to load NonLoadableClass
diff --git a/Zend/zend_vm_def.h b/Zend/zend_vm_def.h
index 34020fb..22d77dd 100644
--- a/Zend/zend_vm_def.h
+++ b/Zend/zend_vm_def.h
@@ -1990,6 +1990,9 @@ ZEND_VM_HANDLER(113, ZEND_INIT_STATIC_METHOD_CALL, 
CONST|VAR, CONST|TMP|VAR|UNUS
if (OP1_TYPE == IS_CONST) {
/* no function found. try a static method in class */
ce = zend_fetch_class(Z_STRVAL(opline-op1.u.constant), 
Z_STRLEN(opline-op1.u.constant), opline-extended_value TSRMLS_CC);
+   if (UNEXPECTED(EG(exception) != NULL)) {
+   ZEND_VM_CONTINUE();
+   }
if (!ce) {
zend_error_noreturn(E_ERROR, Class '%s' not found, 
Z_STRVAL(opline-op1.u.constant));
}
@@ -3043,6 +3046,9 @@ ZEND_VM_HANDLER(99, ZEND_FETCH_CONSTANT, 
VAR|CONST|UNUSED, CONST)
if (OP1_TYPE == IS_CONST) {
 
ce = zend_fetch_class(Z_STRVAL(opline-op1.u.constant), 
Z_STRLEN(opline-op1.u.constant), opline-extended_value TSRMLS_CC);
+   if (UNEXPECTED(EG(exception) != NULL)) {
+   ZEND_VM_CONTINUE();
+   }
if (!ce) {
zend_error_noreturn(E_ERROR, Undefined class 
constant '%s', Z_STRVAL(opline-op2.u.constant));
}
diff --git a/Zend/zend_vm_execute.h b/Zend/zend_vm_execute.h
index 2889965..1481602 100644
--- a/Zend/zend_vm_execute.h
+++ b/Zend/zend_vm_execute.h
@@ -2688,6 +2688,9 @@ static int ZEND_FASTCALL  
ZEND_INIT_STATIC_METHOD_CALL_SPEC_CONST_CONST_HANDLER(
if (IS_CONST == IS_CONST) {
/* no function found. try a static method in class */
ce = zend_fetch_class(Z_STRVAL(opline-op1.u.constant), 
Z_STRLEN(opline-op1.u.constant), opline-extended_value TSRMLS_CC);
+   if (UNEXPECTED(EG(exception) != NULL)) {
+   ZEND_VM_CONTINUE();
+   }
if (!ce) {
zend_error_noreturn(E_ERROR, Class '%s' not found, 
Z_STRVAL(opline-op1.u.constant));
}
@@ -2836,6 +2839,9 @@ static int ZEND_FASTCALL  
ZEND_FETCH_CONSTANT_SPEC_CONST_CONST_HANDLER(ZEND_OPCO
if (IS_CONST == IS_CONST) {
 
ce = zend_fetch_class(Z_STRVAL(opline-op1.u.constant), 
Z_STRLEN(opline-op1.u.constant), opline-extended_value TSRMLS_CC);
+   if (UNEXPECTED(EG(exception) != NULL)) {
+   ZEND_VM_CONTINUE();
+   }
if (!ce) {
zend_error_noreturn(E_ERROR, Undefined class 
constant '%s', Z_STRVAL(opline-op2.u.constant));
}
@@ -3259,6 +3265,9 @@ static int ZEND_FASTCALL  
ZEND_INIT_STATIC_METHOD_CALL_SPEC_CONST_TMP_HANDLER(ZE
if (IS_CONST == IS_CONST) {
/* no function found. try a static method in class */
ce = zend_fetch_class(Z_STRVAL(opline-op1.u.constant), 
Z_STRLEN(opline-op1.u.constant), opline-extended_value TSRMLS_CC

[PHP-CVS] com php-src: Fixed Bug #63103 (ext\curl\tests\bug62839.phpt broken): ext/curl/tests/bug62839.phpt

2012-09-17 Thread Xinchen Hui
Commit:e66a5ce56fc9be74096e0d0452a1172c8130752c
Author:Xinchen Hui larue...@php.net Tue, 18 Sep 2012 10:46:58 
+0800
Parents:   eb881a1dd1d0b50e304556f854ec5d66e79ef50b
Branches:  PHP-5.3

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

Log:
Fixed Bug #63103 (ext\curl\tests\bug62839.phpt broken)

Bugs:
https://bugs.php.net/63103
https://bugs.php.net/62839

Changed paths:
  M  ext/curl/tests/bug62839.phpt


Diff:
diff --git a/ext/curl/tests/bug62839.phpt b/ext/curl/tests/bug62839.phpt
index 39e6fc9..e6988d6 100644
--- a/ext/curl/tests/bug62839.phpt
+++ b/ext/curl/tests/bug62839.phpt
@@ -7,7 +7,7 @@ Bug #62839 (curl_copy_handle segfault with CURLOPT_FILE)
 ?php
 $curl = curl_init();
 
-$fd = fopen('/tmp/test', 'wb');
+$fd = tmpfile();
 curl_setopt($curl, CURLOPT_FILE, $fd);
 
 curl_copy_handle($curl);


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



[PHP-CVS] com php-src: test should fail: ext/date/tests/bug62852.phpt

2012-09-16 Thread Xinchen Hui
Commit:eb881a1dd1d0b50e304556f854ec5d66e79ef50b
Author:Xinchen Hui larue...@php.net Mon, 17 Sep 2012 11:20:24 
+0800
Parents:   4c6678d6058fd740a9e186b49f9daa72d09ed300
Branches:  PHP-5.3

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

Log:
test should fail

Changed paths:
  M  ext/date/tests/bug62852.phpt


Diff:
diff --git a/ext/date/tests/bug62852.phpt b/ext/date/tests/bug62852.phpt
index 2c23138..26de510 100644
--- a/ext/date/tests/bug62852.phpt
+++ b/ext/date/tests/bug62852.phpt
@@ -29,5 +29,8 @@ try {
 unserialize( $s2 );
 } catch ( Exception $e ) {}
 var_dump( $foo );
+
+echo okey;
 ?
 --EXPECTF--
+okey


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



[PHP-CVS] com php-src: Add XFAIL test for bug #62852: NEWS ext/date/tests/bug62852.phpt

2012-09-14 Thread Xinchen Hui
Commit:1b13ff6ec796052ed1b5315f8651b633a617
Author:Xinchen Hui larue...@php.net Sat, 15 Sep 2012 11:29:47 
+0800
Parents:   e766f85405cd936a07a30a045f419199b6c02ed7
Branches:  PHP-5.3

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

Log:
Add XFAIL test for bug #62852

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

Changed paths:
  M  NEWS
  A  ext/date/tests/bug62852.phpt


Diff:
diff --git a/NEWS b/NEWS
index c9d1f0e..7e52997 100644
--- a/NEWS
+++ b/NEWS
@@ -37,10 +37,6 @@ PHP  
  NEWS
 - CURL:
   . Fixed bug #62839 (curl_copy_handle segfault with CURLOPT_FILE). (Pierrick)
 
-- DateTime:
-  . Fixed bug #62852 (Unserialize invalid DateTime causes crash).
-(reeze@gmail.com)
-
 - Intl:
   . Fix null pointer dereferences in some classes of ext/intl. (Gustavo)
 
diff --git a/ext/date/tests/bug62852.phpt b/ext/date/tests/bug62852.phpt
new file mode 100644
index 000..2c23138
--- /dev/null
+++ b/ext/date/tests/bug62852.phpt
@@ -0,0 +1,33 @@
+--TEST--
+Bug #62852 (Unserialize invalid DateTime causes crash)
+--INI--
+date.timezone=GMT
+--XFAIL--
+bug is not fixed yet
+--FILE--
+?php
+$s1 = 'O:8:DateTime:3:{s:4:date;s:20:10007-06-07 
03:51:49;s:13:timezone_type;i:3;s:8:timezone;s:3:UTC;}';
+$s2 = 'O:3:Foo:3:{s:4:date;s:20:10007-06-07 
03:51:49;s:13:timezone_type;i:3;s:8:timezone;s:3:UTC;}';
+
+global $foo;
+
+class Foo extends DateTime {
+function __wakeup() {
+global $foo;
+$foo = $this;
+parent::__wakeup();
+}
+}
+
+// Old test case
+try {
+unserialize( $s1 );
+} catch ( Exception $e ) {}
+
+// My test case
+try {
+unserialize( $s2 );
+} catch ( Exception $e ) {}
+var_dump( $foo );
+?
+--EXPECTF--


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



[PHP-CVS] com php-src: Revert Fixed bug #62852 (Unserialize invalid DateTime causes crash): ext/date/php_date.c ext/date/tests/bug62852.phpt

2012-09-14 Thread Xinchen Hui
Commit:e766f85405cd936a07a30a045f419199b6c02ed7
Author:Xinchen Hui larue...@php.net Sat, 15 Sep 2012 11:26:21 
+0800
Parents:   30981836fa84323d49b2c90bbd805348d58021e4
Branches:  PHP-5.3

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

Log:
Revert Fixed bug #62852 (Unserialize invalid DateTime causes crash)

see: http://news.php.net/php.bugs/173451

This reverts commit 46a3f257724df7b85cc8c3e6374c36ed9ee783b4.

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

Changed paths:
  M  ext/date/php_date.c
  D  ext/date/tests/bug62852.phpt


Diff:
diff --git a/ext/date/php_date.c b/ext/date/php_date.c
index d9e6a28..e8a4570 100644
--- a/ext/date/php_date.c
+++ b/ext/date/php_date.c
@@ -2544,9 +2544,6 @@ static int php_date_initialize_from_hash(zval 
**return_value, php_date_obj **dat
if (zend_hash_find(myht, timezone_type, 14, (void**) 
z_timezone_type) == SUCCESS) {
convert_to_long(*z_timezone_type);
if (zend_hash_find(myht, timezone, 9, (void**) 
z_timezone) == SUCCESS) {
-   zend_error_handling error_handling;
-
-   zend_replace_error_handling(EH_THROW, NULL, 
error_handling TSRMLS_CC);
convert_to_string(*z_timezone);
 
switch (Z_LVAL_PP(z_timezone_type)) {
@@ -2554,9 +2551,9 @@ static int php_date_initialize_from_hash(zval 
**return_value, php_date_obj **dat
case TIMELIB_ZONETYPE_ABBR: {
char *tmp = 
emalloc(Z_STRLEN_PP(z_date) + Z_STRLEN_PP(z_timezone) + 2);
snprintf(tmp, 
Z_STRLEN_PP(z_date) + Z_STRLEN_PP(z_timezone) + 2, %s %s, 
Z_STRVAL_PP(z_date), Z_STRVAL_PP(z_timezone));
-   php_date_initialize(*dateobj, 
tmp, Z_STRLEN_PP(z_date) + Z_STRLEN_PP(z_timezone) + 1, NULL, NULL, 1 
TSRMLS_CC);
+   php_date_initialize(*dateobj, 
tmp, Z_STRLEN_PP(z_date) + Z_STRLEN_PP(z_timezone) + 1, NULL, NULL, 0 
TSRMLS_CC);
efree(tmp);
-   break;
+   return 1;
}
 
case TIMELIB_ZONETYPE_ID:
@@ -2570,15 +2567,10 @@ static int php_date_initialize_from_hash(zval 
**return_value, php_date_obj **dat
tzobj-tzi.tz = tzi;
tzobj-initialized = 1;
 
-   php_date_initialize(*dateobj, 
Z_STRVAL_PP(z_date), Z_STRLEN_PP(z_date), NULL, tmp_obj, 1 TSRMLS_CC);
+   php_date_initialize(*dateobj, 
Z_STRVAL_PP(z_date), Z_STRLEN_PP(z_date), NULL, tmp_obj, 0 TSRMLS_CC);
zval_ptr_dtor(tmp_obj);
-   break;
-   default:
-   
zend_restore_error_handling(error_handling TSRMLS_CC);
-   return 0;
+   return 1;
}
-   zend_restore_error_handling(error_handling 
TSRMLS_CC);
-   return 1;
}
}
}
diff --git a/ext/date/tests/bug62852.phpt b/ext/date/tests/bug62852.phpt
deleted file mode 100644
index 6426a80..000
--- a/ext/date/tests/bug62852.phpt
+++ /dev/null
@@ -1,15 +0,0 @@
---TEST--
-Bug #62852 (Unserialize invalid DateTime causes crash)
---INI--
-date.timezone=GMT
---FILE--
-?php
-try {
-   $datetime = unserialize('O:8:DateTime:3:{s:4:date;s:20:10007-06-07 
03:51:49;s:13:timezone_type;i:3;s:8:timezone;s:3:UTC;}');
-   var_dump($datetime);
-} catch (Exception $e) {
-var_dump($e-getMessage());
-}
-?
---EXPECTF--
-string(%d) DateTime::__wakeup(): Failed to parse time string (%s) at position 
12 (0): Double time specification


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



[PHP-CVS] com php-src: Remove bug fixed entry: NEWS

2012-09-14 Thread Xinchen Hui
Commit:7609fb433afaef3b2d0279c673481f879842e92a
Author:Xinchen Hui larue...@php.net Sat, 15 Sep 2012 11:32:44 
+0800
Parents:   2eff69f40231890531e440ae92f633fbbbd0d5bd
Branches:  PHP-5.4

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

Log:
Remove bug fixed entry

Changed paths:
  M  NEWS


Diff:
diff --git a/NEWS b/NEWS
index db6f7f4..a7441a5 100644
--- a/NEWS
+++ b/NEWS
@@ -58,10 +58,6 @@ PHP  
  NEWS
(Pierrick)
   . Fixed bug #62839 (curl_copy_handle segfault with CURLOPT_FILE). (Pierrick)
 
-- DateTime:
-  . Fixed bug #62852 (Unserialize invalid DateTime causes crash).
-(reeze@gmail.com)
-
 - Intl:
   . Fixed Spoofchecker not being registered on ICU 49.1. (Gustavo)
   . Fix bug #62933 (ext/intl compilation error on icu 3.4.1). (Gustavo)


--
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.3' into PHP-5.4: ext/date/php_date.c

2012-09-14 Thread Xinchen Hui
Commit:2eff69f40231890531e440ae92f633fbbbd0d5bd
Author:Xinchen Hui larue...@php.net Sat, 15 Sep 2012 11:32:08 
+0800
Parents:   3b38d14caf24233ed476e4892f53ffd858d1ae3f 
1b13ff6ec796052ed1b5315f8651b633a617
Branches:  PHP-5.4

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

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

Changed paths:
  MM  ext/date/php_date.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.4': ext/date/php_date.c

2012-09-14 Thread Xinchen Hui
Commit:d23f9194b171443cc0ff40e34915df3e73f1c486
Author:Xinchen Hui larue...@php.net Sat, 15 Sep 2012 11:33:26 
+0800
Parents:   b7fa9bfc044f8b1499aaabf0ec725b20b63a33d2 
7609fb433afaef3b2d0279c673481f879842e92a
Branches:  master

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

Log:
Merge branch 'PHP-5.4'

Changed paths:
  MM  ext/date/php_date.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 #63093 (Segfault while load extension failed in zts-build).: NEWS Zend/zend_API.c

2012-09-14 Thread Xinchen Hui
Commit:4c6678d6058fd740a9e186b49f9daa72d09ed300
Author:Xinchen Hui larue...@php.net Sat, 15 Sep 2012 11:50:16 
+0800
Parents:   1b13ff6ec796052ed1b5315f8651b633a617
Branches:  PHP-5.3

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

Log:
Fixed bug #63093 (Segfault while load extension failed in zts-build).

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

Changed paths:
  M  NEWS
  M  Zend/zend_API.c


Diff:
diff --git a/NEWS b/NEWS
index 7e52997..181e66d 100644
--- a/NEWS
+++ b/NEWS
@@ -3,6 +3,8 @@ PHP 
   NEWS
 ?? ??? 2012, PHP 5.3.18
 
 - Core:
+  . Fixed bug #63093 (Segfault while load extension failed in zts-build).
+(Laruence)
   . Fixed bug #62976 (Notice: could not be converted to int when comparing
 some builtin classes). (Laruence)
   . Fixed bug #61767 (Shutdown functions not called in certain error
diff --git a/Zend/zend_API.c b/Zend/zend_API.c
index 70cf0c7..cf96743 100644
--- a/Zend/zend_API.c
+++ b/Zend/zend_API.c
@@ -2122,7 +2122,9 @@ void module_destructor(zend_module_entry *module) /* {{{ 
*/
/* Deinitilaise module globals */
if (module-globals_size) {
 #ifdef ZTS
-   ts_free_id(*module-globals_id_ptr);
+   if (*module-globals_id_ptr) {
+   ts_free_id(*module-globals_id_ptr);
+   }
 #else
if (module-globals_dtor) {
module-globals_dtor(module-globals_ptr TSRMLS_CC);


--
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.3' into PHP-5.4: NEWS Zend/zend_API.c

2012-09-14 Thread Xinchen Hui
Commit:ee620e96736024218f50a6ff5267127509fd68d8
Author:Xinchen Hui larue...@php.net Sat, 15 Sep 2012 11:50:49 
+0800
Parents:   7609fb433afaef3b2d0279c673481f879842e92a 
4c6678d6058fd740a9e186b49f9daa72d09ed300
Branches:  PHP-5.4

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

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

Changed paths:
  MM  NEWS
  MM  Zend/zend_API.c


Diff:
diff --cc NEWS
index a7441a5,181e66d..c3d1510
--- a/NEWS
+++ b/NEWS
@@@ -1,15 -1,12 +1,17 @@@
  PHP
NEWS
  
|||
 -?? ??? 2012, PHP 5.3.18
 +?? ??? 2012, PHP 5.4.8
  
  - Core:
+   . Fixed bug #63093 (Segfault while load extension failed in zts-build).
+ (Laruence)
 +  . Added optional second argument for assert() to specify custom message. 
Patch
 +by Lonny Kapelushnik (lo...@lonnylot.com). (Lars)
. Fixed bug #62976 (Notice: could not be converted to int when comparing
  some builtin classes). (Laruence)
 +  . Fixed bug #62955 (Only one directive is loaded from Per Directory 
Values 
 +Windows registry). (aserbulov at parallels dot com)
 +  . Fixed bug #62907 (Double free when use traits). (Dmitry)
. Fixed bug #61767 (Shutdown functions not called in certain error
  situation). (Dmitry)
. Fixed bug #60909 (custom error handler throwing Exception + fatal error


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



[PHP-CVS] com php-src: Rearrange the codes, remove empty lines: ext/date/php_date.c

2012-09-11 Thread Xinchen Hui
Commit:79e6635cb66a9efd47d48012bafe00f2897b0814
Author:Xinchen Hui larue...@php.net Tue, 11 Sep 2012 18:02:19 
+0800
Parents:   0146efbd4108eab809d1f0d70b46691c229e0315
Branches:  master

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

Log:
Rearrange the codes, remove empty lines

Changed paths:
  M  ext/date/php_date.c


Diff:
diff --git a/ext/date/php_date.c b/ext/date/php_date.c
index eac6ca5..e43ff19 100644
--- a/ext/date/php_date.c
+++ b/ext/date/php_date.c
@@ -738,7 +738,6 @@ PHP_RSHUTDOWN_FUNCTION(date)
 #define SUNFUNCS_RET_STRING1
 #define SUNFUNCS_RET_DOUBLE2
 
-
 /* {{{ PHP_MINIT_FUNCTION */
 PHP_MINIT_FUNCTION(date)
 {
@@ -860,9 +859,10 @@ static char* guess_timezone(const timelib_tzdb *tzdb 
TSRMLS_DC)
timelib_timezone_id_is_valid(Z_STRVAL(ztz), tzdb)) {
return Z_STRVAL(ztz);
}
-   } else if (*DATEG(default_timezone)  
timelib_timezone_id_is_valid(DATEG(default_timezone), tzdb)) {
-   return DATEG(default_timezone);
} else if (*DATEG(default_timezone)) {
+   if (timelib_timezone_id_is_valid(DATEG(default_timezone), 
tzdb)) {
+   return DATEG(default_timezone);
+   }
/* Invalid date.timezone value */
php_error_docref(NULL TSRMLS_CC, E_WARNING, date.timezone 
value '%s' is invalid. We selected the timezone 'UTC' for now., 
DATEG(default_timezone));
} else {
@@ -887,7 +887,6 @@ PHPAPI timelib_tzinfo *get_timezone_info(TSRMLS_D)
 }
 /* }}} */
 
-
 /* {{{ date() and gmdate() data */
 #include ext/standard/php_smart_str.h
 
@@ -1323,7 +1322,6 @@ PHPAPI signed long php_parse_date(char *string, signed 
long *now)
 }
 /* }}} */
 
-
 /* {{{ proto int strtotime(string time [, int now ])
Convert string representation of date and time to a timestamp */
 PHP_FUNCTION(strtotime)
@@ -1384,7 +1382,6 @@ PHP_FUNCTION(strtotime)
 }
 /* }}} */
 
-
 /* {{{ php_mktime - (gm)mktime helper */
 PHPAPI void php_mktime(INTERNAL_FUNCTION_PARAMETERS, int gmt)
 {
@@ -1493,7 +1490,6 @@ PHP_FUNCTION(gmmktime)
 }
 /* }}} */
 
-
 /* {{{ proto bool checkdate(int month, int day, int year)
Returns true(1) if it is a valid date in gregorian calendar */
 PHP_FUNCTION(checkdate)


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



[PHP-CVS] com php-src: Provide a specific error message if date.timezone value is invalid.: ext/date/php_date.c ext/date/tests/date_default_timezone_get-4.phpt

2012-09-11 Thread Xinchen Hui
Commit:e06c47ca2ab482ab5e6ba47a9249a9b9417cb1b4
Author:Simon Welsh si...@simon.geek.nz Tue, 11 Sep 2012 21:14:51 
+1200
Parents:   328a3d9f1384d3555833345dbe879e4d99922a35
Branches:  master

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

Log:
Provide a specific error message if date.timezone value is invalid.

Changed paths:
  M  ext/date/php_date.c
  A  ext/date/tests/date_default_timezone_get-4.phpt


Diff:
diff --git a/ext/date/php_date.c b/ext/date/php_date.c
index 7c4e782..eac6ca5 100644
--- a/ext/date/php_date.c
+++ b/ext/date/php_date.c
@@ -862,9 +862,14 @@ static char* guess_timezone(const timelib_tzdb *tzdb 
TSRMLS_DC)
}
} else if (*DATEG(default_timezone)  
timelib_timezone_id_is_valid(DATEG(default_timezone), tzdb)) {
return DATEG(default_timezone);
+   } else if (*DATEG(default_timezone)) {
+   /* Invalid date.timezone value */
+   php_error_docref(NULL TSRMLS_CC, E_WARNING, date.timezone 
value '%s' is invalid. We selected the timezone 'UTC' for now., 
DATEG(default_timezone));
+   } else {
+   /* No date.timezone value */
+   php_error_docref(NULL TSRMLS_CC, E_WARNING, DATE_TZ_ERRMSG We 
selected the timezone 'UTC' for now, but please set date.timezone to select 
your timezone.);
}
/* Fallback to UTC */
-   php_error_docref(NULL TSRMLS_CC, E_WARNING, DATE_TZ_ERRMSG We selected 
the timezone 'UTC' for now, but please set date.timezone to select your 
timezone.);
return UTC;
 }
 
diff --git a/ext/date/tests/date_default_timezone_get-4.phpt 
b/ext/date/tests/date_default_timezone_get-4.phpt
new file mode 100644
index 000..e76d4e3
--- /dev/null
+++ b/ext/date/tests/date_default_timezone_get-4.phpt
@@ -0,0 +1,11 @@
+--TEST--
+date_default_timezone_get() function [4]
+--INI--
+date.timezone=Incorrect/Zone
+--FILE--
+?php
+   echo date_default_timezone_get(), \n;
+?
+--EXPECTF--
+Warning: date_default_timezone_get(): date.timezone value 'Incorrect/Zone' is 
invalid. We selected the timezone 'UTC' for now. in 
%sdate_default_timezone_get-4.php on line %d
+UTC


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



[PHP-CVS] com php-src: Capitalize the warning message: ext/date/php_date.c ext/date/tests/date_default_timezone_get-4.phpt

2012-09-11 Thread Xinchen Hui
Commit:f6000a01e286f855a7f40fcad738a1f9b00aa81e
Author:Xinchen Hui larue...@php.net Tue, 11 Sep 2012 18:09:47 
+0800
Parents:   79e6635cb66a9efd47d48012bafe00f2897b0814
Branches:  master

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

Log:
Capitalize the warning message

Changed paths:
  M  ext/date/php_date.c
  M  ext/date/tests/date_default_timezone_get-4.phpt


Diff:
diff --git a/ext/date/php_date.c b/ext/date/php_date.c
index e43ff19..765da9e 100644
--- a/ext/date/php_date.c
+++ b/ext/date/php_date.c
@@ -864,7 +864,7 @@ static char* guess_timezone(const timelib_tzdb *tzdb 
TSRMLS_DC)
return DATEG(default_timezone);
}
/* Invalid date.timezone value */
-   php_error_docref(NULL TSRMLS_CC, E_WARNING, date.timezone 
value '%s' is invalid. We selected the timezone 'UTC' for now., 
DATEG(default_timezone));
+   php_error_docref(NULL TSRMLS_CC, E_WARNING, Invalid 
date.timezone value '%s', we selected the timezone 'UTC' for now., 
DATEG(default_timezone));
} else {
/* No date.timezone value */
php_error_docref(NULL TSRMLS_CC, E_WARNING, DATE_TZ_ERRMSG We 
selected the timezone 'UTC' for now, but please set date.timezone to select 
your timezone.);
diff --git a/ext/date/tests/date_default_timezone_get-4.phpt 
b/ext/date/tests/date_default_timezone_get-4.phpt
index e76d4e3..6d1982b 100644
--- a/ext/date/tests/date_default_timezone_get-4.phpt
+++ b/ext/date/tests/date_default_timezone_get-4.phpt
@@ -7,5 +7,5 @@ date.timezone=Incorrect/Zone
echo date_default_timezone_get(), \n;
 ?
 --EXPECTF--
-Warning: date_default_timezone_get(): date.timezone value 'Incorrect/Zone' is 
invalid. We selected the timezone 'UTC' for now. in 
%sdate_default_timezone_get-4.php on line %d
+Warning: date_default_timezone_get(): Invalid date.timezone value 
'Incorrect/Zone', we selected the timezone 'UTC' for now. in 
%sdate_default_timezone_get-4.php on line %d
 UTC


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



[PHP-CVS] com php-src: Fix the wrong use of snprintf which is introduced in 1d2f61904987133d542c68cd349cf313d0bef1c8: ext/fileinfo/libmagic.patch ext/fileinfo/libmagic/apprentice.c

2012-09-10 Thread Xinchen Hui
Commit:0a25a0241ed1c90b83d71b94a45b841e74e68c98
Author:Xinchen Hui larue...@php.net Mon, 10 Sep 2012 23:08:54 
+0800
Parents:   62d86209cf83b6b1288b0c7567ace45b5be6025b
Branches:  PHP-5.4

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

Log:
Fix the wrong use of snprintf which is introduced in 
1d2f61904987133d542c68cd349cf313d0bef1c8

Changed paths:
  M  ext/fileinfo/libmagic.patch
  M  ext/fileinfo/libmagic/apprentice.c


Diff:
diff --git a/ext/fileinfo/libmagic.patch b/ext/fileinfo/libmagic.patch
index 30364fb..1fc656e 100644
--- a/ext/fileinfo/libmagic.patch
+++ b/ext/fileinfo/libmagic.patch
@@ -316,8 +316,6 @@ diff -u libmagic.origin/apprentice.c libmagic/apprentice.c
  apprentice_load(struct magic_set *ms, struct magic **magicp, uint32_t 
*nmagicp,
  const char *fn, int action)
  {
--  int errs = 0;
-+  int errs = 0, mflen = 0;
struct magic_entry *marray;
uint32_t marraycount, i, mentrycount = 0, starttest;
 -  size_t slen, files = 0, maxfiles = 0;
@@ -356,7 +354,7 @@ diff -u libmagic.origin/apprentice.c libmagic/apprentice.c
}
while ((d = readdir(dir)) != NULL) {
 -  if (asprintf(mfn, %s/%s, fn, d-d_name)  0) {
-+  if ((mflen = snprintf(mfn, sizeof(mfn), %s/%s, fn, 
d-d_name))  0) {
++  if (snprintf(mfn, sizeof(mfn), %s/%s, fn, d-d_name) 
 0) {
file_oomem(ms,
strlen(fn) + strlen(d-d_name) + 2);
errs++;
@@ -379,7 +377,7 @@ diff -u libmagic.origin/apprentice.c libmagic/apprentice.c
}
}
 -  filearr[files++] = mfn;
-+  filearr[files++] = estrndup(mfn, mflen);
++  filearr[files++] = estrndup(mfn);
}
closedir(dir);
qsort(filearr, files, sizeof(*filearr), cmpstrp);
diff --git a/ext/fileinfo/libmagic/apprentice.c 
b/ext/fileinfo/libmagic/apprentice.c
index 98bde27..f5f9939 100644
--- a/ext/fileinfo/libmagic/apprentice.c
+++ b/ext/fileinfo/libmagic/apprentice.c
@@ -753,7 +753,7 @@ private int
 apprentice_load(struct magic_set *ms, struct magic **magicp, uint32_t *nmagicp,
 const char *fn, int action)
 {
-   int errs = 0, mflen = 0;
+   int errs = 0;
struct magic_entry *marray;
uint32_t marraycount, i, mentrycount = 0, starttest;
size_t files = 0, maxfiles = 0;
@@ -782,7 +782,7 @@ apprentice_load(struct magic_set *ms, struct magic 
**magicp, uint32_t *nmagicp,
goto out;
}
while ((d = readdir(dir)) != NULL) {
-   if ((mflen = snprintf(mfn, sizeof(mfn), %s/%s, fn, 
d-d_name))  0) {
+   if (snprintf(mfn, sizeof(mfn), %s/%s, fn, d-d_name) 
 0) {
file_oomem(ms,
strlen(fn) + strlen(d-d_name) + 2);
errs++;
@@ -804,7 +804,7 @@ apprentice_load(struct magic_set *ms, struct magic 
**magicp, uint32_t *nmagicp,
goto out;
}
}
-   filearr[files++] = estrndup(mfn, mflen);
+   filearr[files++] = estrdup(mfn);
}
closedir(dir);
qsort(filearr, files, sizeof(*filearr), cmpstrp);


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



[PHP-CVS] com php-src: regenerate patch, and save a strlen: ext/fileinfo/libmagic.patch ext/fileinfo/libmagic/apprentice.c

2012-09-10 Thread Xinchen Hui
Commit:328a3d9f1384d3555833345dbe879e4d99922a35
Author:Xinchen Hui larue...@php.net Tue, 11 Sep 2012 11:43:47 
+0800
Parents:   0a25a0241ed1c90b83d71b94a45b841e74e68c98
Branches:  PHP-5.4

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

Log:
regenerate patch, and save a strlen

Changed paths:
  M  ext/fileinfo/libmagic.patch
  M  ext/fileinfo/libmagic/apprentice.c

diff --git a/ext/fileinfo/libmagic.patch b/ext/fileinfo/libmagic.patch
index 1fc656e..15f6a6d 100644
--- a/ext/fileinfo/libmagic.patch
+++ b/ext/fileinfo/libmagic.patch
@@ -1,6 +1,6 @@
 diff -u libmagic.origin/apprentice.c libmagic/apprentice.c
 libmagic.origin/apprentice.c   2012-07-15 18:17:24.802087661 +0800
-+++ libmagic/apprentice.c  2012-07-15 18:22:49.650087425 +0800
+--- libmagic.origin/apprentice.c   2012-09-11 11:09:26.0 +0800
 libmagic/apprentice.c  2012-09-11 11:36:51.0 +0800
 @@ -29,6 +29,8 @@
   * apprentice - make one pass through /etc/magic, learning its secrets.
   */
@@ -316,12 +316,14 @@ diff -u libmagic.origin/apprentice.c libmagic/apprentice.c
  apprentice_load(struct magic_set *ms, struct magic **magicp, uint32_t 
*nmagicp,
  const char *fn, int action)
  {
+-  int errs = 0;
++  int errs = 0; 
struct magic_entry *marray;
uint32_t marraycount, i, mentrycount = 0, starttest;
 -  size_t slen, files = 0, maxfiles = 0;
 -  char **filearr = NULL, *mfn;
 +  size_t files = 0, maxfiles = 0;
-+  char **filearr = NULL, mfn[MAXPATHLEN];
++  char **filearr = NULL;
struct stat st;
DIR *dir;
struct dirent *d;
@@ -339,7 +341,7 @@ diff -u libmagic.origin/apprentice.c libmagic/apprentice.c
marraycount = 0;
  
/* print silly verbose header for USG compat. */
-@@ -778,14 +773,16 @@
+@@ -778,14 +773,18 @@
(void)fprintf(stderr, %s\n, usg_hdr);
  
/* load directory or file */
@@ -347,6 +349,8 @@ diff -u libmagic.origin/apprentice.c libmagic/apprentice.c
 +/* FIXME: Read file names and sort them to prevent
 +   non-determinism. See Debian bug #488562. */
 +  if (php_sys_stat(fn, st) == 0  S_ISDIR(st.st_mode)) {
++int mflen;
++char mfn[MAXPATHLEN];
dir = opendir(fn);
if (!dir) {
errs++;
@@ -354,11 +358,11 @@ diff -u libmagic.origin/apprentice.c libmagic/apprentice.c
}
while ((d = readdir(dir)) != NULL) {
 -  if (asprintf(mfn, %s/%s, fn, d-d_name)  0) {
-+  if (snprintf(mfn, sizeof(mfn), %s/%s, fn, d-d_name) 
 0) {
++  if ((mflen = snprintf(mfn, sizeof(mfn), %s/%s, fn, 
d-d_name))  0) {
file_oomem(ms,
strlen(fn) + strlen(d-d_name) + 2);
errs++;
-@@ -793,7 +790,6 @@
+@@ -793,7 +792,6 @@
goto out;
}
if (stat(mfn, st) == -1 || !S_ISREG(st.st_mode)) {
@@ -366,7 +370,7 @@ diff -u libmagic.origin/apprentice.c libmagic/apprentice.c
continue;
}
if (files = maxfiles) {
-@@ -803,20 +799,19 @@
+@@ -803,20 +801,19 @@
if ((filearr = CAST(char **,
realloc(filearr, mlen))) == NULL) {
file_oomem(ms, mlen);
@@ -377,7 +381,7 @@ diff -u libmagic.origin/apprentice.c libmagic/apprentice.c
}
}
 -  filearr[files++] = mfn;
-+  filearr[files++] = estrndup(mfn);
++  filearr[files++] = estrndup(mfn, (mflen  sizeof(mfn) - 
1)? sizeof(mfn) - 1: mflen);
}
closedir(dir);
qsort(filearr, files, sizeof(*filearr), cmpstrp);
@@ -389,7 +393,7 @@ diff -u libmagic.origin/apprentice.c libmagic/apprentice.c
}
free(filearr);
} else
-@@ -882,12 +877,7 @@
+@@ -882,12 +879,7 @@
for (i = 0; i  marraycount; i++)
mentrycount += marray[i].cont_count;
  
@@ -403,7 +407,7 @@ diff -u libmagic.origin/apprentice.c libmagic/apprentice.c
  
mentrycount = 0;
for (i = 0; i  marraycount; i++) {
-@@ -896,9 +886,14 @@
+@@ -896,9 +888,14 @@
mentrycount += marray[i].cont_count;
}
  out:
@@ -421,7 +425,7 @@ diff -u libmagic.origin/apprentice.c libmagic/apprentice.c
if (errs) {
*magicp = NULL;
*nmagicp = 0;
-@@ -1175,14 +1170,13 @@
+@@ -1175,14 +1172,13 @@
return -1;
}
me = (*mentryp)[*nmentryp - 1];
@@ -440,7 +444,7 @@ diff -u libmagic.origin/apprentice.c libmagic/apprentice.c

[PHP-CVS] com php-src: year++: ext/date/lib/astro.c ext/date/lib/dow.c ext/date/lib/interval.c ext/date/lib/parse_date.c ext/date/lib/parse_iso_intervals.c ext/date/lib/parse_tz.c ext/date/lib/timelib

2012-09-05 Thread Xinchen Hui
Commit:d64d9e335147173507d39c759c54320e2c20c9ed
Author:Xinchen Hui larue...@php.net Wed, 5 Sep 2012 23:08:05 +0800
Parents:   485c09a3765b900aea182ddd2dded2286fb0749a
Branches:  PHP-5.3

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

Log:
year++

Changed paths:
  M  ext/date/lib/astro.c
  M  ext/date/lib/dow.c
  M  ext/date/lib/interval.c
  M  ext/date/lib/parse_date.c
  M  ext/date/lib/parse_iso_intervals.c
  M  ext/date/lib/parse_tz.c
  M  ext/date/lib/timelib.c
  M  ext/date/lib/timelib.h
  M  ext/date/lib/timelib_structs.h
  M  ext/date/lib/tm2unixtime.c
  M  ext/date/lib/unixtime2tm.c
  M  ext/dba/libcdb/cdb.c
  M  ext/dba/libcdb/cdb.h
  M  ext/dba/libcdb/cdb_make.c
  M  ext/dba/libcdb/cdb_make.h
  M  ext/dba/libcdb/uint32.c
  M  ext/dba/libcdb/uint32.h
  M  ext/dba/libflatfile/flatfile.c
  M  ext/dba/libflatfile/flatfile.h
  M  ext/dba/libinifile/inifile.c
  M  ext/dba/libinifile/inifile.h
  M  ext/gd/libgd/xbm.c
  M  ext/interbase/interbase.rc
  M  ext/standard/url_scanner_ex.c
  M  netware/start.c
  M  sapi/fpm/fpm/fastcgi.c
  M  sapi/fpm/fpm/fastcgi.h
  M  sapi/fpm/fpm/fpm_main.c
  M  sapi/litespeed/lsapi_main.c
  M  sapi/litespeed/lsapidef.h
  M  sapi/litespeed/lsapilib.c
  M  sapi/litespeed/lsapilib.h
  M  win32/build/deplister.c
  M  win32/build/template.rc

diff --git a/ext/date/lib/astro.c b/ext/date/lib/astro.c
index 0438f98..064700f 100644
--- a/ext/date/lib/astro.c
+++ b/ext/date/lib/astro.c
@@ -2,7 +2,7 @@
+--+
| PHP Version 5|
+--+
-   | Copyright (c) 1997-2010 The PHP Group|
+   | Copyright (c) 1997-2012 The PHP Group|
+--+
| This source file is subject to version 3.01 of the PHP license,  |
| that is bundled with this package in the file LICENSE, and is|
diff --git a/ext/date/lib/dow.c b/ext/date/lib/dow.c
index b33e8ea..9cb9c9c 100644
--- a/ext/date/lib/dow.c
+++ b/ext/date/lib/dow.c
@@ -2,7 +2,7 @@
+--+
| PHP Version 5|
+--+
-   | Copyright (c) 1997-2010 The PHP Group|
+   | Copyright (c) 1997-2012 The PHP Group|
+--+
| This source file is subject to version 3.01 of the PHP license,  |
| that is bundled with this package in the file LICENSE, and is|
diff --git a/ext/date/lib/interval.c b/ext/date/lib/interval.c
index af150fc..451b463 100644
--- a/ext/date/lib/interval.c
+++ b/ext/date/lib/interval.c
@@ -2,7 +2,7 @@
+--+
| PHP Version 5|
+--+
-   | Copyright (c) 1997-2010 The PHP Group|
+   | Copyright (c) 1997-2012 The PHP Group|
+--+
| This source file is subject to version 3.01 of the PHP license,  |
| that is bundled with this package in the file LICENSE, and is|
diff --git a/ext/date/lib/parse_date.c b/ext/date/lib/parse_date.c
index 4274107..0e21ecc 100644
--- a/ext/date/lib/parse_date.c
+++ b/ext/date/lib/parse_date.c
@@ -4,7 +4,7 @@
+--+
| PHP Version 5|
+--+
-   | Copyright (c) 1997-2010 The PHP Group|
+   | Copyright (c) 1997-2012 The PHP Group|
+--+
| This source file is subject to version 3.01 of the PHP license,  |
| that is bundled with this package in the file LICENSE, and is|
diff --git a/ext/date/lib/parse_iso_intervals.c 
b/ext/date/lib/parse_iso_intervals.c
index 2c5ed42..5f05222 100644
--- a/ext/date/lib/parse_iso_intervals.c
+++ b/ext/date/lib/parse_iso_intervals.c
@@ -4,7 +4,7 @@
+--+
| PHP Version 5|
+--+
-   | Copyright (c) 1997-2010 The PHP Group

[PHP-CVS] com php-src: Merge branch 'PHP-5.3' into PHP-5.4: ext/date/lib/parse_date.c ext/date/lib/parse_iso_intervals.c ext/dba/libflatfile/flatfile.c ext/dba/libinifile/inifile.c ext/standard/url_sc

2012-09-05 Thread Xinchen Hui
Commit:9d44ff640c1def1dc05b298dab77b2d2c9da2f38
Author:Xinchen Hui larue...@php.net Wed, 5 Sep 2012 23:11:19 +0800
Parents:   954e7a3b3ca115b619b1b326ae4ae31a7cf196db 
d64d9e335147173507d39c759c54320e2c20c9ed
Branches:  PHP-5.4

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

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

Conflicts:
ext/interbase/interbase.rc

Changed paths:
  MM  ext/date/lib/parse_date.c
  MM  ext/date/lib/parse_iso_intervals.c
  MM  ext/dba/libflatfile/flatfile.c
  MM  ext/dba/libinifile/inifile.c
  MM  ext/standard/url_scanner_ex.c
  MA  sapi/cli/cli.h
  MM  sapi/fpm/fpm/fpm_main.c


Diff:
diff --cc ext/standard/url_scanner_ex.c
index d883d4d,943242f..c7e4a38
--- a/ext/standard/url_scanner_ex.c
+++ b/ext/standard/url_scanner_ex.c
@@@ -2,9 -2,9 +2,9 @@@
  #line 1 ext/standard/url_scanner_ex.re
  /*
+--+
 -  | PHP Version 5|
 +  | PHP Version 6|
+--+
-   | Copyright (c) 1997-2006 The PHP Group|
+   | Copyright (c) 1997-2012 The PHP Group|
+--+
| This source file is subject to version 3.01 of the PHP license,  |
| that is bundled with this package in the file LICENSE, and is|
diff --cc sapi/cli/cli.h
index 2c069c4,000..3e9ca43
mode 100644,00..100644
--- a/sapi/cli/cli.h
+++ b/sapi/cli/cli.h
@@@ -1,52 -1,0 +1,52 @@@
 +/*
 +  +--+
 +  | PHP Version 5|
 +  +--+
-   | Copyright (c) 1997-2010 The PHP Group|
++  | Copyright (c) 1997-2012 The PHP Group|
 +  +--+
 +  | This source file is subject to version 3.01 of the PHP license,  |
 +  | that is bundled with this package in the file LICENSE, and is|
 +  | available through the world-wide-web at the following url:   |
 +  | http://www.php.net/license/3_01.txt  |
 +  | If you did not receive a copy of the PHP license and are unable to   |
 +  | obtain it through the world-wide-web, please send a note to  |
 +  | lice...@php.net so we can mail you a copy immediately.   |
 +  +--+
 +  | Author: Johannes Schlueter johan...@php.net|
 +  +--+
 +*/
 +
 +/* $Id$ */
 +
 +#ifndef CLI_H
 +#define CLI_H
 +
 +#ifdef PHP_WIN32
 +#   define PHP_CLI_API __declspec(dllexport)
 +#elif defined(__GNUC__)  __GNUC__ = 4
 +#   define PHP_CLI_API __attribute__ ((visibility(default)))
 +#else
 +#   define PHP_CLI_API
 +#endif
 +
 +
 +extern PHP_CLI_API size_t sapi_cli_single_write(const char *str, uint 
str_length TSRMLS_DC);
 +
 +typedef struct  {
 +  size_t (*cli_shell_write)(const char *str, uint str_length TSRMLS_DC);
 +  int (*cli_shell_ub_write)(const char *str, uint str_length TSRMLS_DC);
 +  int (*cli_shell_run)(TSRMLS_D);
 +} cli_shell_callbacks_t;
 +
 +extern PHP_CLI_API cli_shell_callbacks_t *php_cli_get_shell_callbacks();
 +
 +#endif /* CLI_H */
 +
 +/*
 + * Local variables:
 + * tab-width: 4
 + * c-basic-offset: 4
 + * End:
 + * vim600: noet sw=4 ts=4 fdm=marker
 + * vim600: noet sw=4 ts=4
 + */


--
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': ext/date/lib/parse_date.c ext/date/lib/parse_iso_intervals.c ext/date/lib/tm2unixtime.c ext/standard/url_scanner_ex.c sapi/litespeed/lsapi_main.c sapi/li

2012-09-05 Thread Xinchen Hui
Commit:63d9c1f40b52ba68186b89fdd325894a13b22ade
Author:Xinchen Hui larue...@php.net Wed, 5 Sep 2012 23:20:42 +0800
Parents:   2b7bddd82a7d139f7389abb36ab0189ab5831570 
9d44ff640c1def1dc05b298dab77b2d2c9da2f38
Branches:  master

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

Log:
Merge branch 'PHP-5.4'

Conflicts:
sapi/litespeed/lsapi_main.c

Changed paths:
  MM  ext/date/lib/parse_date.c
  MM  ext/date/lib/parse_iso_intervals.c
  MM  ext/date/lib/tm2unixtime.c
  MM  ext/standard/url_scanner_ex.c
  MM  sapi/litespeed/lsapi_main.c
  MM  sapi/litespeed/lsapilib.c
  MM  sapi/litespeed/lsapilib.h


Diff:
diff --cc sapi/litespeed/lsapi_main.c
index c1684f7,bb532d8..5f4d2e6
--- a/sapi/litespeed/lsapi_main.c
+++ b/sapi/litespeed/lsapi_main.c
@@@ -540,16 -712,16 +540,16 @@@ static int cli_main( int argc, char * a
  #else
  php_end_ob_buffers(1 TSRMLS_CC);
  #endif
 -php_request_shutdown( NULL );
 -}
 -ret = 1;
 -break;
 -case 'v':
 -if (php_request_startup(TSRMLS_C) != FAILURE) {
 +  php_request_shutdown( NULL );
 +  }
 +  ret = 1;
 +  break;
 +  case 'v':
 +  if (php_request_startup(TSRMLS_C) != FAILURE) {
  #if ZEND_DEBUG
-   php_printf(PHP %s (%s) (built: %s %s) 
(DEBUG)\nCopyright (c) 1997-2004 The PHP Group\n%s, PHP_VERSION, 
sapi_module.name, __DATE__, __TIME__, get_zend_version());
 -php_printf(PHP %s (%s) (built: %s %s) (DEBUG)\nCopyright 
(c) 1997-2012 The PHP Group\n%s, PHP_VERSION, sapi_module.name, __DATE__, 
__TIME__, get_zend_version());
++  php_printf(PHP %s (%s) (built: %s %s) 
(DEBUG)\nCopyright (c) 1997-2012 The PHP Group\n%s, PHP_VERSION, 
sapi_module.name, __DATE__, __TIME__, get_zend_version());
  #else
-   php_printf(PHP %s (%s) (built: %s 
%s)\nCopyright (c) 1997-2004 The PHP Group\n%s, PHP_VERSION, sapi_module.name, 
__DATE__, __TIME__, get_zend_version());
 -php_printf(PHP %s (%s) (built: %s %s)\nCopyright (c) 
1997-2012 The PHP Group\n%s, PHP_VERSION, sapi_module.name, __DATE__, 
__TIME__, get_zend_version());
++  php_printf(PHP %s (%s) (built: %s 
%s)\nCopyright (c) 1997-2012 The PHP Group\n%s, PHP_VERSION, sapi_module.name, 
__DATE__, __TIME__, get_zend_version());
  #endif
  #ifdef PHP_OUTPUT_NEWAPI
  php_output_end_all(TSRMLS_C);


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



[PHP-CVS] com php-src: Correct PHP version: ext/mysqli/mysqli_libmysql.h

2012-09-05 Thread Xinchen Hui
Commit:5f9023ca381fbd25a99562420b14b0d93564198b
Author:Xinchen Hui larue...@php.net Wed, 5 Sep 2012 23:41:42 +0800
Parents:   d64d9e335147173507d39c759c54320e2c20c9ed
Branches:  PHP-5.3

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

Log:
Correct PHP version

Changed paths:
  M  ext/mysqli/mysqli_libmysql.h


Diff:
diff --git a/ext/mysqli/mysqli_libmysql.h b/ext/mysqli/mysqli_libmysql.h
index 65c69bf..228cde2 100644
--- a/ext/mysqli/mysqli_libmysql.h
+++ b/ext/mysqli/mysqli_libmysql.h
@@ -1,6 +1,6 @@
 /*
   --
-  | PHP Version 6|
+  | PHP Version 5|
   --
   | Copyright (c) 2007 The PHP Group |
   --


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



[PHP-CVS] com php-src: correct PHP version year++: ext/date/lib/parse_date.re ext/date/lib/parse_iso_intervals.re ext/standard/url_scanner_ex.c ext/standard/url_scanner_ex.re

2012-09-05 Thread Xinchen Hui
Commit:a3d078bd8f48b40496d4bbebb42a291f168ea999
Author:Xinchen Hui larue...@php.net Wed, 5 Sep 2012 23:43:59 +0800
Parents:   b9dec59b07d9b3a12767a0f8cc3bc7a069c386e9
Branches:  PHP-5.4

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

Log:
correct PHP version  year++

Changed paths:
  M  ext/date/lib/parse_date.re
  M  ext/date/lib/parse_iso_intervals.re
  M  ext/standard/url_scanner_ex.c
  M  ext/standard/url_scanner_ex.re


Diff:
diff --git a/ext/date/lib/parse_date.re b/ext/date/lib/parse_date.re
index 16c45a2..cca8858 100644
--- a/ext/date/lib/parse_date.re
+++ b/ext/date/lib/parse_date.re
@@ -2,7 +2,7 @@
+--+
| PHP Version 5|
+--+
-   | Copyright (c) 1997-2010 The PHP Group|
+   | Copyright (c) 1997-2012 The PHP Group|
+--+
| This source file is subject to version 3.01 of the PHP license,  |
| that is bundled with this package in the file LICENSE, and is|
diff --git a/ext/date/lib/parse_iso_intervals.re 
b/ext/date/lib/parse_iso_intervals.re
index 8610803..e528688 100644
--- a/ext/date/lib/parse_iso_intervals.re
+++ b/ext/date/lib/parse_iso_intervals.re
@@ -2,7 +2,7 @@
+--+
| PHP Version 5|
+--+
-   | Copyright (c) 1997-2010 The PHP Group|
+   | Copyright (c) 1997-2012 The PHP Group|
+--+
| This source file is subject to version 3.01 of the PHP license,  |
| that is bundled with this package in the file LICENSE, and is|
diff --git a/ext/standard/url_scanner_ex.c b/ext/standard/url_scanner_ex.c
index c7e4a38..1ec269d 100644
--- a/ext/standard/url_scanner_ex.c
+++ b/ext/standard/url_scanner_ex.c
@@ -2,7 +2,7 @@
 #line 1 ext/standard/url_scanner_ex.re
 /*
   +--+
-  | PHP Version 6|
+  | PHP Version 5|
   +--+
   | Copyright (c) 1997-2012 The PHP Group|
   +--+
diff --git a/ext/standard/url_scanner_ex.re b/ext/standard/url_scanner_ex.re
index e7218a1..2e37cf0 100644
--- a/ext/standard/url_scanner_ex.re
+++ b/ext/standard/url_scanner_ex.re
@@ -1,8 +1,8 @@
 /*
   +--+
-  | PHP Version 6|
+  | PHP Version 5|
   +--+
-  | Copyright (c) 1997-2006 The PHP Group|
+  | Copyright (c) 1997-2012 The PHP Group|
   +--+
   | This source file is subject to version 3.01 of the PHP license,  |
   | that is bundled with this package in the file LICENSE, and is|


--
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': ext/standard/url_scanner_ex.c

2012-09-05 Thread Xinchen Hui
Commit:d22f18007f7b73fde87c1caca32e28670cf188ce
Author:Xinchen Hui larue...@php.net Wed, 5 Sep 2012 23:44:41 +0800
Parents:   63d9c1f40b52ba68186b89fdd325894a13b22ade 
a3d078bd8f48b40496d4bbebb42a291f168ea999
Branches:  master

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

Log:
Merge branch 'PHP-5.4'

Changed paths:
  MM  ext/standard/url_scanner_ex.c


Diff:



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



[PHP-CVS] com php-src: year++: ext/date/lib/parse_date.re ext/date/lib/parse_iso_intervals.re ext/standard/url_scanner_ex.re

2012-09-05 Thread Xinchen Hui
Commit:94582f93986cfb5a43feb047bc914a0a029286d2
Author:Xinchen Hui larue...@php.net Wed, 5 Sep 2012 23:47:21 +0800
Parents:   5f9023ca381fbd25a99562420b14b0d93564198b
Branches:  PHP-5.3

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

Log:
year++

missed the .re files in 5.3

Changed paths:
  M  ext/date/lib/parse_date.re
  M  ext/date/lib/parse_iso_intervals.re
  M  ext/standard/url_scanner_ex.re


Diff:
diff --git a/ext/date/lib/parse_date.re b/ext/date/lib/parse_date.re
index 16c45a2..cca8858 100644
--- a/ext/date/lib/parse_date.re
+++ b/ext/date/lib/parse_date.re
@@ -2,7 +2,7 @@
+--+
| PHP Version 5|
+--+
-   | Copyright (c) 1997-2010 The PHP Group|
+   | Copyright (c) 1997-2012 The PHP Group|
+--+
| This source file is subject to version 3.01 of the PHP license,  |
| that is bundled with this package in the file LICENSE, and is|
diff --git a/ext/date/lib/parse_iso_intervals.re 
b/ext/date/lib/parse_iso_intervals.re
index 8610803..e528688 100644
--- a/ext/date/lib/parse_iso_intervals.re
+++ b/ext/date/lib/parse_iso_intervals.re
@@ -2,7 +2,7 @@
+--+
| PHP Version 5|
+--+
-   | Copyright (c) 1997-2010 The PHP Group|
+   | Copyright (c) 1997-2012 The PHP Group|
+--+
| This source file is subject to version 3.01 of the PHP license,  |
| that is bundled with this package in the file LICENSE, and is|
diff --git a/ext/standard/url_scanner_ex.re b/ext/standard/url_scanner_ex.re
index e9fc0b5..fdc6103 100644
--- a/ext/standard/url_scanner_ex.re
+++ b/ext/standard/url_scanner_ex.re
@@ -2,7 +2,7 @@
   +--+
   | PHP Version 5|
   +--+
-  | Copyright (c) 1997-2006 The PHP Group|
+  | Copyright (c) 1997-2012 The PHP Group|
   +--+
   | This source file is subject to version 3.01 of the PHP license,  |
   | that is bundled with this package in the file LICENSE, and is|


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



[PHP-CVS] com php-src: folder: Zend/zend_closures.c

2012-09-02 Thread Xinchen Hui
Commit:069c4486234ce70a6cb2e9b0adb9066f1f2bf343
Author:Xinchen Hui larue...@php.net Sun, 2 Sep 2012 16:52:53 +0800
Parents:   89948c7fbe487e5d75f7b02fe0c29238f556f341
Branches:  PHP-5.4

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

Log:
folder

Changed paths:
  M  Zend/zend_closures.c


Diff:
diff --git a/Zend/zend_closures.c b/Zend/zend_closures.c
index 6f2ded3..c7527b4 100644
--- a/Zend/zend_closures.c
+++ b/Zend/zend_closures.c
@@ -78,7 +78,7 @@ ZEND_METHOD(Closure, __invoke) /* {{{ */
 
 /* {{{ proto Closure Closure::bind(Closure $old, object $to [, mixed $scope = 
static ] )
Create a closure from another one and bind to another object and scope */
-ZEND_METHOD(Closure, bind) /* {{{ */
+ZEND_METHOD(Closure, bind)
 {
zval *newthis, *zclosure, *scope_arg = NULL;
zend_closure *closure;


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



[PHP-CVS] com php-src: Fixed bug #62987 (Assigning to ArrayObject[null][something] overrides all undefined variables): NEWS ext/spl/spl_array.c ext/spl/tests/bug62978.phpt

2012-09-01 Thread Xinchen Hui
Commit:67d7d03f00cb3185a4d5958ab7a4b063fc33405c
Author:Xinchen Hui larue...@php.net Sat, 1 Sep 2012 14:17:39 +0800
Parents:   5dc2cef370885c552c20f3ff44bccd402850de9e
Branches:  PHP-5.3

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

Log:
Fixed bug #62987 (Assigning to ArrayObject[null][something] overrides all 
undefined variables)

The get_zval_ptr_ptr of spl_array handler should act as same as the vm's

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

Changed paths:
  M  NEWS
  M  ext/spl/spl_array.c
  A  ext/spl/tests/bug62978.phpt


Diff:
diff --git a/NEWS b/NEWS
index a6e05be..ae82821 100644
--- a/NEWS
+++ b/NEWS
@@ -45,6 +45,8 @@ PHP   
 NEWS
   . Fixed bug (segfault due to retval is not initialized). (Laruence)
 
 - SPL:
+  . Bug #62987 (Assigning to ArrayObject[null][something] overrides all 
+undefined variables). (Laruence)
   . Fixed bug #62904 (Crash when cloning an object which inherits 
SplFixedArray)
 (Laruence)
   . Fixed bug #62616 (ArrayIterator::count() from IteratorIterator instance
diff --git a/ext/spl/spl_array.c b/ext/spl/spl_array.c
index 80ca5be..11540de 100755
--- a/ext/spl/spl_array.c
+++ b/ext/spl/spl_array.c
@@ -312,38 +312,41 @@ static zval **spl_array_get_dimension_ptr_ptr(int 
check_inherited, zval *object,
long index;
HashTable *ht = spl_array_get_hash_table(intern, 0 TSRMLS_CC);
 
-/*  We cannot get the pointer pointer so we don't allow it here for now
-   if (check_inherited  intern-fptr_offset_get) {
-   return zend_call_method_with_1_params(object, 
Z_OBJCE_P(object), intern-fptr_offset_get, offsetGet, NULL, offset);
-   }*/
-
if (!offset) {
return EG(uninitialized_zval_ptr);
}

if ((type == BP_VAR_W || type == BP_VAR_RW)  (ht-nApplyCount  0)) {
zend_error(E_WARNING, Modification of ArrayObject during 
sorting is prohibited);
-   return EG(uninitialized_zval_ptr);;
+   return EG(error_zval_ptr);;
}
 
switch(Z_TYPE_P(offset)) {
+   case IS_NULL:
+   Z_STRVAL_P(offset) = ;
+   Z_STRLEN_P(offset) = 0;
case IS_STRING:
if (zend_symtable_find(ht, Z_STRVAL_P(offset), 
Z_STRLEN_P(offset)+1, (void **) retval) == FAILURE) {
-   if (type == BP_VAR_W || type == BP_VAR_RW) {
-   zval *value;
-   ALLOC_INIT_ZVAL(value);
-   zend_symtable_update(ht, Z_STRVAL_P(offset), 
Z_STRLEN_P(offset)+1, (void**)value, sizeof(void*), NULL);
-   zend_symtable_find(ht, Z_STRVAL_P(offset), 
Z_STRLEN_P(offset)+1, (void **) retval);
-   return retval;
-   } else {
-   zend_error(E_NOTICE, Undefined index:  %s, 
Z_STRVAL_P(offset));
-   return EG(uninitialized_zval_ptr);
+   switch (type) {
+   case BP_VAR_R:
+   zend_error(E_NOTICE, Undefined index:  
%s, Z_STRVAL_P(offset));
+   case BP_VAR_UNSET:
+   case BP_VAR_IS:
+   retval = EG(uninitialized_zval_ptr);
+   break;
+   case BP_VAR_RW:
+   zend_error(E_NOTICE,Undefined index:  
%s, Z_STRVAL_P(offset));
+   case BP_VAR_W: {
+   zval *value;
+   ALLOC_INIT_ZVAL(value);
+   zend_symtable_update(ht, 
Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, (void**)value, sizeof(void*), (void 
**)retval);
+   }
}
-   } else {
-   return retval;
}
-   case IS_DOUBLE:
+   return retval;
case IS_RESOURCE:
+   zend_error(E_STRICT, Resource ID#%ld used as offset, casting 
to integer (%ld), Z_LVAL_P(offset), Z_LVAL_P(offset));
+   case IS_DOUBLE:
case IS_BOOL: 
case IS_LONG: 
if (offset-type == IS_DOUBLE) {
@@ -352,23 +355,27 @@ static zval **spl_array_get_dimension_ptr_ptr(int 
check_inherited, zval *object,
index = Z_LVAL_P(offset);
}
if (zend_hash_index_find(ht, index, (void **) retval) == 
FAILURE) {
-   if (type == BP_VAR_W || type == BP_VAR_RW) {
-   zval *value;
-   ALLOC_INIT_ZVAL(value);
-   zend_hash_index_update(ht, index, 
(void**)value, sizeof(void*), NULL

[PHP-CVS] com php-src: Merge branch 'PHP-5.3' into PHP-5.4: NEWS ext/spl/spl_array.c

2012-09-01 Thread Xinchen Hui
Commit:863e7e0acbe284d5c7738fa9c601023ad5773d3f
Author:Xinchen Hui larue...@php.net Sat, 1 Sep 2012 14:27:09 +0800
Parents:   e658a91b3d826ea4104b17f3a6123c1e9f3aee86 
67d7d03f00cb3185a4d5958ab7a4b063fc33405c
Branches:  PHP-5.4

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

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

Conflicts:
ext/spl/spl_array.c

Changed paths:
  MM  NEWS
  MM  ext/spl/spl_array.c


Diff:
diff --cc NEWS
index d88aa18,ae82821..62e2038
--- a/NEWS
+++ b/NEWS
@@@ -60,121 -43,53 +60,123 @@@ PH
  
  - Session:
. Fixed bug (segfault due to retval is not initialized). (Laruence)
 +  . Fixed bug (segfault due to PS(mod_user_implemented) not be reseted 
 +when close handler call exit). (Laruence)
  
  - SPL:
+   . Bug #62987 (Assigning to ArrayObject[null][something] overrides all 
+ undefined variables). (Laruence)
. Fixed bug #62904 (Crash when cloning an object which inherits 
SplFixedArray)
  (Laruence)
 +  . Implemented FR #62840 (Add sort flag to ArrayObject::ksort). (Laruence)
 +
 +- Standard:
 +  . Fixed bug #62836 (Seg fault or broken object references on unserialize()).
 +(Laruence)
 +
 +- FPM:
 +  . Merged PR 121 by minitux to add support for slow request counting on PHP
 +FPM status page. (Lars)
 +
 +16 Aug 2012, PHP 5.4.6
 +
 +- CLI Server:
 +  . Implemented FR #62700 (have the console output 'Listening on 
 +http://localhost:8000'). (pascal.chev...@free.fr)
 +
 +- Core:
 +  . Fixed bug #62661 (Interactive php-cli crashes if include() is used in
 +auto_prepend_file). (Laruence)
 +  . Fixed bug #62653: (unset($array[$float]) causes a crash). (Nikita Popov,
 +Laruence)
 +  . Fixed bug #62565 (Crashes due non-initialized internal properties_table).
 +(Felipe)
 +  . Fixed bug #60194 (--with-zend-multibyte and --enable-debug reports LEAK
 +with run-test.php). (Laruence)
 +
 +- CURL:
 +  . Fixed bug #62499 (curl_setopt($ch, CURLOPT_COOKIEFILE, ) returns false).
 +(r.hampartsum...@gmail.com, Laruence)
 +
 +- DateTime:
 +  . Fixed Bug #62500 (Segfault in DateInterval class when extended). 
(Laruence)
 +  
 +- Fileinfo:
 +  . Fixed bug #61964 (finfo_open with directory causes invalid free). 
 +(reeze@gmail.com)
 +
 +- Intl:
 +  . Fixed bug #62564 (Extending MessageFormatter and adding property causes 
 +crash). (Felipe)
 +
 +- MySQLnd:
 +  . Fixed bug #62594 (segfault in mysqlnd_res_meta::set_mode). (Laruence)
 +
 +- readline:
 +  . Fixed bug #62612 (readline extension compilation fails with
 +sapi/cli/cli.h: No such file). (Johannes)
 +
 +- Reflection:
 +  . Implemented FR #61602 (Allow access to name of constant used as default 
 +value). (reeze@gmail.com)
 +  
 +- SimpleXML:
 +  . Implemented FR #55218 Get namespaces from current node. (Lonny)
 +
 +- SPL:
. Fixed bug #62616 (ArrayIterator::count() from IteratorIterator instance
  gives Segmentation fault). (Laruence, Gustavo)
 +  . Fixed bug #61527 (ArrayIterator gives misleading notice on next() when 
 +moved to the end). (reeze@gmail.com)
  
 -- Enchant:
 -  . Fixed bug #62838 (enchant_dict_quick_check() destroys zval, but fails to 
 -  initialize it). (Tony, Mateusz Goik).
 +- Streams:
 +  . Fixed bug #62597 (segfault in php_stream_wrapper_log_error with ZTS 
build).
 +(Laruence)
  
 -19 Jul 2012, PHP 5.3.15
 +- Zlib:
 +  . Fixed bug #55544 (ob_gzhandler always conflicts with
 +zlib.output_compression). (Laruence)
  
 -- Zend Engine:
 -  . Fixed bug #51094 (parse_ini_file() with INI_SCANNER_RAW cuts a value that
 -includes a semi-colon). (Pierrick)
 -
 -- COM:
 -  . Fixed bug #62146 com_dotnet cannot be built shared. (Johannes)
 +19 Jul 2012, PHP 5.4.5
  
  - Core:
 -  . Fixed potential overflow in _php_stream_scandir, CVE-2012-2688. (Jason 
 -Powell, Stas)
 -  . Fixed bug #62432 (ReflectionMethod random corrupt memory on high
 -concurrent). (Johannes)
. Fixed bug #62443 (Crypt SHA256/512 Segfaults With Malformed 
  Salt). (Anthony Ferrara)
 +  . Fixed bug #62432 (ReflectionMethod random corrupt memory on high
 +concurrent). (Johannes)
 +  . Fixed bug #62373 (serialize() generates wrong reference to the object).
 +(Moriyoshi)
 +  . Fixed bug #62357 (compile failure: (S) Arguments missing for built-in
 +function __memcmp). (Laruence)
 +  . Fixed bug #61998 (Using traits with method aliases appears to result in
 +crash during execution). (Dmitry)
 +  . Fixed bug #51094 (parse_ini_file() with INI_SCANNER_RAW cuts a value that
 +includes a semi-colon). (Pierrick)
 +  . Fixed potential overflow in _php_stream_scandir (CVE-2012-2688). 
 +(Jason Powell, Stas)
  
 -- Fileinfo:
 -  . Fixed magic file regex support. (Felipe)
 +- EXIF:
 +  . Fixed information leak in ext exif (discovered by Martin Noga, 
 +Matthew j00ru Jurczyk, Gynvael Coldwind)
  
  - FPM:
 -  . Fixed bug #61045 (fpm don't send error log to fastcgi

[PHP-CVS] com php-src: Remove extra blank in notice message, should act as same as vm: ext/spl/spl_array.c ext/spl/spl_iterators.c ext/spl/tests/arrayObject___construct_basic2.phpt ext/spl/tests/array

2012-09-01 Thread Xinchen Hui
Commit:f3108b5f818b2757d2e518f37d3927e83858ae4f
Author:Xinchen Hui larue...@php.net Sat, 1 Sep 2012 14:37:45 +0800
Parents:   863e7e0acbe284d5c7738fa9c601023ad5773d3f
Branches:  PHP-5.4

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

Log:
Remove extra blank in notice message, should act as same as vm

Changed paths:
  M  ext/spl/spl_array.c
  M  ext/spl/spl_iterators.c
  M  ext/spl/tests/arrayObject___construct_basic2.phpt
  M  ext/spl/tests/arrayObject___construct_basic3.phpt
  M  ext/spl/tests/arrayObject___construct_basic4.phpt
  M  ext/spl/tests/arrayObject___construct_basic5.phpt
  M  ext/spl/tests/arrayObject_magicMethods1.phpt
  M  ext/spl/tests/arrayObject_magicMethods3.phpt
  M  ext/spl/tests/arrayObject_magicMethods4.phpt
  M  ext/spl/tests/arrayObject_magicMethods6.phpt
  M  ext/spl/tests/arrayObject_setFlags_basic1.phpt
  M  ext/spl/tests/array_001.phpt
  M  ext/spl/tests/array_010.phpt
  M  ext/spl/tests/bug45622.phpt
  M  ext/spl/tests/bug45622b.phpt
  M  ext/spl/tests/bug54323.phpt
  M  ext/spl/tests/bug62978.phpt
  M  ext/spl/tests/iterator_044.phpt

diff --git a/ext/spl/spl_array.c b/ext/spl/spl_array.c
index 0b3b5a3..3c6b41e 100755
--- a/ext/spl/spl_array.c
+++ b/ext/spl/spl_array.c
@@ -323,13 +323,13 @@ static zval **spl_array_get_dimension_ptr_ptr(int 
check_inherited, zval *object,
if (zend_symtable_find(ht, Z_STRVAL_P(offset), 
Z_STRLEN_P(offset)+1, (void **) retval) == FAILURE) {
switch (type) {
case BP_VAR_R:
-   zend_error(E_NOTICE, Undefined index:  
%s, Z_STRVAL_P(offset));
+   zend_error(E_NOTICE, Undefined index: 
%s, Z_STRVAL_P(offset));
case BP_VAR_UNSET:
case BP_VAR_IS:
retval = EG(uninitialized_zval_ptr);
break;
case BP_VAR_RW:
-   zend_error(E_NOTICE,Undefined index:  
%s, Z_STRVAL_P(offset));
+   zend_error(E_NOTICE,Undefined index: 
%s, Z_STRVAL_P(offset));
case BP_VAR_W: {
zval *value;
ALLOC_INIT_ZVAL(value);
@@ -351,13 +351,13 @@ static zval **spl_array_get_dimension_ptr_ptr(int 
check_inherited, zval *object,
if (zend_hash_index_find(ht, index, (void **) retval) == 
FAILURE) {
switch (type) {
case BP_VAR_R:
-   zend_error(E_NOTICE, Undefined offset: 
 %ld, index);
+   zend_error(E_NOTICE, Undefined offset: 
%ld, index);
case BP_VAR_UNSET:
case BP_VAR_IS:
retval = EG(uninitialized_zval_ptr);
break;
case BP_VAR_RW:
-   zend_error(E_NOTICE, Undefined offset: 
 %ld, index);
+   zend_error(E_NOTICE, Undefined offset: 
%ld, index);
case BP_VAR_W: {
zval *value;
ALLOC_INIT_ZVAL(value);
@@ -520,11 +520,11 @@ static void spl_array_unset_dimension_ex(int 
check_inherited, zval *object, zval
}
if (ht == EG(symbol_table)) {
if (zend_delete_global_variable(Z_STRVAL_P(offset), 
Z_STRLEN_P(offset) TSRMLS_CC)) {
-   zend_error(E_NOTICE,Undefined index:  %s, 
Z_STRVAL_P(offset));
+   zend_error(E_NOTICE,Undefined index: %s, 
Z_STRVAL_P(offset));
}
} else {
if (zend_symtable_del(ht, Z_STRVAL_P(offset), 
Z_STRLEN_P(offset)+1) == FAILURE) {
-   zend_error(E_NOTICE,Undefined index:  %s, 
Z_STRVAL_P(offset));
+   zend_error(E_NOTICE,Undefined index: %s, 
Z_STRVAL_P(offset));
} else {
spl_array_object *obj = intern;
 
@@ -570,7 +570,7 @@ static void spl_array_unset_dimension_ex(int 
check_inherited, zval *object, zval
return;
}
if (zend_hash_index_del(ht, index) == FAILURE) {
-   zend_error(E_NOTICE,Undefined offset:  %ld, 
Z_LVAL_P(offset));
+   zend_error(E_NOTICE,Undefined offset: %ld, 
Z_LVAL_P(offset));
}
break;
default:
diff --git a/ext/spl/spl_iterators.c b/ext/spl/spl_iterators.c
index e5dc030..098d7dc 100755
--- a/ext

[PHP-CVS] com php-src: Merge branch 'PHP-5.4': ext/spl/spl_iterators.c

2012-09-01 Thread Xinchen Hui
Commit:7b5960b08577700275468b396e6f962e0b70
Author:Xinchen Hui larue...@php.net Sat, 1 Sep 2012 14:38:33 +0800
Parents:   59e34bad32cecd823577f43756776d6d6936e93e 
f3108b5f818b2757d2e518f37d3927e83858ae4f
Branches:  master

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

Log:
Merge branch 'PHP-5.4'

Changed paths:
  MM  ext/spl/spl_iterators.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 test failed due to new Token T_YIELD: ext/tokenizer/tests/bug60097.phpt

2012-09-01 Thread Xinchen Hui
Commit:4e84f725544153d5b6fff99adc274d11f79b9079
Author:Xinchen Hui larue...@php.net Sun, 2 Sep 2012 13:15:23 +0800
Parents:   664e763c2c59230dab99573d9291a9f45daecade
Branches:  master

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

Log:
Fix test failed due to new Token T_YIELD

Changed paths:
  M  ext/tokenizer/tests/bug60097.phpt


Diff:
diff --git a/ext/tokenizer/tests/bug60097.phpt 
b/ext/tokenizer/tests/bug60097.phpt
index e9f1bd6..2116866 100644
--- a/ext/tokenizer/tests/bug60097.phpt
+++ b/ext/tokenizer/tests/bug60097.phpt
@@ -17,7 +17,7 @@ array(14) {
   [0]=
   array(3) {
 [0]=
-int(373)
+int(374)
 [1]=
 string(6) ?php
 
@@ -27,7 +27,7 @@ array(14) {
   [1]=
   array(3) {
 [0]=
-int(377)
+int(378)
 [1]=
 string(8) DOC1
 
@@ -37,7 +37,7 @@ array(14) {
   [2]=
   array(3) {
 [0]=
-int(380)
+int(381)
 [1]=
 string(1) {
 [2]=
@@ -46,7 +46,7 @@ array(14) {
   [3]=
   array(3) {
 [0]=
-int(309)
+int(310)
 [1]=
 string(2) $s
 [2]=
@@ -57,7 +57,7 @@ array(14) {
   [5]=
   array(3) {
 [0]=
-int(377)
+int(378)
 [1]=
 string(8) DOC2
 
@@ -67,7 +67,7 @@ array(14) {
   [6]=
   array(3) {
 [0]=
-int(378)
+int(379)
 [1]=
 string(4) DOC2
 [2]=
@@ -76,7 +76,7 @@ array(14) {
   [7]=
   array(3) {
 [0]=
-int(376)
+int(377)
 [1]=
 string(1) 
 
@@ -90,7 +90,7 @@ array(14) {
   [10]=
   array(3) {
 [0]=
-int(314)
+int(315)
 [1]=
 string(1) 
 
@@ -100,7 +100,7 @@ array(14) {
   [11]=
   array(3) {
 [0]=
-int(378)
+int(379)
 [1]=
 string(4) DOC1
 [2]=
@@ -111,7 +111,7 @@ array(14) {
   [13]=
   array(3) {
 [0]=
-int(376)
+int(377)
 [1]=
 string(1) 
 


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



[PHP-CVS] com php-src: Fixed bug #62976 (Notice: could not be converted to int when comparing some builtin classes): NEWS Zend/zend_operators.c tests/lang/compare_objects_basic2.phpt

2012-08-30 Thread Xinchen Hui
Commit:5dc2cef370885c552c20f3ff44bccd402850de9e
Author:Xinchen Hui larue...@php.net Fri, 31 Aug 2012 11:22:43 
+0800
Parents:   8afb848e18187974df79d3ddc8d215695d7cf632
Branches:  PHP-5.3

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

Log:
Fixed bug #62976 (Notice: could not be converted to int when comparing some 
builtin classes)

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

Changed paths:
  M  NEWS
  M  Zend/zend_operators.c
  M  tests/lang/compare_objects_basic2.phpt


Diff:
diff --git a/NEWS b/NEWS
index 2ef6084..a6e05be 100644
--- a/NEWS
+++ b/NEWS
@@ -3,6 +3,8 @@ PHP 
   NEWS
 ?? ??? 2012, PHP 5.3.16
 
 - Core:
+  . Fixed bug #62976 (Notice: could not be converted to int when comparing
+some builtin classes). (Laruence)
   . Fixed bug (segfault while build with zts and GOTO vm-kind). (Laruence)
   . Fixed bug #62955 (Only one directive is loaded from Per Directory Values 
 Windows registry). (aserbulov at parallels dot com)
diff --git a/Zend/zend_operators.c b/Zend/zend_operators.c
index e6fe67e..aea63fa 100644
--- a/Zend/zend_operators.c
+++ b/Zend/zend_operators.c
@@ -1489,6 +1489,9 @@ ZEND_API int compare_function(zval *result, zval *op1, 
zval *op2 TSRMLS_DC) /* {
ret = compare_function(result, 
op1, op_free TSRMLS_CC);

zend_free_obj_get_result(op_free TSRMLS_CC);
return ret;
+   } else if (Z_TYPE_P(op1) == IS_OBJECT) {
+   ZVAL_LONG(result, 1);
+   return SUCCESS;
}
}
if (!converted) {
diff --git a/tests/lang/compare_objects_basic2.phpt 
b/tests/lang/compare_objects_basic2.phpt
index a2c34d0..7e4786c 100644
--- a/tests/lang/compare_objects_basic2.phpt
+++ b/tests/lang/compare_objects_basic2.phpt
@@ -20,9 +20,5 @@ var_dump($obj1 == $obj2);
 ===DONE===
 --EXPECTF--
 Simple test comparing two objects with different compare callback handler
-
-Notice: Object of class X could not be converted to int in %s on line %d
-
-Notice: Object of class DateTime could not be converted to int in %s on line %d
-bool(true)
-===DONE===
\ No newline at end of file
+bool(false)
+===DONE===


--
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.3' into PHP-5.4: NEWS Zend/zend_operators.c

2012-08-30 Thread Xinchen Hui
Commit:66fad45724214c21491daa21031ac6e5a59d5e3a
Author:Xinchen Hui larue...@php.net Fri, 31 Aug 2012 11:23:33 
+0800
Parents:   eb8d603d464af6e50a0907cf4f47a6dc60bce4b5 
5dc2cef370885c552c20f3ff44bccd402850de9e
Branches:  PHP-5.4

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

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

Changed paths:
  MM  NEWS
  MM  Zend/zend_operators.c


Diff:
diff --cc NEWS
index 99a30c8,a6e05be..97cb3d0
--- a/NEWS
+++ b/NEWS
@@@ -1,33 -1,26 +1,35 @@@
  PHP
NEWS
  
|||
 -?? ??? 2012, PHP 5.3.16
 +?? ??? 2012, PHP 5.4.8
 +
 +?? ??? 2012, PHP 5.4.7
  
  - Core:
+   . Fixed bug #62976 (Notice: could not be converted to int when comparing
+ some builtin classes). (Laruence)
. Fixed bug (segfault while build with zts and GOTO vm-kind). (Laruence)
 -  . Fixed bug #62955 (Only one directive is loaded from Per Directory 
Values 
 -Windows registry). (aserbulov at parallels dot com)
 -  . Fixed bug #62763 (register_shutdown_function and extending class). 
 +  . Fixed bug #62844 (parse_url() does not recognize //). (Andrew Faulds).
 +  . Fixed bug #62829 (stdint.h included on platform where HAVE_STDINT_H is 
not 
 +set). (Felipe)
 +  . Fixed bug #62763 (register_shutdown_function and extending class).
  (Laruence)
 +  . Fixed bug #62725 (Calling exit() in a shutdown function does not return
 +the exit value). (Laruence)
. Fixed bug #62744 (dangling pointers made by zend_disable_class). 
(Laruence)
 -  . Fixed bug #62716 (munmap() is called with the incorrect length). 
 +  . Fixed bug #62716 (munmap() is called with the incorrect length).
  (slang...@google.com)
 -  . Fixed bug ##62460 (php binaries installed as binary.dSYM). (Reeze Xia)
 -  . Fixed bug #60194 (--with-zend-multibyte and --enable-debug reports LEAK
 -with run-test.php). (Laruence)
 +  . Fixed bug #62358 (Segfault when using traits a lot). (Laruence)
 +  . Fixed bug #62328 (implementing __toString and a cast to string fails)
 +(Laruence)
 +  . Fixed bug #51363 (Fatal error raised by var_export() not caught by error 
 +handler). (Lonny Kapelushnik)
 +  . Fixed bug #40459 (Stat and Dir stream wrapper methods do not call 
 +constructor). (Stas)
  
  - CURL:
 +  . Fixed bug #62912 (CURLINFO_PRIMARY_* AND CURLINFO_LOCAL_* not exposed).
 +  (Pierrick)
. Fixed bug #62839 (curl_copy_handle segfault with CURLOPT_FILE). (Pierrick)
 -  . Fixed bug #62499 (curl_setopt($ch, CURLOPT_COOKIEFILE, ) returns false).
 -(r.hampartsum...@gmail.com, Laruence)
  
  - DateTime:
. Fixed bug #62852 (Unserialize invalid DateTime causes crash).


--
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': Zend/zend_operators.c

2012-08-30 Thread Xinchen Hui
Commit:b5d2c3174fcd3785d827ee310669189e827ca7ec
Author:Xinchen Hui larue...@php.net Fri, 31 Aug 2012 11:25:21 
+0800
Parents:   5e51209785ea922df7f2be62a5da33fccdf9014a 
66fad45724214c21491daa21031ac6e5a59d5e3a
Branches:  master

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

Log:
Merge branch 'PHP-5.4'

Changed paths:
  MM  Zend/zend_operators.c


Diff:



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



Re: [PHP-CVS] com php-src: Fixed bug (segfault while build with zts and GOTO vm-kind): NEWS Zend/zend_vm_execute.skl Zend/zend_vm_gen.php

2012-08-26 Thread Xinchen Hui
On Sun, Aug 26, 2012 at 4:02 PM, Nikita Popov nikita@gmail.com wrote:
 On Sun, Aug 26, 2012 at 5:22 AM, Xinchen Hui larue...@gmail.com wrote:
 hi:
   In goto vim, execute will be called with empty op_array to
 initialize handlers, in this moment the executor globals(zts) is not
 be initialized.

   You can have a try without this fix

 Thanks

 So the commit only fixes a valgrind warning, not an actual issue?
segfault...

as the commit log said

thanks

 Nikita



-- 
惠新宸laruence
Senior PHP Engineer
http://www.laruence.com

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



[PHP-CVS] com php-src: Add test for #62907: Zend/tests/bug62907.phpt

2012-08-26 Thread Xinchen Hui
Commit:e24194d15755fc574a39df1bc3a572394627f847
Author:Xinchen Hui larue...@php.net Sun, 26 Aug 2012 18:28:15 
+0800
Parents:   383eafe482d0e07e6bc8a6b5c1dccb69a9f17bb7
Branches:  PHP-5.4

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

Log:
Add test for #62907

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

Changed paths:
  A  Zend/tests/bug62907.phpt


Diff:
diff --git a/Zend/tests/bug62907.phpt b/Zend/tests/bug62907.phpt
new file mode 100644
index 000..c519a54
--- /dev/null
+++ b/Zend/tests/bug62907.phpt
@@ -0,0 +1,24 @@
+--TEST--
+Bug #62907 (Double free when use traits)
+--XFAIL--
+bug is not fixed yet
+--FILE--
+?php
+function __autoload($name) {
+if ($name == B) {
+eval (abstract class B extends A { });
+} else if ($name == A) {
+eval (abstract class A { use T { T::__construct as __asconstruct; 
}}); 
+} else if ($name == T) {
+eval (trait T { public function __construct() { } }); 
+} 
+return TRUE;
+} 
+
+class C extends B {
+public function __construct() {
+}
+}
+echo okey;
+--EXPECT--
+okey


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



[PHP-CVS] com php-src: Fixed bug #62938 (zend_do_bind_catch() used without declaration): Zend/zend_compile.h

2012-08-26 Thread Xinchen Hui
Commit:cec1786911eea3d515c044a407e22e9b162d7080
Author:Xinchen Hui larue...@php.net Mon, 27 Aug 2012 10:23:23 
+0800
Parents:   dacd11ea8989a442032b9fdbece581cf9d299904
Branches:  master

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

Log:
Fixed bug #62938 (zend_do_bind_catch() used without declaration)

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

Changed paths:
  M  Zend/zend_compile.h


Diff:
diff --git a/Zend/zend_compile.h b/Zend/zend_compile.h
index 15c2ab7..3a6f942 100644
--- a/Zend/zend_compile.h
+++ b/Zend/zend_compile.h
@@ -501,6 +501,7 @@ void zend_do_fetch_lexical_variable(znode *varname, 
zend_bool is_ref TSRMLS_DC);
 
 void zend_do_try(znode *try_token TSRMLS_DC);
 void zend_do_begin_catch(znode *try_token, znode *catch_class, znode 
*catch_var, znode *first_catch TSRMLS_DC);
+void zend_do_bind_catch(znode *try_token, znode *catch_token TSRMLS_DC);
 void zend_do_end_catch(znode *catch_token TSRMLS_DC);
 void zend_do_finally(znode *finally_token TSRMLS_DC);
 void zend_do_end_finally(znode *try_token, znode* catch_token, znode 
*finally_token TSRMLS_DC);


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



[PHP-CVS] com php-src: Prefer no finally block for most situations: Zend/zend_vm_def.h Zend/zend_vm_execute.h

2012-08-25 Thread Xinchen Hui
Commit:326aa087532d7eaecc8fefff58bb2a0b008b5ac8
Author:Xinchen Hui larue...@php.net Sat, 25 Aug 2012 21:14:51 
+0800
Parents:   9ab45d3edbafa3ee751472c3f8d1fb3f51f38cf1
Branches:  master

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

Log:
Prefer no finally block for most situations

Changed paths:
  M  Zend/zend_vm_def.h
  M  Zend/zend_vm_execute.h

diff --git a/Zend/zend_vm_def.h b/Zend/zend_vm_def.h
index ce1674e..92c5fcf 100644
--- a/Zend/zend_vm_def.h
+++ b/Zend/zend_vm_def.h
@@ -2173,6 +2173,7 @@ ZEND_VM_HELPER_EX(zend_finally_handler_leaving, ANY, ANY, 
int type)
if (catch_op_num  finally_op_num) {
/* EG(exception) || EG(prev_exception) 
*/
if (catch_op_num  finally_op_num) {
+   zend_exception_save(TSRMLS_C);
EX(leaving) = ZEND_THROW;

ZEND_VM_SET_OPCODE(EX(op_array)-opcodes[finally_op_num]);
} else {
@@ -2183,6 +2184,7 @@ ZEND_VM_HELPER_EX(zend_finally_handler_leaving, ANY, ANY, 
int type)
EX(leaving) = 0;

ZEND_VM_SET_OPCODE(EX(op_array)-opcodes[catch_op_num]);
} else if (finally_op_num) {
+   zend_exception_save(TSRMLS_C);
if (type != ZEND_LEAVE) {
EX(leaving) = type;
}
@@ -2233,12 +2235,12 @@ ZEND_VM_HANDLER(42, ZEND_JMP, ANY, ANY)
 #if DEBUG_ZEND=2
printf(Jumping to %d\n, opline-op1.opline_num);
 #endif
-   if (EX(op_array)-has_finally_block) {
-   EX(leaving_dest) = opline-op1.jmp_addr - EX(op_array)-opcodes;
-   ZEND_VM_DISPATCH_TO_HELPER_EX(zend_finally_handler_leaving, 
type, ZEND_JMP);
+   if (EXPECTED(!EX(op_array)-has_finally_block)) {
+   ZEND_VM_SET_OPCODE(opline-op1.jmp_addr);
+   ZEND_VM_CONTINUE(); /* CHECK_ME */
}
-   ZEND_VM_SET_OPCODE(opline-op1.jmp_addr);
-   ZEND_VM_CONTINUE(); /* CHECK_ME */
+   EX(leaving_dest) = opline-op1.jmp_addr - EX(op_array)-opcodes;
+   ZEND_VM_DISPATCH_TO_HELPER_EX(zend_finally_handler_leaving, type, 
ZEND_JMP);
 }
 
 ZEND_VM_HANDLER(43, ZEND_JMPZ, CONST|TMP|VAR|CV, ANY)
@@ -2975,10 +2977,10 @@ ZEND_VM_HANDLER(62, ZEND_RETURN, CONST|TMP|VAR|CV, ANY)
}
FREE_OP1_IF_VAR();
 
-   if (EX(op_array)-has_finally_block) {
-   ZEND_VM_DISPATCH_TO_HELPER_EX(zend_finally_handler_leaving, 
type, ZEND_RETURN);
+   if (EXPECTED(!EX(op_array)-has_finally_block)) {
+   ZEND_VM_DISPATCH_TO_HELPER(zend_leave_helper);
}
-   ZEND_VM_DISPATCH_TO_HELPER(zend_leave_helper);
+   ZEND_VM_DISPATCH_TO_HELPER_EX(zend_finally_handler_leaving, type, 
ZEND_RETURN);
 }
 
 ZEND_VM_HANDLER(111, ZEND_RETURN_BY_REF, CONST|TMP|VAR|CV, ANY)
@@ -3051,10 +3053,10 @@ ZEND_VM_HANDLER(111, ZEND_RETURN_BY_REF, 
CONST|TMP|VAR|CV, ANY)
 
FREE_OP1_IF_VAR();
 
-   if (EX(op_array)-has_finally_block) {
-   ZEND_VM_DISPATCH_TO_HELPER_EX(zend_finally_handler_leaving, 
type, ZEND_RETURN_BY_REF);
+   if (EXPECTED(!EX(op_array)-has_finally_block)) {
+   ZEND_VM_DISPATCH_TO_HELPER(zend_leave_helper);
}
-   ZEND_VM_DISPATCH_TO_HELPER(zend_leave_helper);
+   ZEND_VM_DISPATCH_TO_HELPER_EX(zend_finally_handler_leaving, type, 
ZEND_RETURN_BY_REF);
 }
 
 ZEND_VM_HANDLER(108, ZEND_THROW, CONST|TMP|VAR|CV, ANY)
@@ -3398,11 +3400,11 @@ ZEND_VM_HANDLER(50, ZEND_BRK, ANY, CONST)
el = zend_brk_cont(Z_LVAL_P(opline-op2.zv), opline-op1.opline_num,
   EX(op_array), EX_Ts() TSRMLS_CC);
FREE_OP2();
-   if (EX(op_array)-has_finally_block) {
-   EX(leaving_dest) = el-brk;
-   ZEND_VM_DISPATCH_TO_HELPER_EX(zend_finally_handler_leaving, 
type, ZEND_BRK);
+   if (EXPECTED(!EX(op_array)-has_finally_block)) {
+   ZEND_VM_JMP(EX(op_array)-opcodes + el-brk);
}
-   ZEND_VM_JMP(EX(op_array)-opcodes + el-brk);
+   EX(leaving_dest) = el-brk;
+   ZEND_VM_DISPATCH_TO_HELPER_EX(zend_finally_handler_leaving, type, 
ZEND_BRK);
 }
 
 ZEND_VM_HANDLER(51, ZEND_CONT, ANY, CONST)
@@ -3414,11 +3416,11 @@ ZEND_VM_HANDLER(51, ZEND_CONT, ANY, CONST)
el = zend_brk_cont(Z_LVAL_P(opline-op2.zv), opline-op1.opline_num,
   EX(op_array), EX_Ts() TSRMLS_CC);
FREE_OP2();
-   if (EG(active_op_array)-has_finally_block) {
-   EX(leaving_dest) = el-cont;
-   ZEND_VM_DISPATCH_TO_HELPER_EX(zend_finally_handler_leaving, 
type, ZEND_CONT);
+   if (EXPECTED

[PHP-CVS] com php-src: Fixed bug (segfault while build with zts and GOTO vm-kind): NEWS Zend/zend_vm_execute.skl Zend/zend_vm_gen.php

2012-08-25 Thread Xinchen Hui
Commit:d92a89fe52e89eef9527d1e27b5bb051ae24bc54
Author:Xinchen Hui larue...@php.net Sat, 25 Aug 2012 21:47:53 
+0800
Parents:   55d680e9682e3218b333d929bf3b24ddfe83c436
Branches:  PHP-5.3

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

Log:
Fixed bug (segfault while build with zts and GOTO vm-kind)

Changed paths:
  M  NEWS
  M  Zend/zend_vm_execute.skl
  M  Zend/zend_vm_gen.php


Diff:
diff --git a/NEWS b/NEWS
index 9af7977..69cbb2a 100644
--- a/NEWS
+++ b/NEWS
@@ -3,6 +3,7 @@ PHP 
   NEWS
 ?? ??? 2012, PHP 5.3.16
 
 - Core:
+  . Fixed bug (segfault while build with zts and GOTO vm-kind). (Laruence)
   . Fixed bug #62763 (register_shutdown_function and extending class). 
 (Laruence)
   . Fixed bug #62744 (dangling pointers made by zend_disable_class). (Laruence)
diff --git a/Zend/zend_vm_execute.skl b/Zend/zend_vm_execute.skl
index 18d0e29..e5a143e 100644
--- a/Zend/zend_vm_execute.skl
+++ b/Zend/zend_vm_execute.skl
@@ -4,8 +4,8 @@ ZEND_API void {%EXECUTOR_NAME%}(zend_op_array *op_array 
TSRMLS_DC)
 {
zend_execute_data *execute_data;
zend_bool nested = 0;
-   zend_bool original_in_execution = EG(in_execution);
{%HELPER_VARS%}
+   {%EXECUTION_STATUS%}
 
{%INTERNAL_LABELS%}
 
diff --git a/Zend/zend_vm_gen.php b/Zend/zend_vm_gen.php
index 86d6503..2fff1a9 100644
--- a/Zend/zend_vm_gen.php
+++ b/Zend/zend_vm_gen.php
@@ -850,6 +850,13 @@ function gen_executor($f, $skl, $spec, $kind, 
$executor_name, $initializer_name,
skip_blanks($f, $m[1], 
$m[3].\n);
}
break;
+   case EXECUTION_STATUS:
+   if ($kind != ZEND_VM_KIND_GOTO) {
+   out($f, $m[1] . zend_bool 
original_in_execution = EG(in_execution);\n);
+   } else {
+   out($f, $m[1] . zend_bool 
original_in_execution = op_array? EG(in_execution) : 0;\n);
+   }
+   break;
case INTERNAL_LABELS:
if ($kind == ZEND_VM_KIND_GOTO) {
  // Emit array of labels of opcode 
handlers and code for


--
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.3' into PHP-5.4: NEWS Zend/zend_vm_execute.skl Zend/zend_vm_gen.php

2012-08-25 Thread Xinchen Hui
Commit:383eafe482d0e07e6bc8a6b5c1dccb69a9f17bb7
Author:Xinchen Hui larue...@php.net Sat, 25 Aug 2012 21:49:29 
+0800
Parents:   4c83ecc75452a23799c39f9bbb95b617fa46bf84 
d92a89fe52e89eef9527d1e27b5bb051ae24bc54
Branches:  PHP-5.4

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

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

Changed paths:
  MM  NEWS
  MM  Zend/zend_vm_execute.skl
  MM  Zend/zend_vm_gen.php


Diff:
diff --cc NEWS
index 5e482d2,69cbb2a..b7753d6
--- a/NEWS
+++ b/NEWS
@@@ -1,30 -1,22 +1,31 @@@
  PHP
NEWS
  
|||
 -?? ??? 2012, PHP 5.3.16
 +?? ??? 2012, PHP 5.4.7
  
  - Core:
+   . Fixed bug (segfault while build with zts and GOTO vm-kind). (Laruence)
 -  . Fixed bug #62763 (register_shutdown_function and extending class). 
 +  . Fixed bug #62844 (parse_url() does not recognize //). (Andrew Faulds).
 +  . Fixed bug #62829 (stdint.h included on platform where HAVE_STDINT_H is 
not 
 +set). (Felipe)
 +  . Fixed bug #62763 (register_shutdown_function and extending class).
  (Laruence)
 +  . Fixed bug #62725 (Calling exit() in a shutdown function does not return
 +the exit value). (Laruence)
. Fixed bug #62744 (dangling pointers made by zend_disable_class). 
(Laruence)
 -  . Fixed bug #62716 (munmap() is called with the incorrect length). 
 +  . Fixed bug #62716 (munmap() is called with the incorrect length).
  (slang...@google.com)
 -  . Fixed bug ##62460 (php binaries installed as binary.dSYM). (Reeze Xia)
 -  . Fixed bug #60194 (--with-zend-multibyte and --enable-debug reports LEAK
 -with run-test.php). (Laruence)
 +  . Fixed bug #62358 (Segfault when using traits a lot). (Laruence)
 +  . Fixed bug #62328 (implementing __toString and a cast to string fails)
 +(Laruence)
 +  . Fixed bug #51363 (Fatal error raised by var_export() not caught by error 
 +handler). (Lonny Kapelushnik)
 +  . Fixed bug #40459 (Stat and Dir stream wrapper methods do not call 
 +constructor). (Stas)
  
  - CURL:
 +  . Fixed bug #62912 (CURLINFO_PRIMARY_* AND CURLINFO_LOCAL_* not exposed).
 +  (Pierrick)
. Fixed bug #62839 (curl_copy_handle segfault with CURLOPT_FILE). (Pierrick)
 -  . Fixed bug #62499 (curl_setopt($ch, CURLOPT_COOKIEFILE, ) returns false).
 -(r.hampartsum...@gmail.com, Laruence)
  
  - DateTime:
. Fixed bug #62852 (Unserialize invalid DateTime causes crash).
diff --cc Zend/zend_vm_execute.skl
index 426f689,e5a143e..6d1b2e7
--- a/Zend/zend_vm_execute.skl
+++ b/Zend/zend_vm_execute.skl
@@@ -2,11 -2,10 +2,11 @@@
  
  ZEND_API void {%EXECUTOR_NAME%}(zend_op_array *op_array TSRMLS_DC)
  {
 +  DCL_OPLINE
zend_execute_data *execute_data;
zend_bool nested = 0;
-   zend_bool original_in_execution = EG(in_execution);
{%HELPER_VARS%}
+   {%EXECUTION_STATUS%}
  
{%INTERNAL_LABELS%}


--
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': Zend/zend_vm_execute.skl

2012-08-25 Thread Xinchen Hui
Commit:e888d48d9ba9adbd37d8c102c40b90bedf20ca7a
Author:Xinchen Hui larue...@php.net Sat, 25 Aug 2012 21:55:36 
+0800
Parents:   326aa087532d7eaecc8fefff58bb2a0b008b5ac8 
383eafe482d0e07e6bc8a6b5c1dccb69a9f17bb7
Branches:  master

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

Log:
Merge branch 'PHP-5.4'

Changed paths:
  MM  Zend/zend_vm_execute.skl


Diff:



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



[PHP-CVS] com php-src: Support list in foreach: NEWS UPGRADING Zend/tests/foreach_list.phpt Zend/zend_compile.c Zend/zend_compile.h Zend/zend_language_parser.y tests/lang/foreachLoop.007.phpt

2012-08-25 Thread Xinchen Hui
Commit:35951d4be0bd27c85519995a95429bd0d0a76a00
Author:Xinchen Hui larue...@php.net Sat, 25 Aug 2012 22:23:14 
+0800
Parents:   e888d48d9ba9adbd37d8c102c40b90bedf20ca7a
Branches:  master

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

Log:
Support list in foreach

RFC: https://wiki.php.net/rfc/foreachlist

Changed paths:
  M  NEWS
  M  UPGRADING
  A  Zend/tests/foreach_list.phpt
  M  Zend/zend_compile.c
  M  Zend/zend_compile.h
  M  Zend/zend_language_parser.y
  M  tests/lang/foreachLoop.007.phpt


Diff:
diff --git a/NEWS b/NEWS
index 00f8ec6..28b89ba 100644
--- a/NEWS
+++ b/NEWS
@@ -3,6 +3,7 @@ PHP 
   NEWS
 ?? ??? 201?, PHP 5.5.0
 
 - General improvements:
+  . Support list in foreach (https://wiki.php.net/rfc/foreachlist). (Laruence)
   . Implemented 'finally' keyword (https://wiki.php.net/rfc/finally). 
(Laruence)
   . Drop Windows XP and 2003 support. (Pierre)
   . Improve set_exception_handler while doing reset.(Laruence)
diff --git a/UPGRADING b/UPGRADING
index aeab14b..ba55635 100755
--- a/UPGRADING
+++ b/UPGRADING
@@ -31,6 +31,8 @@ PHP X.Y UPGRADE NOTES
 2. New Features
 
 
+- Support list in foreach. (Laruence)
+  (wiki.php.net/rfc/foreachlist)
 - Support finally keyword. (Laruence)
   (wiki.php.net/rfc/finally)
 - Support constant array/string dereferencing. (Laruence)
diff --git a/Zend/tests/foreach_list.phpt b/Zend/tests/foreach_list.phpt
new file mode 100644
index 000..a318f1a
--- /dev/null
+++ b/Zend/tests/foreach_list.phpt
@@ -0,0 +1,43 @@
+--TEST--
+foreach with list syntax
+--FILE--
+?php
+
+foreach(array(array(1,2), array(3,4)) as list($a, $b)) {
+var_dump($a . $b);
+}
+
+$array = array(
+array('a', 'b'),
+array('c', 'd'),
+);
+
+foreach ($array as list($a, $b)) {
+var_dump($a . $b);
+}
+
+
+$multi = array(
+array(array(1,2), array(3,4)),
+array(array(5,6), array(7,8)),
+);
+
+foreach ($multi as list(list($a, $b), list($c, $d))) {
+var_dump($a . $b . $c . $d);
+}
+
+foreach ($multi as $key = list(list($a, $b), list($c, $d))) {
+var_dump($key . $a . $b . $c . $d);
+}
+
+
+?
+--EXPECT--
+string(2) 12
+string(2) 34
+string(2) ab
+string(2) cd
+string(4) 1234
+string(4) 5678
+string(5) 01234
+string(5) 15678
diff --git a/Zend/zend_compile.c b/Zend/zend_compile.c
index 2665870..b87b190 100644
--- a/Zend/zend_compile.c
+++ b/Zend/zend_compile.c
@@ -6320,13 +6320,18 @@ void zend_do_foreach_cont(znode *foreach_token, const 
znode *open_brackets_token
 
GET_NODE(value_node, opline-result);
 
-   if (assign_by_ref) {
-   zend_do_end_variable_parse(value, BP_VAR_W, 0 TSRMLS_CC);
-   /* Mark FE_FETCH as IS_VAR as it holds the data directly as a 
value */
-   zend_do_assign_ref(NULL, value, value_node TSRMLS_CC);
-   } else {
-   zend_do_assign(dummy, value, value_node TSRMLS_CC);
+   if (value-EA  ZEND_PARSED_LIST_EXPR) {
+   zend_do_list_end(dummy, value_node TSRMLS_CC);
zend_do_free(dummy TSRMLS_CC);
+   } else {
+   if (assign_by_ref) {
+   zend_do_end_variable_parse(value, BP_VAR_W, 0 
TSRMLS_CC);
+   /* Mark FE_FETCH as IS_VAR as it holds the data 
directly as a value */
+   zend_do_assign_ref(NULL, value, value_node TSRMLS_CC);
+   } else {
+   zend_do_assign(dummy, value, value_node TSRMLS_CC);
+   zend_do_free(dummy TSRMLS_CC);
+   }
}
 
if (key-op_type != IS_UNUSED) {
diff --git a/Zend/zend_compile.h b/Zend/zend_compile.h
index 9718606..15c2ab7 100644
--- a/Zend/zend_compile.h
+++ b/Zend/zend_compile.h
@@ -725,6 +725,7 @@ int zend_add_literal(zend_op_array *op_array, const zval 
*zv TSRMLS_DC);
 #define ZEND_PARSED_VARIABLE   (14)
 #define ZEND_PARSED_REFERENCE_VARIABLE (15)
 #define ZEND_PARSED_NEW(16)
+#define ZEND_PARSED_LIST_EXPR  (17)
 
 
 /* unset types */
diff --git a/Zend/zend_language_parser.y b/Zend/zend_language_parser.y
index cef82e3..32f35fa 100644
--- a/Zend/zend_language_parser.y
+++ b/Zend/zend_language_parser.y
@@ -310,7 +310,7 @@ unticked_statement:
foreach_statement { zend_do_foreach_end($1, $4 TSRMLS_CC); }
|   T_FOREACH '(' expr_without_variable T_AS
{ zend_do_foreach_begin($1, $2, $3, $4, 0 TSRMLS_CC); }
-   variable foreach_optional_arg ')' { 
zend_check_writable_variable($6); zend_do_foreach_cont($1, $2, $4, $6, $7 
TSRMLS_CC); }
+   foreach_variable foreach_optional_arg ')' { 
zend_check_writable_variable($6); zend_do_foreach_cont($1, $2, $4, $6, $7 
TSRMLS_CC); }
foreach_statement { zend_do_foreach_end($1, $4 TSRMLS_CC); }
|   T_DECLARE

Re: [PHP-CVS] com php-src: Fixed bug (segfault while build with zts and GOTO vm-kind): NEWS Zend/zend_vm_execute.skl Zend/zend_vm_gen.php

2012-08-25 Thread Xinchen Hui
hi:
  In goto vim, execute will be called with empty op_array to
initialize handlers, in this moment the executor globals(zts) is not
be initialized.

  You can have a try without this fix

Thanks

发自我的 iPad

在 2012-8-26,4:17,Nikita Popov nikita@gmail.com 写道:

 I don't understand this changeset. Why is it needed / what bug does it
 fix? If op_array == NULL, won't it return right after that anyway?

 Nikita

 On Sat, Aug 25, 2012 at 3:47 PM, Xinchen Hui larue...@php.net wrote:
 Commit:d92a89fe52e89eef9527d1e27b5bb051ae24bc54
 Author:Xinchen Hui larue...@php.net Sat, 25 Aug 2012 21:47:53 
 +0800
 Parents:   55d680e9682e3218b333d929bf3b24ddfe83c436
 Branches:  PHP-5.3

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

 Log:
 Fixed bug (segfault while build with zts and GOTO vm-kind)

 Changed paths:
  M  NEWS
  M  Zend/zend_vm_execute.skl
  M  Zend/zend_vm_gen.php


 Diff:
 diff --git a/NEWS b/NEWS
 index 9af7977..69cbb2a 100644
 --- a/NEWS
 +++ b/NEWS
 @@ -3,6 +3,7 @@ PHP  
   NEWS
 ?? ??? 2012, PHP 5.3.16

 - Core:
 +  . Fixed bug (segfault while build with zts and GOTO vm-kind). (Laruence)
   . Fixed bug #62763 (register_shutdown_function and extending class).
 (Laruence)
   . Fixed bug #62744 (dangling pointers made by zend_disable_class). 
 (Laruence)
 diff --git a/Zend/zend_vm_execute.skl b/Zend/zend_vm_execute.skl
 index 18d0e29..e5a143e 100644
 --- a/Zend/zend_vm_execute.skl
 +++ b/Zend/zend_vm_execute.skl
 @@ -4,8 +4,8 @@ ZEND_API void {%EXECUTOR_NAME%}(zend_op_array *op_array 
 TSRMLS_DC)
 {
zend_execute_data *execute_data;
zend_bool nested = 0;
 -   zend_bool original_in_execution = EG(in_execution);
{%HELPER_VARS%}
 +   {%EXECUTION_STATUS%}

{%INTERNAL_LABELS%}

 diff --git a/Zend/zend_vm_gen.php b/Zend/zend_vm_gen.php
 index 86d6503..2fff1a9 100644
 --- a/Zend/zend_vm_gen.php
 +++ b/Zend/zend_vm_gen.php
 @@ -850,6 +850,13 @@ function gen_executor($f, $skl, $spec, $kind, 
 $executor_name, $initializer_name,
skip_blanks($f, $m[1], 
 $m[3].\n);
}
break;
 +   case EXECUTION_STATUS:
 +   if ($kind != ZEND_VM_KIND_GOTO) {
 +   out($f, $m[1] . zend_bool 
 original_in_execution = EG(in_execution);\n);
 +   } else {
 +   out($f, $m[1] . zend_bool 
 original_in_execution = op_array? EG(in_execution) : 0;\n);
 +   }
 +   break;
case INTERNAL_LABELS:
if ($kind == ZEND_VM_KIND_GOTO) {
  // Emit array of labels of opcode 
 handlers and code for


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


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



[PHP-CVS] com php-src: Fixed bug #62931 #62932: Zend/zend_compile.c

2012-08-25 Thread Xinchen Hui
Commit:7c60aeef857f288661a6f95cf3aa45d6a6feff9b
Author:Xinchen Hui larue...@php.net Sun, 26 Aug 2012 11:37:05 
+0800
Parents:   35951d4be0bd27c85519995a95429bd0d0a76a00
Branches:  master

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

Log:
Fixed bug #62931  #62932

Bugs:
https://bugs.php.net/62931
https://bugs.php.net/62932

Changed paths:
  M  Zend/zend_compile.c


Diff:
diff --git a/Zend/zend_compile.c b/Zend/zend_compile.c
index b87b190..6efc1e1 100644
--- a/Zend/zend_compile.c
+++ b/Zend/zend_compile.c
@@ -6283,8 +6283,13 @@ void zend_do_foreach_cont(znode *foreach_token, const 
znode *open_brackets_token
opline-extended_value |= ZEND_FE_FETCH_WITH_KEY;
}
 
-   if ((key-op_type != IS_UNUSED)  (key-EA  
ZEND_PARSED_REFERENCE_VARIABLE)) {
+   if ((key-op_type != IS_UNUSED)) {
+   if (key-EA  ZEND_PARSED_REFERENCE_VARIABLE) {
zend_error(E_COMPILE_ERROR, Key element cannot be a 
reference);
+   }
+   if (key-EA  ZEND_PARSED_LIST_EXPR) {
+   zend_error(E_COMPILE_ERROR, Cannot use list as Key element);
+   }
}
 
if (value-EA  ZEND_PARSED_REFERENCE_VARIABLE) {


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



[PHP-CVS] com php-src: tabs: Zend/zend_compile.c

2012-08-25 Thread Xinchen Hui
Commit:c6a5d192c8f23ce54c253decb8be727bddc4f3bf
Author:Xinchen Hui larue...@php.net Sun, 26 Aug 2012 12:27:10 
+0800
Parents:   7c60aeef857f288661a6f95cf3aa45d6a6feff9b
Branches:  master

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

Log:
tabs

Changed paths:
  M  Zend/zend_compile.c


Diff:
diff --git a/Zend/zend_compile.c b/Zend/zend_compile.c
index 6efc1e1..d825792 100644
--- a/Zend/zend_compile.c
+++ b/Zend/zend_compile.c
@@ -6284,12 +6284,12 @@ void zend_do_foreach_cont(znode *foreach_token, const 
znode *open_brackets_token
}
 
if ((key-op_type != IS_UNUSED)) {
-   if (key-EA  ZEND_PARSED_REFERENCE_VARIABLE) {
-   zend_error(E_COMPILE_ERROR, Key element cannot be a 
reference);
-   }
-   if (key-EA  ZEND_PARSED_LIST_EXPR) {
-   zend_error(E_COMPILE_ERROR, Cannot use list as Key element);
-   }
+   if (key-EA  ZEND_PARSED_REFERENCE_VARIABLE) {
+   zend_error(E_COMPILE_ERROR, Key element cannot be a 
reference);
+   }
+   if (key-EA  ZEND_PARSED_LIST_EXPR) {
+   zend_error(E_COMPILE_ERROR, Cannot use list as Key 
element);
+   }
}
 
if (value-EA  ZEND_PARSED_REFERENCE_VARIABLE) {


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



[PHP-CVS] com php-src: Fixed bug #62930, and more tests: Zend/tests/foreach_list.phpt Zend/tests/foreach_list_001.phpt Zend/tests/foreach_list_002.phpt Zend/tests/foreach_list_003.phpt Zend/tests/fore

2012-08-25 Thread Xinchen Hui
Commit:5ebbdecfeaaea1bc78450a2bb6d5ee280bf18dbd
Author:Xinchen Hui larue...@php.net Sun, 26 Aug 2012 13:05:33 
+0800
Parents:   c6a5d192c8f23ce54c253decb8be727bddc4f3bf
Branches:  master

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

Log:
Fixed bug #62930, and more tests

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

Changed paths:
  D  Zend/tests/foreach_list.phpt
  A  Zend/tests/foreach_list_001.phpt
  A  Zend/tests/foreach_list_002.phpt
  A  Zend/tests/foreach_list_003.phpt
  A  Zend/tests/foreach_list_004.phpt
  M  Zend/zend_compile.c


Diff:
diff --git a/Zend/tests/foreach_list.phpt b/Zend/tests/foreach_list.phpt
deleted file mode 100644
index a318f1a..000
--- a/Zend/tests/foreach_list.phpt
+++ /dev/null
@@ -1,43 +0,0 @@
---TEST--
-foreach with list syntax
---FILE--
-?php
-
-foreach(array(array(1,2), array(3,4)) as list($a, $b)) {
-var_dump($a . $b);
-}
-
-$array = array(
-array('a', 'b'),
-array('c', 'd'),
-);
-
-foreach ($array as list($a, $b)) {
-var_dump($a . $b);
-}
-
-
-$multi = array(
-array(array(1,2), array(3,4)),
-array(array(5,6), array(7,8)),
-);
-
-foreach ($multi as list(list($a, $b), list($c, $d))) {
-var_dump($a . $b . $c . $d);
-}
-
-foreach ($multi as $key = list(list($a, $b), list($c, $d))) {
-var_dump($key . $a . $b . $c . $d);
-}
-
-
-?
---EXPECT--
-string(2) 12
-string(2) 34
-string(2) ab
-string(2) cd
-string(4) 1234
-string(4) 5678
-string(5) 01234
-string(5) 15678
diff --git a/Zend/tests/foreach_list_001.phpt b/Zend/tests/foreach_list_001.phpt
new file mode 100644
index 000..a318f1a
--- /dev/null
+++ b/Zend/tests/foreach_list_001.phpt
@@ -0,0 +1,43 @@
+--TEST--
+foreach with list syntax
+--FILE--
+?php
+
+foreach(array(array(1,2), array(3,4)) as list($a, $b)) {
+var_dump($a . $b);
+}
+
+$array = array(
+array('a', 'b'),
+array('c', 'd'),
+);
+
+foreach ($array as list($a, $b)) {
+var_dump($a . $b);
+}
+
+
+$multi = array(
+array(array(1,2), array(3,4)),
+array(array(5,6), array(7,8)),
+);
+
+foreach ($multi as list(list($a, $b), list($c, $d))) {
+var_dump($a . $b . $c . $d);
+}
+
+foreach ($multi as $key = list(list($a, $b), list($c, $d))) {
+var_dump($key . $a . $b . $c . $d);
+}
+
+
+?
+--EXPECT--
+string(2) 12
+string(2) 34
+string(2) ab
+string(2) cd
+string(4) 1234
+string(4) 5678
+string(5) 01234
+string(5) 15678
diff --git a/Zend/tests/foreach_list_002.phpt b/Zend/tests/foreach_list_002.phpt
new file mode 100644
index 000..251870b
--- /dev/null
+++ b/Zend/tests/foreach_list_002.phpt
@@ -0,0 +1,26 @@
+--TEST--
+foreach with freak lists
+--FILE--
+?php
+
+foreach (array(array(1,2), array(3,4)) as list($a, )) {
+var_dump($a);
+}
+
+$array = [['a', 'b'], 'c', 'd'];
+
+foreach($array as list(list(), $a)) {
+   var_dump($a); 
+}
+
+?
+--EXPECTF--
+int(1)
+int(3)
+string(1) b
+
+Notice: Uninitialized string offset: 1 in %sforeach_list_002.php on line %d
+string(0) 
+
+Notice: Uninitialized string offset: 1 in %sforeach_list_002.php on line %d
+string(0) 
diff --git a/Zend/tests/foreach_list_003.phpt b/Zend/tests/foreach_list_003.phpt
new file mode 100644
index 000..8674ecd
--- /dev/null
+++ b/Zend/tests/foreach_list_003.phpt
@@ -0,0 +1,13 @@
+--TEST--
+foreach with list key
+--FILE--
+?php
+
+$array = [['a', 'b'], 'c', 'd'];
+
+foreach($array as list($key) = list(list(), $a)) {
+}
+
+?
+--EXPECTF--
+Fatal error: Cannot use list as key element in %sforeach_list_003.php on line 
%d
diff --git a/Zend/tests/foreach_list_004.phpt b/Zend/tests/foreach_list_004.phpt
new file mode 100644
index 000..fd48e8a
--- /dev/null
+++ b/Zend/tests/foreach_list_004.phpt
@@ -0,0 +1,13 @@
+--TEST--
+foreach with empty list
+--FILE--
+?php
+
+$array = [['a', 'b'], 'c', 'd'];
+
+foreach($array as $key = list()) {
+}
+
+?
+--EXPECTF--
+Fatal error: Cannot use empty list in %sforeach_list_004.php on line %d
diff --git a/Zend/zend_compile.c b/Zend/zend_compile.c
index d825792..704db10 100644
--- a/Zend/zend_compile.c
+++ b/Zend/zend_compile.c
@@ -6288,7 +6288,7 @@ void zend_do_foreach_cont(znode *foreach_token, const 
znode *open_brackets_token
zend_error(E_COMPILE_ERROR, Key element cannot be a 
reference);
}
if (key-EA  ZEND_PARSED_LIST_EXPR) {
-   zend_error(E_COMPILE_ERROR, Cannot use list as Key 
element);
+   zend_error(E_COMPILE_ERROR, Cannot use list as key 
element);
}
}
 
@@ -6326,6 +6326,9 @@ void zend_do_foreach_cont(znode *foreach_token, const 
znode *open_brackets_token
GET_NODE(value_node, opline-result);
 
if (value-EA  ZEND_PARSED_LIST_EXPR) {
+   if (!CG(list_llist).head) {
+   zend_error(E_COMPILE_ERROR, Cannot use empty list);
+   }
zend_do_list_end(dummy, value_node TSRMLS_CC);
zend_do_free(dummy TSRMLS_CC);
} else

[PHP-CVS] com php-src: Fix test: ext/phar/tests/phpinfo_003.phpt

2012-08-24 Thread Xinchen Hui
Commit:7bedd275ebc2c1982dae8abe52cf58d7f7bb9d17
Author:Xinchen Hui larue...@php.net Fri, 24 Aug 2012 18:18:38 
+0800
Parents:   13bcf685cb0a92e502ebe39f4b22c64304a9f333
Branches:  PHP-5.3

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

Log:
Fix test

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


Diff:
diff --git a/ext/phar/tests/phpinfo_003.phpt b/ext/phar/tests/phpinfo_003.phpt
index 031d3cf..04452b0 100644
--- a/ext/phar/tests/phpinfo_003.phpt
+++ b/ext/phar/tests/phpinfo_003.phpt
@@ -24,7 +24,7 @@ Phar
 Phar: PHP Archive support = enabled
 Phar EXT version = %s
 Phar API version = 1.1.1
-SVN revision = %cRevision: %s $
+SVN revision = %s
 Phar-based phar archives = enabled
 Tar-based phar archives = enabled
 ZIP-based phar archives = enabled


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



[PHP-CVS] com php-src: better fix: ext/phar/tests/phpinfo_003.phpt

2012-08-24 Thread Xinchen Hui
Commit:55d680e9682e3218b333d929bf3b24ddfe83c436
Author:Xinchen Hui larue...@php.net Fri, 24 Aug 2012 18:21:49 
+0800
Parents:   7bedd275ebc2c1982dae8abe52cf58d7f7bb9d17
Branches:  PHP-5.3

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

Log:
better fix

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


Diff:
diff --git a/ext/phar/tests/phpinfo_003.phpt b/ext/phar/tests/phpinfo_003.phpt
index 04452b0..045f1a0 100644
--- a/ext/phar/tests/phpinfo_003.phpt
+++ b/ext/phar/tests/phpinfo_003.phpt
@@ -24,7 +24,7 @@ Phar
 Phar: PHP Archive support = enabled
 Phar EXT version = %s
 Phar API version = 1.1.1
-SVN revision = %s
+SVN revision = %cId: %s $
 Phar-based phar archives = enabled
 Tar-based phar archives = enabled
 ZIP-based phar archives = enabled


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



[PHP-CVS] com php-src: Fixed bug #62358 (Segfault when using traits a lot): NEWS Zend/tests/bug62358.phpt Zend/zend_compile.c

2012-08-23 Thread Xinchen Hui
Commit:6d1bebfcb0ad746cd0410d403a3812853a2cd457
Author:Xinchen Hui larue...@php.net Thu, 23 Aug 2012 15:41:49 
+0800
Parents:   64bd4551b4cf7820c2327312d3b335f9a89e8764
Branches:  PHP-5.4

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

Log:
Fixed bug #62358 (Segfault when using traits a lot)

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

Changed paths:
  M  NEWS
  A  Zend/tests/bug62358.phpt
  M  Zend/zend_compile.c


Diff:
diff --git a/NEWS b/NEWS
index de19a20..4420988 100644
--- a/NEWS
+++ b/NEWS
@@ -13,7 +13,7 @@ PHP   
 NEWS
   . Fixed bug #62744 (dangling pointers made by zend_disable_class). (Laruence)
   . Fixed bug #62716 (munmap() is called with the incorrect length).
 (slang...@google.com)
-  . Fixed bug #62460 (php binaries installed as binary.dSYM). (Reeze Xia)
+  . Fixed bug #62358 (Segfault when using traits a lot). (Laruence)
   . Fixed bug #62328 (implementing __toString and a cast to string fails)
 (Laruence)
   . Fixed bug #51363 (Fatal error raised by var_export() not caught by error 
@@ -28,6 +28,9 @@ PHP   
 NEWS
   . Fixed bug #62852 (Unserialize invalid DateTime causes crash).
 (reeze@gmail.com)
 
+- Installation:
+  . Fixed bug #62460 (php binaries installed as binary.dSYM). (Reeze Xia)
+
 - PDO:
   . Fixed bug #62685 (Wrong return datatype in PDO::inTransaction()). 
(Laruence)
 
diff --git a/Zend/tests/bug62358.phpt b/Zend/tests/bug62358.phpt
new file mode 100644
index 000..35d8b48
--- /dev/null
+++ b/Zend/tests/bug62358.phpt
@@ -0,0 +1,32 @@
+--TEST--
+Bug #62358 (Segfault when using traits a lot)
+--SKIPIF--
+?php
+if (getenv(USE_ZEND_ALLOC) !== 0) {
+die(skip Need Zend MM enabled);
+}
+?
+--FILE--
+?php 
+
+trait T {
+public function foo() {
+echo from T;
+}
+}
+
+interface I {
+public function foo();
+}
+
+abstract class A implements I{
+use T;
+}
+
+class B extends A {
+   public function foo($var) {
+   } 
+}
+?
+--EXPECTF--
+Strict Standards: Declaration of B::foo() should be compatible with A::foo() 
in %sbug62358.php on line %d
diff --git a/Zend/zend_compile.c b/Zend/zend_compile.c
index 841e1b9..21e5ca2 100644
--- a/Zend/zend_compile.c
+++ b/Zend/zend_compile.c
@@ -3786,7 +3786,6 @@ static int 
zend_traits_merge_functions_to_class(zend_function *fn TSRMLS_DC, int
}
 
fn-common.scope = ce;
-   fn-common.prototype = prototype;
 
if (prototype
 (prototype-common.fn_flags  
ZEND_ACC_IMPLEMENTED_ABSTRACT
@@ -3801,11 +3800,14 @@ static int 
zend_traits_merge_functions_to_class(zend_function *fn TSRMLS_DC, int
if (prototype) {
do_inheritance_check_on_method(fn, prototype TSRMLS_CC);
}
+
/* one more thing: make sure we properly implement an abstract 
method */
if (existing_fn  existing_fn-common.fn_flags  
ZEND_ACC_ABSTRACT) {
do_inheritance_check_on_method(fn, existing_fn 
TSRMLS_CC);
}
 
+   fn-common.prototype = prototype;
+
/* delete inherited fn if the function to be added is not 
abstract */
if (existing_fn
 existing_fn-common.scope != ce


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



[PHP-CVS] com php-src: Refix #62358, previous has side-affect: Zend/zend_compile.c

2012-08-23 Thread Xinchen Hui
Commit:d39aa984ad3ef79a8fc3db0cf8dc525a0738a7bc
Author:Xinchen Hui larue...@php.net Thu, 23 Aug 2012 16:06:17 
+0800
Parents:   6d1bebfcb0ad746cd0410d403a3812853a2cd457
Branches:  PHP-5.4

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

Log:
Refix #62358, previous has side-affect

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

Changed paths:
  M  Zend/zend_compile.c


Diff:
diff --git a/Zend/zend_compile.c b/Zend/zend_compile.c
index 21e5ca2..4ef4b97 100644
--- a/Zend/zend_compile.c
+++ b/Zend/zend_compile.c
@@ -3786,6 +3786,7 @@ static int 
zend_traits_merge_functions_to_class(zend_function *fn TSRMLS_DC, int
}
 
fn-common.scope = ce;
+   fn-common.prototype = prototype;
 
if (prototype
 (prototype-common.fn_flags  
ZEND_ACC_IMPLEMENTED_ABSTRACT
@@ -3803,11 +3804,11 @@ static int 
zend_traits_merge_functions_to_class(zend_function *fn TSRMLS_DC, int
 
/* one more thing: make sure we properly implement an abstract 
method */
if (existing_fn  existing_fn-common.fn_flags  
ZEND_ACC_ABSTRACT) {
+prototype = fn-common.prototype;
do_inheritance_check_on_method(fn, existing_fn 
TSRMLS_CC);
+fn-common.prototype = prototype;
}
 
-   fn-common.prototype = prototype;
-
/* delete inherited fn if the function to be added is not 
abstract */
if (existing_fn
 existing_fn-common.scope != ce


--
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': Zend/zend_compile.c

2012-08-23 Thread Xinchen Hui
Commit:9b2ca072234c087c4a2ea61bc9474e3bcef8d889
Author:Xinchen Hui larue...@php.net Thu, 23 Aug 2012 16:07:13 
+0800
Parents:   b8800d17019c2d20b0170e680c0cb3089dd09408 
d39aa984ad3ef79a8fc3db0cf8dc525a0738a7bc
Branches:  master

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

Log:
Merge branch 'PHP-5.4'

Changed paths:
  MM  Zend/zend_compile.c


Diff:



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



[PHP-CVS] com php-src: tabs: Zend/zend_compile.c

2012-08-23 Thread Xinchen Hui
Commit:87785c7d5aa197011f3aa747caa122a9190333c4
Author:Xinchen Hui larue...@php.net Thu, 23 Aug 2012 16:13:34 
+0800
Parents:   d39aa984ad3ef79a8fc3db0cf8dc525a0738a7bc
Branches:  PHP-5.4

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

Log:
tabs

Changed paths:
  M  Zend/zend_compile.c


Diff:
diff --git a/Zend/zend_compile.c b/Zend/zend_compile.c
index 4ef4b97..09383c1 100644
--- a/Zend/zend_compile.c
+++ b/Zend/zend_compile.c
@@ -3804,9 +3804,9 @@ static int 
zend_traits_merge_functions_to_class(zend_function *fn TSRMLS_DC, int
 
/* one more thing: make sure we properly implement an abstract 
method */
if (existing_fn  existing_fn-common.fn_flags  
ZEND_ACC_ABSTRACT) {
-prototype = fn-common.prototype;
+   prototype = fn-common.prototype;
do_inheritance_check_on_method(fn, existing_fn 
TSRMLS_CC);
-fn-common.prototype = prototype;
+   fn-common.prototype = prototype;
}
 
/* delete inherited fn if the function to be added is not 
abstract */
@@ -3834,9 +3834,9 @@ static int 
zend_traits_merge_functions_to_class(zend_function *fn TSRMLS_DC, int
if (zend_hash_quick_update(ce-function_table, 
hash_key-arKey, hash_key-nKeyLength, hash_key-h, fn_copy, 
sizeof(zend_function), (void**)fn_copy_p)==FAILURE) {
zend_error(E_COMPILE_ERROR, Trait method %s has not 
been applied, because failure occurred during updating class method table, 
hash_key-arKey);
}
-   
+
zend_add_magic_methods(ce, hash_key-arKey, 
hash_key-nKeyLength, fn_copy_p TSRMLS_CC);
-   
+
zend_function_dtor(fn);
} else {
zend_function_dtor(fn);
@@ -4028,9 +4028,9 @@ static void 
zend_traits_init_trait_structures(zend_class_entry *ce TSRMLS_DC) /*
 
/** And, ensure that the referenced method is 
resolvable, too. */
lcname = 
zend_str_tolower_dup(cur_method_ref-method_name,
-  cur_method_ref-mname_len);
+   cur_method_ref-mname_len);
method_exists = 
zend_hash_exists(cur_method_ref-ce-function_table,
- lcname, cur_method_ref-mname_len + 
1);
+   lcname, 
cur_method_ref-mname_len + 1);
efree(lcname);
 
if (!method_exists) {
@@ -5012,11 +5012,11 @@ void zend_do_begin_class_declaration(const znode 
*class_token, znode *class_name
opline-op2_type = IS_CONST;
 
if (doing_inheritance) {
-   /* Make sure a trait does not try to extend a class */
-   if ((new_class_entry-ce_flags  ZEND_ACC_TRAIT) == ZEND_ACC_TRAIT) {
-   zend_error(E_COMPILE_ERROR, A trait (%s) cannot extend a class. 
Traits can only be composed from other traits with the 'use' keyword. Error, 
new_class_entry-name);
-   }
-
+   /* Make sure a trait does not try to extend a class */
+   if ((new_class_entry-ce_flags  ZEND_ACC_TRAIT) == 
ZEND_ACC_TRAIT) {
+   zend_error(E_COMPILE_ERROR, A trait (%s) cannot extend 
a class. Traits can only be composed from other traits with the 'use' keyword. 
Error, new_class_entry-name);
+   }
+
opline-extended_value = parent_class_name-u.op.var;
opline-opcode = ZEND_DECLARE_INHERITED_CLASS;
} else {
@@ -6961,9 +6961,9 @@ void zend_do_use(znode *ns_name, znode *new_name, int 
is_global TSRMLS_DC) /* {{
lcname = zend_str_tolower_dup(Z_STRVAL_P(name), Z_STRLEN_P(name));
 
if (((Z_STRLEN_P(name) == sizeof(self)-1) 
-  !memcmp(lcname, self, sizeof(self)-1)) ||
-   ((Z_STRLEN_P(name) == sizeof(parent)-1) 
-  !memcmp(lcname, parent, sizeof(parent)-1))) {
+   !memcmp(lcname, self, sizeof(self)-1)) ||
+   ((Z_STRLEN_P(name) == sizeof(parent)-1) 
+  !memcmp(lcname, parent, sizeof(parent)-1))) {
zend_error(E_COMPILE_ERROR, Cannot use %s as %s because '%s' 
is a special class name, Z_STRVAL_P(ns), Z_STRVAL_P(name), Z_STRVAL_P(name));
}


--
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': Zend/zend_compile.c

2012-08-23 Thread Xinchen Hui
Commit:3ef3b80cddcafaa8f9a50d4a57df1debef19d435
Author:Xinchen Hui larue...@php.net Thu, 23 Aug 2012 16:13:57 
+0800
Parents:   9b2ca072234c087c4a2ea61bc9474e3bcef8d889 
87785c7d5aa197011f3aa747caa122a9190333c4
Branches:  master

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

Log:
Merge branch 'PHP-5.4'

Changed paths:
  MM  Zend/zend_compile.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 #62904 (Crash when cloning an object which inherits SplFixedArray): NEWS ext/spl/spl_fixedarray.c ext/spl/tests/bug62904.phpt

2012-08-23 Thread Xinchen Hui
Commit:42f91d6ac6e4c359313ddc90b86067ab9be6a80f
Author:Xinchen Hui larue...@php.net Thu, 23 Aug 2012 23:21:25 
+0800
Parents:   9a72b52a1f36d8eacf122d2bc52be6b792fbb18a
Branches:  PHP-5.4

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

Log:
Fixed bug #62904 (Crash when cloning an object which inherits SplFixedArray)

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

Changed paths:
  M  NEWS
  M  ext/spl/spl_fixedarray.c
  A  ext/spl/tests/bug62904.phpt


Diff:
diff --git a/NEWS b/NEWS
index 4420988..b51f28e 100644
--- a/NEWS
+++ b/NEWS
@@ -46,6 +46,8 @@ PHP   
 NEWS
 when close handler call exit). (Laruence)
 
 - SPL:
+  . Fixed bug #62904 (Crash when cloning an object which inherits 
SplFixedArray)
+(Laruence)
   . Implemented FR #62840 (Add sort flag to ArrayObject::ksort). (Laruence)
 
 - Standard:
diff --git a/ext/spl/spl_fixedarray.c b/ext/spl/spl_fixedarray.c
index 1124285..244bd3e 100644
--- a/ext/spl/spl_fixedarray.c
+++ b/ext/spl/spl_fixedarray.c
@@ -223,10 +223,14 @@ static zend_object_value 
spl_fixedarray_object_new_ex(zend_class_entry *class_ty
if (orig  clone_orig) {
spl_fixedarray_object *other = 
(spl_fixedarray_object*)zend_object_store_get_object(orig TSRMLS_CC);
intern-ce_get_iterator = other-ce_get_iterator;
-
-   intern-array = emalloc(sizeof(spl_fixedarray));
-   spl_fixedarray_init(intern-array, other-array-size 
TSRMLS_CC);
-   spl_fixedarray_copy(intern-array, other-array TSRMLS_CC);
+   if (!other-array) {
+   /* leave a empty object, will be dtor later by CLONE 
handler */
+   zend_throw_exception(spl_ce_RuntimeException, The 
instance wasn't initialized properly, 0 TSRMLS_CC);
+   } else {
+   intern-array = emalloc(sizeof(spl_fixedarray));
+   spl_fixedarray_init(intern-array, other-array-size 
TSRMLS_CC);
+   spl_fixedarray_copy(intern-array, other-array 
TSRMLS_CC);
+   }
}
 
while (parent) {
diff --git a/ext/spl/tests/bug62904.phpt b/ext/spl/tests/bug62904.phpt
new file mode 100644
index 000..7e392da
--- /dev/null
+++ b/ext/spl/tests/bug62904.phpt
@@ -0,0 +1,19 @@
+--TEST--
+Bug #62904 (Crash when cloning an object which inherits SplFixedArray)
+--FILE--
+?php
+
+class foo extends SplFixedArray {   
+public function __construct($size) {
+}
+}
+
+$x = new foo(2);
+
+try {
+$z = clone $x;
+} catch (Exception $e) {
+var_dump($e-getMessage());
+}
+--EXPECTF--
+string(40) The instance wasn't initialized properly


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



[PHP-CVS] com php-src: Fixed bug #62904 (Crash when cloning an object which inherits SplFixedArray): NEWS ext/spl/spl_fixedarray.c ext/spl/tests/bug62904.phpt

2012-08-23 Thread Xinchen Hui
Commit:13bcf685cb0a92e502ebe39f4b22c64304a9f333
Author:Xinchen Hui larue...@php.net Thu, 23 Aug 2012 23:27:16 
+0800
Parents:   eca4fc69918c856966298435bd1133e55a3c8e58
Branches:  PHP-5.3

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

Log:
Fixed bug #62904 (Crash when cloning an object which inherits SplFixedArray)

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

Changed paths:
  M  NEWS
  M  ext/spl/spl_fixedarray.c
  A  ext/spl/tests/bug62904.phpt


Diff:
diff --git a/NEWS b/NEWS
index 8492aa6..9af7977 100644
--- a/NEWS
+++ b/NEWS
@@ -39,6 +39,8 @@ PHP   
 NEWS
   . Fixed bug (segfault due to retval is not initialized). (Laruence)
 
 - SPL:
+  . Fixed bug #62904 (Crash when cloning an object which inherits 
SplFixedArray)
+(Laruence)
   . Fixed bug #62616 (ArrayIterator::count() from IteratorIterator instance
 gives Segmentation fault). (Laruence, Gustavo)
 
diff --git a/ext/spl/spl_fixedarray.c b/ext/spl/spl_fixedarray.c
index ee8f51e..0aac6d3 100644
--- a/ext/spl/spl_fixedarray.c
+++ b/ext/spl/spl_fixedarray.c
@@ -223,10 +223,14 @@ static zend_object_value 
spl_fixedarray_object_new_ex(zend_class_entry *class_ty
if (orig  clone_orig) {
spl_fixedarray_object *other = 
(spl_fixedarray_object*)zend_object_store_get_object(orig TSRMLS_CC);
intern-ce_get_iterator = other-ce_get_iterator;
-
-   intern-array = emalloc(sizeof(spl_fixedarray));
-   spl_fixedarray_init(intern-array, other-array-size 
TSRMLS_CC);
-   spl_fixedarray_copy(intern-array, other-array TSRMLS_CC);
+   if (!other-array) {
+   /* leave a empty object, will be dtor later by CLONE 
handler */
+   zend_throw_exception(spl_ce_RuntimeException, The 
instance wasn't initialized properly, 0 TSRMLS_CC);
+   } else {
+   intern-array = emalloc(sizeof(spl_fixedarray));
+   spl_fixedarray_init(intern-array, other-array-size 
TSRMLS_CC);
+   spl_fixedarray_copy(intern-array, other-array 
TSRMLS_CC);
+   }
}
 
while (parent) {
diff --git a/ext/spl/tests/bug62904.phpt b/ext/spl/tests/bug62904.phpt
new file mode 100644
index 000..7e392da
--- /dev/null
+++ b/ext/spl/tests/bug62904.phpt
@@ -0,0 +1,19 @@
+--TEST--
+Bug #62904 (Crash when cloning an object which inherits SplFixedArray)
+--FILE--
+?php
+
+class foo extends SplFixedArray {   
+public function __construct($size) {
+}
+}
+
+$x = new foo(2);
+
+try {
+$z = clone $x;
+} catch (Exception $e) {
+var_dump($e-getMessage());
+}
+--EXPECTF--
+string(40) The instance wasn't initialized properly


--
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': ext/spl/spl_fixedarray.c

2012-08-23 Thread Xinchen Hui
Commit:a3d701e11ceb0c8cf823392731fd94215cb881bc
Author:Xinchen Hui larue...@php.net Thu, 23 Aug 2012 23:28:24 
+0800
Parents:   8b0a87f1c3fea6f0a1b1953a5a639e0880149466 
21f085720cbb8967d6f7826a18e2ce71b6f0e216
Branches:  master

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

Log:
Merge branch 'PHP-5.4'

Changed paths:
  MM  ext/spl/spl_fixedarray.c


Diff:



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



[PHP-CVS] com php-src: stash: Zend/zend_compile.c Zend/zend_compile.h Zend/zend_opcode.c Zend/zend_vm_def.h Zend/zend_vm_execute.h

2012-08-22 Thread Xinchen Hui
Commit:703a4e390de277afb85d722a0792912d0b2d2d46
Author:Xinchen Hui larue...@php.net Wed, 22 Aug 2012 13:51:44 
+0800
Parents:   c4fecc1c5d44481a4088f6028ce6910f2ce4e0dc
Branches:  master

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

Log:
stash

Changed paths:
  M  Zend/zend_compile.c
  M  Zend/zend_compile.h
  M  Zend/zend_opcode.c
  M  Zend/zend_vm_def.h
  M  Zend/zend_vm_execute.h

diff --git a/Zend/zend_compile.c b/Zend/zend_compile.c
index 33d1d37..2ae8cc5 100644
--- a/Zend/zend_compile.c
+++ b/Zend/zend_compile.c
@@ -2792,6 +2792,7 @@ void zend_do_end_finally(znode *try_token, znode* 
catch_token, znode *finally_to
zend_op *opline = get_next_op(CG(active_op_array) TSRMLS_CC);

CG(active_op_array)-try_catch_array[try_token-u.op.opline_num].finally_op = 
finally_token-u.op.opline_num;

CG(active_op_array)-try_catch_array[try_token-u.op.opline_num].finally_end = 
get_next_op_number(CG(active_op_array));
+CG(active_op_array)-has_finally_block = 1;
 
opline-opcode = ZEND_LEAVE;
SET_UNUSED(opline-op1);
diff --git a/Zend/zend_compile.h b/Zend/zend_compile.h
index 8919fdc..80e02ab 100644
--- a/Zend/zend_compile.h
+++ b/Zend/zend_compile.h
@@ -281,6 +281,7 @@ struct _zend_op_array {
 
zend_try_catch_element *try_catch_array;
int last_try_catch;
+zend_bool has_finally_block;
 
/* static variables support */
HashTable *static_variables;
@@ -383,7 +384,8 @@ struct _zend_execute_data {
zend_class_entry *current_called_scope;
zval *current_this;
zval *current_object;
-zend_bool leaving;
+zend_uint leaving;
+zend_uint leaving_dest;
 };
 
 #define EX(element) execute_data.element
diff --git a/Zend/zend_opcode.c b/Zend/zend_opcode.c
index 7cbc15b..2552d2e 100644
--- a/Zend/zend_opcode.c
+++ b/Zend/zend_opcode.c
@@ -87,6 +87,7 @@ void init_op_array(zend_op_array *op_array, zend_uchar type, 
int initial_ops_siz
 
op_array-static_variables = NULL;
op_array-last_try_catch = 0;
+op_array-has_finally_block = 0;
 
op_array-this_var = -1;
 
diff --git a/Zend/zend_vm_def.h b/Zend/zend_vm_def.h
index 1da4c12..d921f81 100644
--- a/Zend/zend_vm_def.h
+++ b/Zend/zend_vm_def.h
@@ -2878,49 +2878,10 @@ ZEND_VM_HANDLER(62, ZEND_RETURN, CONST|TMP|VAR|CV, ANY)
}
FREE_OP1_IF_VAR();
 
-   if (!(EG(active_op_array)-last_try_catch)) {
-   ZEND_VM_DISPATCH_TO_HELPER(zend_leave_helper);
-   } else {
-   zend_uint i, op_num = opline - EX(op_array)-opcodes;
-   zend_uint catch_op_num = 0, finally_op_num = 0;
-   for (i=0; iEG(active_op_array)-last_try_catch; i++) {
-   if (EG(active_op_array)-try_catch_array[i].try_op  
op_num) {
-   break;
-   } 
-   if (op_num  
EG(active_op_array)-try_catch_array[i].finally_op) {
-   finally_op_num = 
EG(active_op_array)-try_catch_array[i].finally_op;
-   }
-   if (EG(prev_exception)) {
-   /* leaving */
-   if (op_num  
EG(active_op_array)-try_catch_array[i].catch_op) {
-   catch_op_num = 
EG(active_op_array)-try_catch_array[i].catch_op;
-   }
-   }
-   }
-
-   if (catch_op_num  finally_op_num) {
-   if (catch_op_num  finally_op_num) {
-   EX(leaving) = 1;
-   
ZEND_VM_SET_OPCODE(EX(op_array)-opcodes[finally_op_num]);
-   ZEND_VM_CONTINUE();
-   } else {
-   EX(leaving) = 0;
-   
ZEND_VM_SET_OPCODE(EX(op_array)-opcodes[catch_op_num]);
-   ZEND_VM_CONTINUE();
-   }
-   } else if (catch_op_num) {
-   
ZEND_VM_SET_OPCODE(EX(op_array)-opcodes[catch_op_num]);
-   ZEND_VM_CONTINUE();
-   } else if (finally_op_num) {
-   EX(leaving) = 1;
-   
ZEND_VM_SET_OPCODE(EX(op_array)-opcodes[finally_op_num]);
-   ZEND_VM_CONTINUE();
-   } else if (EX(leaving)) {
-   ZEND_VM_NEXT_OPCODE();
-   } else {
-   ZEND_VM_DISPATCH_TO_HELPER(zend_leave_helper);
-   }
-   }
+if (EG(active_op_array)-has_finally_block) {
+ZEND_VM_DISPATCH_TO_HELPER_EX(zend_finally_handler_leaving, type, 
ZEND_RETURN);
+}
+ZEND_VM_DISPATCH_TO_HELPER(zend_leave_helper);
 }
 
 ZEND_VM_HANDLER(111, ZEND_RETURN_BY_REF, CONST|TMP|VAR|CV, ANY)
@@ -2993,49 +2954,10

[PHP-CVS] com php-src: Move test files to tests dir: ext/intl/symfony_format_type_double_intl1.phpt ext/intl/symfony_format_type_double_intl2.phpt ext/intl/symfony_format_type_double_intl3.phpt ext/in

2012-08-21 Thread Xinchen Hui
Commit:0cdc1f5626bd400278aa193867e1fd4fe3f771d4
Author:Reeze Xia reeze@gmail.com Tue, 21 Aug 2012 14:32:39 
+0800
Parents:   b9a050100ce430db758ff791914e88478b2814b8
Branches:  PHP-5.3

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

Log:
Move test files to tests dir

There are 7 files duplicated, so those files was deleted

Changed paths:
  D  ext/intl/symfony_format_type_double_intl1.phpt
  D  ext/intl/symfony_format_type_double_intl2.phpt
  D  ext/intl/symfony_format_type_double_intl3.phpt
  D  ext/intl/symfony_format_type_double_intl4.phpt
  D  ext/intl/symfony_format_type_int32_intl1.phpt
  D  ext/intl/symfony_format_type_int32_intl2.phpt
  D  ext/intl/symfony_format_type_int32_intl3.phpt
  D  ext/intl/symfony_format_type_int32_intl4.phpt
  D  ext/intl/symfony_format_type_int32_intl5.phpt
  D  ext/intl/symfony_format_type_int32_intl6.phpt
  D  ext/intl/symfony_format_type_int32_intl7.phpt
  D  ext/intl/symfony_format_type_int64_intl1.phpt
  D  ext/intl/symfony_format_type_int64_intl2.phpt
  D  ext/intl/symfony_format_type_int64_intl3.phpt
  D  ext/intl/symfony_format_type_int64_intl4.phpt
  D  ext/intl/symfony_format_type_int64_intl5.phpt
  D  ext/intl/symfony_format_type_int64_intl6.phpt
  D  ext/intl/symfony_format_type_int64_intl7.phpt
  D  ext/intl/symfony_format_type_int64_intl8.phpt
  A  ext/intl/tests/symfony_format_type_double_intl1.phpt
  A  ext/intl/tests/symfony_format_type_double_intl2.phpt
  A  ext/intl/tests/symfony_format_type_double_intl3.phpt
  A  ext/intl/tests/symfony_format_type_double_intl4.phpt
  A  ext/intl/tests/symfony_format_type_int64_intl1.phpt
  A  ext/intl/tests/symfony_format_type_int64_intl2.phpt
  A  ext/intl/tests/symfony_format_type_int64_intl3.phpt
  A  ext/intl/tests/symfony_format_type_int64_intl4.phpt
  A  ext/intl/tests/symfony_format_type_int64_intl5.phpt
  A  ext/intl/tests/symfony_format_type_int64_intl6.phpt
  A  ext/intl/tests/symfony_format_type_int64_intl7.phpt
  A  ext/intl/tests/symfony_format_type_int64_intl8.phpt

diff --git a/ext/intl/symfony_format_type_double_intl1.phpt 
b/ext/intl/symfony_format_type_double_intl1.phpt
deleted file mode 100644
index 13a7ad7..000
--- a/ext/intl/symfony_format_type_double_intl1.phpt
+++ /dev/null
@@ -1,30 +0,0 @@
---TEST--
-Symfony StubNumberFormatterTest#testFormatTypeDoubleIntl #1
---SKIPIF--
-?php if( !extension_loaded( 'intl' ) ) print 'skip'; ?
---FILE--
-?php
-
-
-// PHP Unit's code to unserialize data passed as args to 
#testFormatTypeDoubleIntl
-$unit_test_args = 
unserialize('a:3:{i:0;O:15:NumberFormatter:0:{}i:1;i:1;i:2;s:1:1;}');
-
-var_dump($unit_test_args);
-
-// execute the code from #testFormatTypeDoubleIntl
-$unit_test_args[0]-format($unit_test_args[1], \NumberFormatter::TYPE_DOUBLE);
-
-echo == didn't crash ==.PHP_EOL;
-
-?
---EXPECT--
-array(3) {
-  [0]=
-  object(NumberFormatter)#1 (0) {
-  }
-  [1]=
-  int(1)
-  [2]=
-  string(1) 1
-}
-== didn't crash ==
diff --git a/ext/intl/symfony_format_type_double_intl2.phpt 
b/ext/intl/symfony_format_type_double_intl2.phpt
deleted file mode 100644
index 6bff7cc..000
--- a/ext/intl/symfony_format_type_double_intl2.phpt
+++ /dev/null
@@ -1,30 +0,0 @@
---TEST--
-Symfony StubNumberFormatterTest#testFormatTypeDoubleIntl #2
---SKIPIF--
-?php if( !extension_loaded( 'intl' ) ) print 'skip'; ?
---FILE--
-?php
-
-
-// PHP Unit's code to unserialize data passed as args to 
#testFormatTypeDoubleIntl
-$unit_test_args = 
unserialize('a:3:{i:0;O:15:NumberFormatter:0:{}i:1;d:1.1001;i:2;s:3:1.1;}');
-
-var_dump($unit_test_args);
-
-// execute the code from #testFormatTypeDoubleIntl
-$unit_test_args[0]-format($unit_test_args[1], \NumberFormatter::TYPE_DOUBLE);
-
-echo == didn't crash ==.PHP_EOL;
-
-?
---EXPECT--
-array(3) {
-  [0]=
-  object(NumberFormatter)#1 (0) {
-  }
-  [1]=
-  float(1.1)
-  [2]=
-  string(3) 1.1
-}
-== didn't crash ==
diff --git a/ext/intl/symfony_format_type_double_intl3.phpt 
b/ext/intl/symfony_format_type_double_intl3.phpt
deleted file mode 100644
index 3b0d576..000
--- a/ext/intl/symfony_format_type_double_intl3.phpt
+++ /dev/null
@@ -1,30 +0,0 @@
---TEST--
-Symfony StubNumberFormatterTest#testFormatTypeDoubleIntl #3
---SKIPIF--
-?php if( !extension_loaded( 'intl' ) ) print 'skip'; ?
---FILE--
-?php
-
-
-// PHP Unit's code to unserialize data passed as args to 
#testFormatTypeDoubleIntl
-$unit_test_args = 
unserialize('a:3:{i:0;O:15:NumberFormatter:0:{}i:1;i:1;i:2;s:7:SFD1.00;}');
-
-var_dump($unit_test_args);
-
-// execute the code from #testFormatTypeDoubleIntl
-$unit_test_args[0]-format($unit_test_args[1], \NumberFormatter::TYPE_DOUBLE);
-
-echo == didn't crash ==.PHP_EOL;
-
-?
---EXPECT--
-array(3) {
-  [0]=
-  object(NumberFormatter)#1 (0) {
-  }
-  [1]=
-  int(1)
-  [2]=
-  string(7) SFD1.00
-}
-== didn't crash ==
diff --git a/ext/intl/symfony_format_type_double_intl4.phpt 
b/ext/intl/symfony_format_type_double_intl4.phpt
deleted file mode 

[PHP-CVS] com php-src: skip test properly: ext/mysql/tests/mysql_query_load_data_openbasedir.phpt

2012-08-21 Thread Xinchen Hui
Commit:cd34067aecdd98e513f20d804f8fb1d278c9729a
Author:Xinchen Hui larue...@php.net Tue, 21 Aug 2012 22:15:54 
+0800
Parents:   3d4c9b7655b00bab34a9e4b5e829d137e65bd418
Branches:  PHP-5.4

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

Log:
skip test properly

Changed paths:
  M  ext/mysql/tests/mysql_query_load_data_openbasedir.phpt


Diff:
diff --git a/ext/mysql/tests/mysql_query_load_data_openbasedir.phpt 
b/ext/mysql/tests/mysql_query_load_data_openbasedir.phpt
index 339d36c..aa15f5c 100644
--- a/ext/mysql/tests/mysql_query_load_data_openbasedir.phpt
+++ b/ext/mysql/tests/mysql_query_load_data_openbasedir.phpt
@@ -2,7 +2,6 @@
 LOAD DATA INFILE - open_basedir
 --SKIPIF--
 ?php
-@include_once(connect.inc);
 include_once('skipif.inc');
 include_once('skipifconnectfailure.inc');


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



[PHP-CVS] com php-src: skip test properly: ext/mysql/tests/mysql_query_load_data_openbasedir.phpt

2012-08-21 Thread Xinchen Hui
Commit:60ad16e11f97fb58f736577c2cf9fef9f109b97a
Author:Xinchen Hui larue...@php.net Tue, 21 Aug 2012 22:11:11 
+0800
Parents:   92153dcfe3f7643526572439622408d94fd4aa14
Branches:  PHP-5.3

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

Log:
skip test properly

Changed paths:
  M  ext/mysql/tests/mysql_query_load_data_openbasedir.phpt


Diff:
diff --git a/ext/mysql/tests/mysql_query_load_data_openbasedir.phpt 
b/ext/mysql/tests/mysql_query_load_data_openbasedir.phpt
index c2685a5..474065f 100644
--- a/ext/mysql/tests/mysql_query_load_data_openbasedir.phpt
+++ b/ext/mysql/tests/mysql_query_load_data_openbasedir.phpt
@@ -2,13 +2,12 @@
 LOAD DATA INFILE - open_basedir
 --SKIPIF--
 ?php
-@include_once(connect.inc);
+include_once('skipif.inc');
 
 if (!isset($db)) {
   die(skip open_basedir setting prevents inclusing of required files);
 }
 
-include_once('skipif.inc');
 include_once('skipifconnectfailure.inc');


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



[PHP-CVS] com php-src: Fixed bug #62885 (mysqli_poll - Segmentation fault): NEWS ext/mysqli/mysqli_nonapi.c ext/mysqli/tests/bug62885.phpt

2012-08-21 Thread Xinchen Hui
Commit:e5bdd2c0eeab50dc1f863dae9a32d3857ece6a79
Author:Xinchen Hui larue...@php.net Wed, 22 Aug 2012 13:41:47 
+0800
Parents:   85fa4d7747b79852474928bcd201c40de86b0bec
Branches:  PHP-5.3

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

Log:
Fixed bug #62885 (mysqli_poll - Segmentation fault)

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

Changed paths:
  M  NEWS
  M  ext/mysqli/mysqli_nonapi.c
  A  ext/mysqli/tests/bug62885.phpt


Diff:
diff --git a/NEWS b/NEWS
index b796117..3d156c1 100644
--- a/NEWS
+++ b/NEWS
@@ -22,6 +22,9 @@ PHP   
 NEWS
 (reeze@gmail.com)
   . Fixed bug #62500 (Segfault in DateInterval class when extended). (Laruence)
 
+- MySQLnd:
+  . Fixed bug #62885 (mysqli_poll - Segmentation fault). (Laruence)
+
 - PDO:
   . Fixed bug #62685 (Wrong return datatype in PDO::inTransaction()). 
(Laruence)
 
diff --git a/ext/mysqli/mysqli_nonapi.c b/ext/mysqli/mysqli_nonapi.c
index fbfc02e..0ef67a2 100644
--- a/ext/mysqli/mysqli_nonapi.c
+++ b/ext/mysqli/mysqli_nonapi.c
@@ -705,6 +705,11 @@ PHP_FUNCTION(mysqli_poll)
RETURN_FALSE;
}
 
+   if (!r_array  !e_array) {
+   php_error_docref(NULL TSRMLS_CC, E_WARNING, No stream arrays 
were passed);
+   RETURN_FALSE;
+   }
+
if (r_array != NULL) {
mysqlnd_zval_array_to_mysqlnd_array(r_array, new_r_array 
TSRMLS_CC);
}
diff --git a/ext/mysqli/tests/bug62885.phpt b/ext/mysqli/tests/bug62885.phpt
new file mode 100644
index 000..9fb0aa0
--- /dev/null
+++ b/ext/mysqli/tests/bug62885.phpt
@@ -0,0 +1,26 @@
+--TEST--
+Bug #62885 (mysqli_poll - Segmentation fault)
+--SKIPIF--
+?php
+require_once('skipif.inc');
+require_once(connect.inc);
+if (!$IS_MYSQLND) {
+die(skip mysqlnd only test);
+}
+?
+--FILE--
+?php
+error_reporting(E_ALL);
+$tablica = array();
+$test1 = mysqli_poll($test2, $test3, $tablica, null);
+
+$test2 = array();
+$test2 = array();
+$test1 = mysqli_poll($test2, $test3, $tablica, null);
+echo okey;
+?
+--EXPECTF--
+Warning: mysqli_poll(): No stream arrays were passed in %sbug62885.php on line 
%d
+
+Warning: mysqli_poll(): No stream arrays were passed in %sbug62885.php on line 
%d
+okey


--
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.3' into PHP-5.4: ext/mysqli/mysqli_nonapi.c

2012-08-21 Thread Xinchen Hui
Commit:4e561055a46fc68077300b8ec25490a198e82560
Author:Xinchen Hui larue...@php.net Wed, 22 Aug 2012 13:49:04 
+0800
Parents:   b0dbf714666516ac191bcc5f31498352ffbcb13c 
e5bdd2c0eeab50dc1f863dae9a32d3857ece6a79
Branches:  PHP-5.4

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

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

Changed paths:
  MM  ext/mysqli/mysqli_nonapi.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.4': ext/mysqli/mysqli_nonapi.c

2012-08-21 Thread Xinchen Hui
Commit:2af7a76822147c11f44b6a907b393fbd6ad74167
Author:Xinchen Hui larue...@php.net Wed, 22 Aug 2012 13:52:04 
+0800
Parents:   8830cd5be433070bd7891af734de9c71ed9ebd92 
4e561055a46fc68077300b8ec25490a198e82560
Branches:  master

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

Log:
Merge branch 'PHP-5.4'

Changed paths:
  MM  ext/mysqli/mysqli_nonapi.c


Diff:



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



[PHP-CVS] com php-src: skip test for bug 43130 on firebird , not relevant: ext/pdo/tests/bug_43130.phpt

2012-08-20 Thread Xinchen Hui
Commit:33d872d9f3fff72f496a018a19e02ab632ccadbb
Author:Popa Marius Adrian map...@gmail.com Mon, 20 Aug 2012 
17:25:56 +0300
Parents:   9ccf85419849db587a973673e382faf3b3a9db43
Branches:  master

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

Log:
skip test for bug 43130 on firebird , not relevant

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

Changed paths:
  M  ext/pdo/tests/bug_43130.phpt


Diff:
diff --git a/ext/pdo/tests/bug_43130.phpt b/ext/pdo/tests/bug_43130.phpt
index a35138a..70f8887 100644
--- a/ext/pdo/tests/bug_43130.phpt
+++ b/ext/pdo/tests/bug_43130.phpt
@@ -8,6 +8,7 @@ if (false == $dir) die('skip no driver');
 if (!strncasecmp(getenv('PDOTEST_DSN'), 'sqlite', strlen('sqlite'))) die('skip 
not relevant for sqlite driver');
 if (!strncasecmp(getenv('PDOTEST_DSN'), 'pgsql', strlen('pgsql'))) die('skip 
not relevant for pgsql driver');
 if (!strncasecmp(getenv('PDOTEST_DSN'), 'oci', strlen('oci'))) die('skip not 
relevant for oci driver - Hyphen is not legal for bind names in Oracle DB');
+if (!strncasecmp(getenv('PDOTEST_DSN'), 'firebird', strlen('firebird'))) 
die('skip not relevant for firebird driver');
 require_once $dir . 'pdo_test.inc';
 PDOTest::skip();
 ?


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



[PHP-CVS] com php-src: skip test for bug 43130 on firebird , not relevant: ext/pdo/tests/bug_43130.phpt

2012-08-20 Thread Xinchen Hui
Commit:b9a050100ce430db758ff791914e88478b2814b8
Author:Popa Adrian Marius map...@reea.net Mon, 20 Aug 2012 
16:56:37 +0300
Parents:   f4054afe40bd2b1876832b01f6cbae8f8236d2aa
Branches:  PHP-5.3

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

Log:
skip test for bug 43130 on firebird , not relevant

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

Changed paths:
  M  ext/pdo/tests/bug_43130.phpt


Diff:
diff --git a/ext/pdo/tests/bug_43130.phpt b/ext/pdo/tests/bug_43130.phpt
index a35138a..70f8887 100644
--- a/ext/pdo/tests/bug_43130.phpt
+++ b/ext/pdo/tests/bug_43130.phpt
@@ -8,6 +8,7 @@ if (false == $dir) die('skip no driver');
 if (!strncasecmp(getenv('PDOTEST_DSN'), 'sqlite', strlen('sqlite'))) die('skip 
not relevant for sqlite driver');
 if (!strncasecmp(getenv('PDOTEST_DSN'), 'pgsql', strlen('pgsql'))) die('skip 
not relevant for pgsql driver');
 if (!strncasecmp(getenv('PDOTEST_DSN'), 'oci', strlen('oci'))) die('skip not 
relevant for oci driver - Hyphen is not legal for bind names in Oracle DB');
+if (!strncasecmp(getenv('PDOTEST_DSN'), 'firebird', strlen('firebird'))) 
die('skip not relevant for firebird driver');
 require_once $dir . 'pdo_test.inc';
 PDOTest::skip();
 ?


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



[PHP-CVS] com php-src: Implemented FR #62840 (Add sort flag to ArrayObject::ksort): NEWS ext/spl/spl_array.c ext/spl/tests/arrayObject_asort_basic1.phpt ext/spl/tests/arrayObject_ksort_basic1.phpt

2012-08-20 Thread Xinchen Hui
Commit:8722173ad5d3132bfefbeb753c29e246876b0492
Author:Xinchen Hui larue...@php.net Tue, 21 Aug 2012 13:32:15 
+0800
Parents:   c54d73d54c8e2166f680b3db03238d5263a451c1
Branches:  PHP-5.4

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

Log:
Implemented FR #62840 (Add sort flag to ArrayObject::ksort)

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

Changed paths:
  M  NEWS
  M  ext/spl/spl_array.c
  M  ext/spl/tests/arrayObject_asort_basic1.phpt
  M  ext/spl/tests/arrayObject_ksort_basic1.phpt


Diff:
diff --git a/NEWS b/NEWS
index 27a34c3..d60f51b 100644
--- a/NEWS
+++ b/NEWS
@@ -38,6 +38,9 @@ PHP   
 NEWS
   . Fixed bug (segfault due to PS(mod_user_implemented) not be reseted 
 when close handler call exit). (Laruence)
 
+- SPL:
+  . Implemented FR #62840 (Add sort flag to ArrayObject::ksort). (Laruence)
+
 - Standard:
   . Fixed bug #62836 (Seg fault or broken object references on unserialize()).
 (Laruence)
diff --git a/ext/spl/spl_array.c b/ext/spl/spl_array.c
index e2ea17a..1e4577a 100755
--- a/ext/spl/spl_array.c
+++ b/ext/spl/spl_array.c
@@ -58,6 +58,10 @@ PHPAPI zend_class_entry  *spl_ce_RecursiveArrayIterator;
 #define SPL_ARRAY_INT_MASK   0x
 #define SPL_ARRAY_CLONE_MASK 0x0300
 
+#define SPL_ARRAY_METHOD_NO_ARG0
+#define SPL_ARRAY_METHOD_USE_ARG   1
+#define SPL_ARRAY_METHOD_MAY_USER_ARG  2
+
 typedef struct _spl_array_object {
zend_object   std;
zval  *array;
@@ -1426,26 +1430,36 @@ static void 
spl_array_method(INTERNAL_FUNCTION_PARAMETERS, char *fname, int fnam
 {
spl_array_object *intern = 
(spl_array_object*)zend_object_store_get_object(getThis() TSRMLS_CC);
HashTable *aht = spl_array_get_hash_table(intern, 0 TSRMLS_CC);
-   zval *tmp, *arg;
+   zval *tmp, *arg = NULL;
zval *retval_ptr = NULL;

MAKE_STD_ZVAL(tmp);
Z_TYPE_P(tmp) = IS_ARRAY;
Z_ARRVAL_P(tmp) = aht;

-   if (use_arg) {
-   if (ZEND_NUM_ARGS() != 1 || 
zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS() TSRMLS_CC, 
z, arg) == FAILURE) {
+   if (!use_arg) {
+   aht-nApplyCount++;
+   zend_call_method(NULL, NULL, NULL, fname, fname_len, 
retval_ptr, 1, tmp, NULL TSRMLS_CC);
+   aht-nApplyCount--;
+   } else if (use_arg == SPL_ARRAY_METHOD_MAY_USER_ARG) {
+   if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, 
ZEND_NUM_ARGS() TSRMLS_CC, |z, arg) == FAILURE) {
Z_TYPE_P(tmp) = IS_NULL;
zval_ptr_dtor(tmp);
-   zend_throw_exception(spl_ce_BadMethodCallException, 
Function expects exactly one argument, 0 TSRMLS_CC);
+   zend_throw_exception(spl_ce_BadMethodCallException, 
Function expects one argument at most, 0 TSRMLS_CC);
return;
}
aht-nApplyCount++;
-   zend_call_method(NULL, NULL, NULL, fname, fname_len, 
retval_ptr, 2, tmp, arg TSRMLS_CC);
+   zend_call_method(NULL, NULL, NULL, fname, fname_len, 
retval_ptr, arg? 2 : 1, tmp, arg TSRMLS_CC);
aht-nApplyCount--;
} else {
+   if (ZEND_NUM_ARGS() != 1 || 
zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS() TSRMLS_CC, 
z, arg) == FAILURE) {
+   Z_TYPE_P(tmp) = IS_NULL;
+   zval_ptr_dtor(tmp);
+   zend_throw_exception(spl_ce_BadMethodCallException, 
Function expects exactly one argument, 0 TSRMLS_CC);
+   return;
+   }
aht-nApplyCount++;
-   zend_call_method(NULL, NULL, NULL, fname, fname_len, 
retval_ptr, 1, tmp, NULL TSRMLS_CC);
+   zend_call_method(NULL, NULL, NULL, fname, fname_len, 
retval_ptr, 2, tmp, arg TSRMLS_CC);
aht-nApplyCount--;
}
Z_TYPE_P(tmp) = IS_NULL; /* we want to destroy the zval, not the 
hashtable */
@@ -1461,35 +1475,35 @@ SPL_METHOD(cname, fname) \
spl_array_method(INTERNAL_FUNCTION_PARAM_PASSTHRU, #fname, 
sizeof(#fname)-1, use_arg); \
 }
 
-/* {{{ proto int ArrayObject::asort()
-   proto int ArrayIterator::asort()
+/* {{{ proto int ArrayObject::asort([int $sort_flags = SORT_REGULAR ])
+   proto int ArrayIterator::asort([int $sort_flags = SORT_REGULAR ])
Sort the entries by values. */
-SPL_ARRAY_METHOD(Array, asort, 0) /* }}} */
+SPL_ARRAY_METHOD(Array, asort, SPL_ARRAY_METHOD_MAY_USER_ARG) /* }}} */
 
-/* {{{ proto int ArrayObject::ksort()
-   proto int ArrayIterator::ksort()
+/* {{{ proto int ArrayObject::ksort([int $sort_flags = SORT_REGULAR ])
+   proto int ArrayIterator::ksort([int $sort_flags = SORT_REGULAR ])
Sort the entries by key

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

2012-08-19 Thread Xinchen Hui
Commit:8b87c6df8408b95a1bfae4a82958a48e3a220b5a
Author:Xinchen Hui larue...@php.net Sun, 19 Aug 2012 18:33:06 
+0800
Parents:   46a3f257724df7b85cc8c3e6374c36ed9ee783b4
Branches:  PHP-5.3

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

Log:
Update NEWS

Changed paths:
  M  NEWS


Diff:
diff --git a/NEWS b/NEWS
index 7f5c48b..b796117 100644
--- a/NEWS
+++ b/NEWS
@@ -18,6 +18,8 @@ PHP   
 NEWS
 (r.hampartsum...@gmail.com, Laruence)
 
 - DateTime:
+  . Fixed bug #62852 (Unserialize invalid DateTime causes crash).
+(reeze@gmail.com)
   . Fixed bug #62500 (Segfault in DateInterval class when extended). (Laruence)
 
 - PDO:


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



[PHP-CVS] com php-src: Fixed bug #62852 (Unserialize invalid DateTime causes crash): ext/date/php_date.c ext/date/tests/bug62852.phpt

2012-08-19 Thread Xinchen Hui
Commit:46a3f257724df7b85cc8c3e6374c36ed9ee783b4
Author:Reeze Xia reeze@gmail.com Sun, 19 Aug 2012 17:57:45 
+0800
Parents:   1a23d42909070269d53fc7500d683e88ba219cb3
Branches:  PHP-5.3

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

Log:
Fixed bug #62852 (Unserialize invalid DateTime causes crash)

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

Changed paths:
  M  ext/date/php_date.c
  A  ext/date/tests/bug62852.phpt


Diff:
diff --git a/ext/date/php_date.c b/ext/date/php_date.c
index e8a4570..d9e6a28 100644
--- a/ext/date/php_date.c
+++ b/ext/date/php_date.c
@@ -2544,6 +2544,9 @@ static int php_date_initialize_from_hash(zval 
**return_value, php_date_obj **dat
if (zend_hash_find(myht, timezone_type, 14, (void**) 
z_timezone_type) == SUCCESS) {
convert_to_long(*z_timezone_type);
if (zend_hash_find(myht, timezone, 9, (void**) 
z_timezone) == SUCCESS) {
+   zend_error_handling error_handling;
+
+   zend_replace_error_handling(EH_THROW, NULL, 
error_handling TSRMLS_CC);
convert_to_string(*z_timezone);
 
switch (Z_LVAL_PP(z_timezone_type)) {
@@ -2551,9 +2554,9 @@ static int php_date_initialize_from_hash(zval 
**return_value, php_date_obj **dat
case TIMELIB_ZONETYPE_ABBR: {
char *tmp = 
emalloc(Z_STRLEN_PP(z_date) + Z_STRLEN_PP(z_timezone) + 2);
snprintf(tmp, 
Z_STRLEN_PP(z_date) + Z_STRLEN_PP(z_timezone) + 2, %s %s, 
Z_STRVAL_PP(z_date), Z_STRVAL_PP(z_timezone));
-   php_date_initialize(*dateobj, 
tmp, Z_STRLEN_PP(z_date) + Z_STRLEN_PP(z_timezone) + 1, NULL, NULL, 0 
TSRMLS_CC);
+   php_date_initialize(*dateobj, 
tmp, Z_STRLEN_PP(z_date) + Z_STRLEN_PP(z_timezone) + 1, NULL, NULL, 1 
TSRMLS_CC);
efree(tmp);
-   return 1;
+   break;
}
 
case TIMELIB_ZONETYPE_ID:
@@ -2567,10 +2570,15 @@ static int php_date_initialize_from_hash(zval 
**return_value, php_date_obj **dat
tzobj-tzi.tz = tzi;
tzobj-initialized = 1;
 
-   php_date_initialize(*dateobj, 
Z_STRVAL_PP(z_date), Z_STRLEN_PP(z_date), NULL, tmp_obj, 0 TSRMLS_CC);
+   php_date_initialize(*dateobj, 
Z_STRVAL_PP(z_date), Z_STRLEN_PP(z_date), NULL, tmp_obj, 1 TSRMLS_CC);
zval_ptr_dtor(tmp_obj);
-   return 1;
+   break;
+   default:
+   
zend_restore_error_handling(error_handling TSRMLS_CC);
+   return 0;
}
+   zend_restore_error_handling(error_handling 
TSRMLS_CC);
+   return 1;
}
}
}
diff --git a/ext/date/tests/bug62852.phpt b/ext/date/tests/bug62852.phpt
new file mode 100644
index 000..6426a80
--- /dev/null
+++ b/ext/date/tests/bug62852.phpt
@@ -0,0 +1,15 @@
+--TEST--
+Bug #62852 (Unserialize invalid DateTime causes crash)
+--INI--
+date.timezone=GMT
+--FILE--
+?php
+try {
+   $datetime = unserialize('O:8:DateTime:3:{s:4:date;s:20:10007-06-07 
03:51:49;s:13:timezone_type;i:3;s:8:timezone;s:3:UTC;}');
+   var_dump($datetime);
+} catch (Exception $e) {
+var_dump($e-getMessage());
+}
+?
+--EXPECTF--
+string(%d) DateTime::__wakeup(): Failed to parse time string (%s) at position 
12 (0): Double time specification


--
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.3' into PHP-5.4: ext/date/php_date.c

2012-08-19 Thread Xinchen Hui
Commit:8693bae624a562dddfa7893eec651ebb03e0f16c
Author:Xinchen Hui larue...@php.net Sun, 19 Aug 2012 18:33:37 
+0800
Parents:   ebefbdb76d7e16c03dc9f3cf761bff6656af42c0 
8b87c6df8408b95a1bfae4a82958a48e3a220b5a
Branches:  PHP-5.4

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

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

Changed paths:
  MM  ext/date/php_date.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 #62836 (Seg fault or broken object references on unserialize()): NEWS ext/standard/tests/serialize/bug62836_1.phpt ext/standard/tests/serialize/bug62836_2.phpt ext/sta

2012-08-17 Thread Xinchen Hui
Commit:0b23da1c74c52a819b728c78c66c182511223355
Author:Xinchen Hui larue...@php.net Fri, 17 Aug 2012 18:28:32 
+0800
Parents:   8ac61a3e60329a10dfc85036ef46d78e53f8de95
Branches:  PHP-5.4

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

Log:
Fixed bug #62836 (Seg fault or broken object references on unserialize())

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

Changed paths:
  M  NEWS
  A  ext/standard/tests/serialize/bug62836_1.phpt
  A  ext/standard/tests/serialize/bug62836_2.phpt
  M  ext/standard/var_unserializer.c


Diff:
diff --git a/NEWS b/NEWS
index c7fb47f..1142a42 100644
--- a/NEWS
+++ b/NEWS
@@ -26,6 +26,10 @@ PHP  
  NEWS
   . Fixed bug (segfault due to PS(mod_user_implemented) not be reseted 
 when close handler call exit). (Laruence)
 
+- Standard:
+  . Fixed bug #62836 (Seg fault or broken object references on unserialize()).
+(Laruence)
+
 
 ?? ??? 2012, PHP 5.4.6
 
diff --git a/ext/standard/tests/serialize/bug62836_1.phpt 
b/ext/standard/tests/serialize/bug62836_1.phpt
new file mode 100644
index 000..7291046
--- /dev/null
+++ b/ext/standard/tests/serialize/bug62836_1.phpt
@@ -0,0 +1,34 @@
+--TEST--
+Bug #62836 (Seg fault or broken object references on unserialize())
+--FILE--
+?php
+$serialized_object='O:1:A:4:{s:1:b;O:1:B:0:{}s:2:b1;r:2;s:1:c;O:1:B:0:{}s:2:c1;r:4;}';
+function __autoload($name) {
+unserialize(i:4;);
+eval(class $name {} );
+}
+
+print_r(unserialize($serialized_object));
+echo okey;
+?
+--EXPECT--
+A Object
+(
+[b] = B Object
+(
+)
+
+[b1] = B Object
+(
+)
+
+[c] = B Object
+(
+)
+
+[c1] = B Object
+(
+)
+
+)
+okey
diff --git a/ext/standard/tests/serialize/bug62836_2.phpt 
b/ext/standard/tests/serialize/bug62836_2.phpt
new file mode 100644
index 000..0634b1d
--- /dev/null
+++ b/ext/standard/tests/serialize/bug62836_2.phpt
@@ -0,0 +1,37 @@
+--TEST--
+Bug #62836 (Seg fault or broken object references on unserialize())
+--FILE--
+?php
+$serialized_object='O:1:A:4:{s:1:b;O:1:B:0:{}s:2:b1;r:2;s:1:c;O:1:B:0:{}s:2:c1;r:4;}';
+
+ini_set('unserialize_callback_func','mycallback');
+
+function mycallback($classname) {
+unserialize(i:4;);
+eval (class $classname {} );
+}
+
+print_r(unserialize($serialized_object));
+echo okey;
+?
+--EXPECT--
+A Object
+(
+[b] = B Object
+(
+)
+
+[b1] = B Object
+(
+)
+
+[c] = B Object
+(
+)
+
+[c1] = B Object
+(
+)
+
+)
+okey
diff --git a/ext/standard/var_unserializer.c b/ext/standard/var_unserializer.c
index e1ac636..2537c52 100644
--- a/ext/standard/var_unserializer.c
+++ b/ext/standard/var_unserializer.c
@@ -620,10 +620,13 @@ yy20:
 
do {
/* Try to find class directly */
+   BG(serialize_lock) = 1;
if (zend_lookup_class(class_name, len2, pce TSRMLS_CC) == 
SUCCESS) {
+   BG(serialize_lock) = 0;
ce = *pce;
break;
}
+   BG(serialize_lock) = 0;

/* Check for unserialize callback */
if ((PG(unserialize_callback_func) == NULL) || 
(PG(unserialize_callback_func)[0] == '\0')) {
@@ -638,7 +641,9 @@ yy20:
args[0] = arg_func_name;
MAKE_STD_ZVAL(arg_func_name);
ZVAL_STRING(arg_func_name, class_name, 1);
+   BG(serialize_lock) = 1;
if (call_user_function_ex(CG(function_table), NULL, user_func, 
retval_ptr, 1, args, 0, NULL TSRMLS_CC) != SUCCESS) {
+   BG(serialize_lock) = 0;
php_error_docref(NULL TSRMLS_CC, E_WARNING, defined 
(%s) but not found, user_func-value.str.val);
incomplete_class = 1;
ce = PHP_IC_ENTRY;
@@ -646,6 +651,7 @@ yy20:
zval_ptr_dtor(arg_func_name);
break;
}
+   BG(serialize_lock) = 0;
if (retval_ptr) {
zval_ptr_dtor(retval_ptr);
}


--
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': ext/standard/var_unserializer.c

2012-08-17 Thread Xinchen Hui
Commit:3d93c888117a3f4e00f2e6a228d134eb336de2c2
Author:Xinchen Hui larue...@php.net Fri, 17 Aug 2012 18:30:03 
+0800
Parents:   85c37d0113a0560410435126cb3032dd22a7 
0b23da1c74c52a819b728c78c66c182511223355
Branches:  master

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

Log:
Merge branch 'PHP-5.4'

Changed paths:
  MM  ext/standard/var_unserializer.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 context info in error message: Zend/zend_compile.c

2012-08-17 Thread Xinchen Hui
Commit:24493652382c985b13a9ed94aae5fffae16a6895
Author:Xinchen Hui larue...@php.net Fri, 17 Aug 2012 21:18:20 
+0800
Parents:   3d93c888117a3f4e00f2e6a228d134eb336de2c2
Branches:  master

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

Log:
Fixed context info in error message

Changed paths:
  M  Zend/zend_compile.c


Diff:
diff --git a/Zend/zend_compile.c b/Zend/zend_compile.c
index d7ca6ea..bad9411 100644
--- a/Zend/zend_compile.c
+++ b/Zend/zend_compile.c
@@ -2289,6 +2289,11 @@ void zend_resolve_goto_label(zend_op_array *op_array, 
zend_op *opline, int pass2
end = op_array-opcodes + 
opline-op1.opline_num;
while (++p  end) {
if (p-opcode == ZEND_LEAVE) {
+   if (pass2) {
+   CG(in_compilation) = 1;
+   CG(active_op_array) = 
op_array;
+   CG(zend_lineno) = 
opline-lineno;
+   }
zend_error(E_COMPILE_ERROR, 
'goto' out of a finally block is disallowed);
}
}


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



[PHP-CVS] com php-src: Refactor examing of jumping out of finally block: Zend/tests/try_finally_005.phpt Zend/tests/try_finally_006.phpt Zend/tests/try_finally_007.phpt Zend/tests/try_finally_008.phpt

2012-08-17 Thread Xinchen Hui
Commit:f2a8912e618d4bd8ff5be266e37f2b6e2280e994
Author:Xinchen Hui larue...@php.net Sat, 18 Aug 2012 00:16:34 
+0800
Parents:   24493652382c985b13a9ed94aae5fffae16a6895
Branches:  master

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

Log:
Refactor examing of jumping out of finally block

Changed paths:
  M  Zend/tests/try_finally_005.phpt
  M  Zend/tests/try_finally_006.phpt
  A  Zend/tests/try_finally_007.phpt
  A  Zend/tests/try_finally_008.phpt
  M  Zend/zend_compile.c
  M  Zend/zend_compile.h
  M  Zend/zend_opcode.c


Diff:
diff --git a/Zend/tests/try_finally_005.phpt b/Zend/tests/try_finally_005.phpt
index e0937f1..2c6c2c9 100644
--- a/Zend/tests/try_finally_005.phpt
+++ b/Zend/tests/try_finally_005.phpt
@@ -14,4 +14,4 @@ label:
 foo();
 ?
 --EXPECTF--
-Fatal error: 'goto' out of a finally block is disallowed in 
%stry_finally_005.php on line %d
+Fatal error: jump out of a finally block is disallowed in 
%stry_finally_005.php on line %d
diff --git a/Zend/tests/try_finally_006.phpt b/Zend/tests/try_finally_006.phpt
index ba1c183..2bfa4ca 100644
--- a/Zend/tests/try_finally_006.phpt
+++ b/Zend/tests/try_finally_006.phpt
@@ -3,12 +3,19 @@ Finally with near goto
 --FILE--
 ?php
 function foo () {
+   $jmp = 1;
try {
} finally {
-  goto label;
-  echo dummy;
+previous:
+   if ($jmp) {
+   goto label;
+   echo dummy;
 label:
-  echo label;
+   echo label\n;
+   $jmp = 0;
+   goto previous;
+   }
+   echo okey;
}
 }
 
@@ -16,3 +23,4 @@ foo();
 ?
 --EXPECTF--
 label
+okey
diff --git a/Zend/tests/try_finally_007.phpt b/Zend/tests/try_finally_007.phpt
new file mode 100644
index 000..b13bd59
--- /dev/null
+++ b/Zend/tests/try_finally_007.phpt
@@ -0,0 +1,22 @@
+--TEST--
+Finally with goto previous label
+--FILE--
+?php
+function foo () {
+try {
+label:
+echo label; 
+try {
+} finally {
+goto label;
+echo dummy;
+}
+} catch (Exception $e) {
+} finally {
+}
+}
+
+foo();
+?
+--EXPECTF--
+Fatal error: jump out of a finally block is disallowed in 
%stry_finally_007.php on line %d
diff --git a/Zend/tests/try_finally_008.phpt b/Zend/tests/try_finally_008.phpt
new file mode 100644
index 000..77ecf4f
--- /dev/null
+++ b/Zend/tests/try_finally_008.phpt
@@ -0,0 +1,24 @@
+--TEST--
+Finally with jmp (do while)
+--FILE--
+?php
+function foo () {
+do {
+try {
+try {
+} finally {
+goto label;
+echo dummy;
+}
+} catch (Exception $e) {
+} finally {
+}
+} while (0);
+label:
+echo label; 
+}
+
+foo();
+?
+--EXPECTF--
+Fatal error: jump out of a finally block is disallowed in 
%stry_finally_008.php on line %d
diff --git a/Zend/zend_compile.c b/Zend/zend_compile.c
index bad9411..6a501f7 100644
--- a/Zend/zend_compile.c
+++ b/Zend/zend_compile.c
@@ -2277,30 +2277,6 @@ void zend_resolve_goto_label(zend_op_array *op_array, 
zend_op *opline, int pass2
zval_dtor(label);
Z_TYPE_P(label) = IS_NULL;
 
-   if (op_array-last_try_catch) {
-   zend_uint i, op_num = opline - op_array-opcodes;
-   for (i=0; iop_array-last_try_catch; i++) {
-   if (op_array-try_catch_array[i].try_op  op_num) {
-   break;
-   }
-   if (op_num = op_array-try_catch_array[i].finally_op) {
-   zend_op *p, *end; 
-   p = opline;
-   end = op_array-opcodes + 
opline-op1.opline_num;
-   while (++p  end) {
-   if (p-opcode == ZEND_LEAVE) {
-   if (pass2) {
-   CG(in_compilation) = 1;
-   CG(active_op_array) = 
op_array;
-   CG(zend_lineno) = 
opline-lineno;
-   }
-   zend_error(E_COMPILE_ERROR, 
'goto' out of a finally block is disallowed);
-   }
-   }
-   }
-   }
-   }
-
/* Check that we are not moving into loop or switch */
current = opline-extended_value;
for (distance = 0; current != dest-brk_cont; distance++) {
@@ -2686,6 +2662,7 @@ static int zend_add_try_element(zend_uint try_op 
TSRMLS_DC) /* {{{ */
CG(active_op_array)-try_catch_array = 
erealloc(CG(active_op_array)-try_catch_array, 
sizeof(zend_try_catch_element)*CG(active_op_array)-last_try_catch);
CG(active_op_array)-try_catch_array[try_catch_offset].try_op = try_op;
CG

[PHP-CVS] com php-src: Make the codes clearer, and also check continue statement: Zend/tests/try_finally_008.phpt Zend/tests/try_finally_009.phpt Zend/zend_opcode.c Zend/zend_vm_def.h Zend/zend_vm_exe

2012-08-17 Thread Xinchen Hui
Commit:72b9b8f380690357fc29efdfcba183b8a8a81268
Author:Xinchen Hui larue...@php.net Sat, 18 Aug 2012 11:44:09 
+0800
Parents:   7cf9ac1420ecb1b05a7899e50e91772afe3fcdfb
Branches:  master

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

Log:
Make the codes clearer, and also check continue statement

Changed paths:
  M  Zend/tests/try_finally_008.phpt
  A  Zend/tests/try_finally_009.phpt
  M  Zend/zend_opcode.c
  M  Zend/zend_vm_def.h
  M  Zend/zend_vm_execute.h


Diff:
diff --git a/Zend/tests/try_finally_008.phpt b/Zend/tests/try_finally_008.phpt
index 77ecf4f..9025d88 100644
--- a/Zend/tests/try_finally_008.phpt
+++ b/Zend/tests/try_finally_008.phpt
@@ -7,15 +7,12 @@ function foo () {
 try {
 try {
 } finally {
-goto label;
-echo dummy;
+break;
 }
 } catch (Exception $e) {
 } finally {
 }
 } while (0);
-label:
-echo label; 
 }
 
 foo();
diff --git a/Zend/tests/try_finally_009.phpt b/Zend/tests/try_finally_009.phpt
new file mode 100644
index 000..7c3da67
--- /dev/null
+++ b/Zend/tests/try_finally_009.phpt
@@ -0,0 +1,23 @@
+--TEST--
+Finally with jmp (for continue)
+--FILE--
+?php
+function foo () {
+for($i = 0; $i  5; $i++) {
+do {
+try {
+try {
+} finally {
+}
+} catch (Exception $e) {
+} finally {
+  continue;
+}
+} while (0);
+}
+}
+
+foo();
+?
+--EXPECTF--
+Fatal error: jump out of a finally block is disallowed in 
%stry_finally_009.php on line %d
diff --git a/Zend/zend_opcode.c b/Zend/zend_opcode.c
index 8cccfe6..86144d6 100644
--- a/Zend/zend_opcode.c
+++ b/Zend/zend_opcode.c
@@ -485,6 +485,24 @@ static void zend_extension_op_array_handler(zend_extension 
*extension, zend_op_a
}
 }
 
+static void zend_check_finally_breakout(zend_op_array *op_array, zend_op 
*opline, zend_uint dst_num TSRMLS_DC) {
+   zend_uint i, op_num = opline - op_array-opcodes;
+   for (i=0; i  op_array-last_try_catch; i++) {
+   if (op_array-try_catch_array[i].try_op  op_num) {
+   break;
+   }
+   if ((op_num = op_array-try_catch_array[i].finally_op 
+op_num  
op_array-try_catch_array[i].finally_end)
+(dst_num = 
op_array-try_catch_array[i].finally_end 
+   || dst_num  
op_array-try_catch_array[i].finally_op)) {
+   CG(in_compilation) = 1;
+   CG(active_op_array) = op_array;
+   CG(zend_lineno) = opline-lineno;
+   zend_error(E_COMPILE_ERROR, jump out of a finally 
block is disallowed);
+   }
+   } 
+}
+
 ZEND_API int pass_two(zend_op_array *op_array TSRMLS_DC)
 {
zend_op *opline, *end;
@@ -529,23 +547,29 @@ ZEND_API int pass_two(zend_op_array *op_array TSRMLS_DC)
/* break omitted intentionally */
case ZEND_JMP:
if (op_array-last_try_catch) {
+   zend_check_finally_breakout(op_array, 
opline, opline-op1.opline_num TSRMLS_CC);
+   }
+   opline-op1.jmp_addr = 
op_array-opcodes[opline-op1.opline_num];
+   break;
+case ZEND_BRK:
+case ZEND_CONT:
+   if (op_array-last_try_catch) {
zend_uint i, op_num = opline - 
op_array-opcodes;
-   for (i=0; i  op_array-last_try_catch; 
i++) {
-   if 
(op_array-try_catch_array[i].try_op  op_num) {
-   break;
+   int nest_levels, array_offset;
+   zend_brk_cont_element *jmp_to;
+
+   nest_levels = Z_LVAL_P(opline-op2.zv);
+   array_offset = opline-op1.opline_num;
+   do {
+   jmp_to = 
op_array-brk_cont_array[array_offset];
+   if (nest_levels  1) {
+   array_offset = 
jmp_to-parent;
}
-   if ((op_num = 
op_array-try_catch_array[i].finally_op 
-
op_num  op_array-try_catch_array[i].finally_end)
-
(opline-op1.opline_num = op_array

[PHP-CVS] com php-src: Fix test failed: sapi/cgi/tests/apache_request_headers.phpt

2012-08-17 Thread Xinchen Hui
Commit:ebefbdb76d7e16c03dc9f3cf761bff6656af42c0
Author:Xinchen Hui larue...@php.net Sat, 18 Aug 2012 12:21:48 
+0800
Parents:   15e31d5720786cda4188f258e3b2fe7b0e9ba004
Branches:  PHP-5.4

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

Log:
Fix test failed

Changed paths:
  M  sapi/cgi/tests/apache_request_headers.phpt


Diff:
diff --git a/sapi/cgi/tests/apache_request_headers.phpt 
b/sapi/cgi/tests/apache_request_headers.phpt
index 881b6bb..fd36e30 100644
--- a/sapi/cgi/tests/apache_request_headers.phpt
+++ b/sapi/cgi/tests/apache_request_headers.phpt
@@ -17,12 +17,12 @@ $file = dirname(__FILE__)./012.test.php;
 
 file_put_contents($file, '?php print_r(apache_request_headers()); ?');
 
-passthru($php $file);
+passthru($php -n $file);
 
 $names = array('HTTP_X_TEST', 'HTTP_X__TEST', 'HTTP_X_');
 foreach ($names as $name) {
putenv($name.=.str_repeat(A, 256));
-   passthru($php -q $file);
+   passthru($php -n -q $file);
putenv($name);
 }
 unlink($file);


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



[PHP-CVS] com php-src: tab: Zend/zend_compile.h

2012-08-17 Thread Xinchen Hui
Commit:57e7c7bd49dae25f2d3ec935b5e264d0fb62b6b3
Author:Xinchen Hui larue...@php.net Sat, 18 Aug 2012 11:57:53 
+0800
Parents:   72b9b8f380690357fc29efdfcba183b8a8a81268
Branches:  master

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

Log:
tab

Changed paths:
  M  Zend/zend_compile.h


Diff:
diff --git a/Zend/zend_compile.h b/Zend/zend_compile.h
index a06c985..8919fdc 100644
--- a/Zend/zend_compile.h
+++ b/Zend/zend_compile.h
@@ -80,7 +80,7 @@ typedef union _znode_op {
zend_op   *jmp_addr;
zval  *zv;
zend_literal  *literal;
-  void  *ptr;/* Used for passing pointers from the compile to 
execution phase, currently used for traits */
+   void  *ptr;/* Used for passing pointers from the 
compile to execution phase, currently used for traits */
 } znode_op;
 
 typedef struct _znode { /* used only during compilation */


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



[PHP-CVS] com php-src: Prevents `goto` out of a finally block: Zend/tests/try_finally_005.phpt Zend/tests/try_finally_006.phpt Zend/zend_compile.c

2012-08-16 Thread Xinchen Hui
Commit:0312d0a262e4e15ce49dddaa1b10492aba08ec38
Author:Xinchen Hui larue...@php.net Thu, 16 Aug 2012 18:17:26 
+0800
Parents:   018395efafeb8cbce0b8864ca4a1eac232db1cbb
Branches:  master

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

Log:
Prevents `goto` out of a finally block

Changed paths:
  A  Zend/tests/try_finally_005.phpt
  A  Zend/tests/try_finally_006.phpt
  M  Zend/zend_compile.c


Diff:
diff --git a/Zend/tests/try_finally_005.phpt b/Zend/tests/try_finally_005.phpt
new file mode 100644
index 000..e0937f1
--- /dev/null
+++ b/Zend/tests/try_finally_005.phpt
@@ -0,0 +1,17 @@
+--TEST--
+Finally with long goto
+--FILE--
+?php
+function foo () {
+   try {
+   } finally {
+  goto label;
+   }
+label:
+   return 1;
+}
+
+foo();
+?
+--EXPECTF--
+Fatal error: 'goto' out of a finally block is disallowed in 
%stry_finally_005.php on line %d
diff --git a/Zend/tests/try_finally_006.phpt b/Zend/tests/try_finally_006.phpt
new file mode 100644
index 000..ba1c183
--- /dev/null
+++ b/Zend/tests/try_finally_006.phpt
@@ -0,0 +1,18 @@
+--TEST--
+Finally with near goto
+--FILE--
+?php
+function foo () {
+   try {
+   } finally {
+  goto label;
+  echo dummy;
+label:
+  echo label;
+   }
+}
+
+foo();
+?
+--EXPECTF--
+label
diff --git a/Zend/zend_compile.c b/Zend/zend_compile.c
index 48b85f0..378cf17 100644
--- a/Zend/zend_compile.c
+++ b/Zend/zend_compile.c
@@ -2277,6 +2277,25 @@ void zend_resolve_goto_label(zend_op_array *op_array, 
zend_op *opline, int pass2
zval_dtor(label);
Z_TYPE_P(label) = IS_NULL;
 
+   if (op_array-last_try_catch) {
+   zend_uint i, op_num = opline - CG(active_op_array)-opcodes;
+   for (i=0; iop_array-last_try_catch; i++) {
+   if (op_array-try_catch_array[i].try_op  op_num) {
+   break;
+   }
+   if (op_num = op_array-try_catch_array[i].finally_op) {
+   zend_op *p, *end; 
+   p = opline;
+   end = op_array-opcodes + 
opline-op1.opline_num;
+   while (++p  end) {
+   if (p-opcode == ZEND_LEAVE) {
+   zend_error(E_COMPILE_ERROR, 
'goto' out of a finally block is disallowed);
+   }
+   }
+   }
+   }
+   }
+
/* Check that we are not moving into loop or switch */
current = opline-extended_value;
for (distance = 0; current != dest-brk_cont; distance++) {


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



[PHP-CVS] com php-src: typo: Zend/zend_compile.c

2012-08-16 Thread Xinchen Hui
Commit:acd402d4e78ce25e80d19aa564bed1329dcc4ddc
Author:Xinchen Hui larue...@php.net Thu, 16 Aug 2012 23:01:58 
+0800
Parents:   6a87a21c710d615f8344d01a0692685e36054afe
Branches:  master

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

Log:
typo

Changed paths:
  M  Zend/zend_compile.c


Diff:
diff --git a/Zend/zend_compile.c b/Zend/zend_compile.c
index 378cf17..d7ca6ea 100644
--- a/Zend/zend_compile.c
+++ b/Zend/zend_compile.c
@@ -2278,7 +2278,7 @@ void zend_resolve_goto_label(zend_op_array *op_array, 
zend_op *opline, int pass2
Z_TYPE_P(label) = IS_NULL;
 
if (op_array-last_try_catch) {
-   zend_uint i, op_num = opline - CG(active_op_array)-opcodes;
+   zend_uint i, op_num = opline - op_array-opcodes;
for (i=0; iop_array-last_try_catch; i++) {
if (op_array-try_catch_array[i].try_op  op_num) {
break;


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



[PHP-CVS] com php-src: Skip tests reply on Zend MM turned on: ext/oci8/tests/pecl_bug10194_blob.phpt ext/standard/tests/strings/str_pad_variation5.phpt

2012-08-14 Thread Xinchen Hui
Commit:02394379036eb535290f9d4216e2b5be3efb12c6
Author:Reeze Xia reeze@gmail.com Sat, 11 Aug 2012 00:34:37 
+0800
Parents:   c4b26cc1b0b0521c75e653fffec2a9e3b4bf8cbb
Branches:  PHP-5.3

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

Log:
Skip tests reply on Zend MM turned on

Those two tests have expect memory exhausted fatal error

Changed paths:
  M  ext/oci8/tests/pecl_bug10194_blob.phpt
  M  ext/standard/tests/strings/str_pad_variation5.phpt


Diff:
diff --git a/ext/oci8/tests/pecl_bug10194_blob.phpt 
b/ext/oci8/tests/pecl_bug10194_blob.phpt
index faf87ab..96f94bc 100644
--- a/ext/oci8/tests/pecl_bug10194_blob.phpt
+++ b/ext/oci8/tests/pecl_bug10194_blob.phpt
@@ -6,6 +6,9 @@ $target_dbs = array('oracledb' = true, 'timesten' = false);  
// test runs on t
 require(dirname(__FILE__).'/skipif.inc');
 if (PHP_INT_SIZE != 4) die(skip this test is for 32bit platforms only);
 if (getenv('SKIP_SLOW_TESTS')) die('skip slow tests excluded by request');
+if (getenv(USE_ZEND_ALLOC) === 0) {
+die(skip Zend MM disabled);
+}
 ? 
 --INI--
 memory_limit=3M
diff --git a/ext/standard/tests/strings/str_pad_variation5.phpt 
b/ext/standard/tests/strings/str_pad_variation5.phpt
index 4b300c4..cd979a1 100644
--- a/ext/standard/tests/strings/str_pad_variation5.phpt
+++ b/ext/standard/tests/strings/str_pad_variation5.phpt
@@ -5,6 +5,9 @@ memory_limit=128M
 --SKIPIF--
 ?php
 if (PHP_INT_SIZE != 4) die(skip this test is for 32bit platform only);
+if (getenv(USE_ZEND_ALLOC) === 0) {
+die(skip Zend MM disabled);
+}
 ?
 --FILE--
 ?php


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



[PHP-CVS] com php-src: add test for alone try block, and update test scripts summary: Zend/tests/try_catch_finally_002.phpt Zend/tests/try_catch_finally_003.phpt Zend/tests/try_catch_finally_004.phpt

2012-08-14 Thread Xinchen Hui
Commit:f82be0550b573027b1fb8ef106e7c8efc78878e1
Author:Xinchen Hui larue...@php.net Tue, 14 Aug 2012 14:08:38 
+0800
Parents:   dacd918dc7745118f10ea9481ca081de523b97c9
Branches:  master

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

Log:
add test for alone try block, and update test scripts summary

Changed paths:
  M  Zend/tests/try_catch_finally_002.phpt
  M  Zend/tests/try_catch_finally_003.phpt
  M  Zend/tests/try_catch_finally_004.phpt
  A  Zend/tests/try_finally_004.phpt


Diff:
diff --git a/Zend/tests/try_catch_finally_002.phpt 
b/Zend/tests/try_catch_finally_002.phpt
index 94143f6..79efcb3 100644
--- a/Zend/tests/try_catch_finally_002.phpt
+++ b/Zend/tests/try_catch_finally_002.phpt
@@ -1,5 +1,5 @@
 --TEST--
-Try catch finally
+Try catch finally catch(multi catch blocks)
 --FILE--
 ?php
 
diff --git a/Zend/tests/try_catch_finally_003.phpt 
b/Zend/tests/try_catch_finally_003.phpt
index 78b37be..e605538 100644
--- a/Zend/tests/try_catch_finally_003.phpt
+++ b/Zend/tests/try_catch_finally_003.phpt
@@ -1,5 +1,5 @@
 --TEST--
-Try catch finally
+Try catch finally (multi catch blcoks with return)
 --FILE--
 ?php
 
diff --git a/Zend/tests/try_catch_finally_004.phpt 
b/Zend/tests/try_catch_finally_004.phpt
index c694601..eb8d096 100644
--- a/Zend/tests/try_catch_finally_004.phpt
+++ b/Zend/tests/try_catch_finally_004.phpt
@@ -1,5 +1,5 @@
 --TEST--
-Try catch finally
+Try catch finally (re-throw exception in catch block)
 --CREDITS--
 adoy
 --FILE--
diff --git a/Zend/tests/try_finally_004.phpt b/Zend/tests/try_finally_004.phpt
new file mode 100644
index 000..8caa8fb
--- /dev/null
+++ b/Zend/tests/try_finally_004.phpt
@@ -0,0 +1,14 @@
+--TEST--
+Try without catch/finally block
+--FILE--
+?php
+function foo () {
+   try {
+echo 3;
+   }
+}
+
+foo();
+?
+--EXPECTF--
+Fatal error: Cannot use try without catch or finally in %stry_finally_004.php 
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: typo: Zend/tests/try_catch_finally_003.phpt

2012-08-14 Thread Xinchen Hui
Commit:154fe7486d55b5bd71dc9ecbac369a48596a3325
Author:Xinchen Hui larue...@php.net Tue, 14 Aug 2012 14:17:27 
+0800
Parents:   f82be0550b573027b1fb8ef106e7c8efc78878e1
Branches:  master

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

Log:
typo

Changed paths:
  M  Zend/tests/try_catch_finally_003.phpt


Diff:
diff --git a/Zend/tests/try_catch_finally_003.phpt 
b/Zend/tests/try_catch_finally_003.phpt
index e605538..784063b 100644
--- a/Zend/tests/try_catch_finally_003.phpt
+++ b/Zend/tests/try_catch_finally_003.phpt
@@ -1,5 +1,5 @@
 --TEST--
-Try catch finally (multi catch blcoks with return)
+Try catch finally (multi catch blocks with return)
 --FILE--
 ?php


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



[PHP-CVS] com php-src: Fixed bug (segfault due to PS(mod_user_implemented) not be reseted when closing handler call exit): NEWS ext/session/mod_user.c

2012-08-14 Thread Xinchen Hui
Commit:da3660a4c42cb90c8d5626ac1da71c1201f98d4b
Author:Xinchen Hui larue...@php.net Wed, 15 Aug 2012 00:15:34 
+0800
Parents:   49e91151c0ac1e39caab14c2d323dc70acb723c0
Branches:  PHP-5.4

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

Log:
Fixed bug (segfault due to PS(mod_user_implemented) not be reseted when closing 
handler call exit)

Changed paths:
  M  NEWS
  M  ext/session/mod_user.c


Diff:
diff --git a/NEWS b/NEWS
index da53df0..78b8652 100644
--- a/NEWS
+++ b/NEWS
@@ -21,6 +21,11 @@ PHP  
  NEWS
   . Fixed bug #62715 (ReflectionParameter::isDefaultValueAvailable() wrong
 result). (Laruence)
 
+- Session:
+  . Fixed bug (segfault due to PS(mod_user_implemented) not be reseted 
+when close handler call exit). (Laruence)
+
+
 ?? ??? 2012, PHP 5.4.6
 
 - CLI Server:
diff --git a/ext/session/mod_user.c b/ext/session/mod_user.c
index 2ff5302..41a63fc 100644
--- a/ext/session/mod_user.c
+++ b/ext/session/mod_user.c
@@ -99,6 +99,7 @@ PS_OPEN_FUNC(user)
 
 PS_CLOSE_FUNC(user)
 {
+   zend_bool bailout = 0;
STDVARS;
 
if (!PS(mod_user_implemented)) {
@@ -106,9 +107,22 @@ PS_CLOSE_FUNC(user)
return SUCCESS;
}
 
-   retval = ps_call_handler(PSF(close), 0, NULL TSRMLS_CC);
+   zend_try {
+   retval = ps_call_handler(PSF(close), 0, NULL TSRMLS_CC);
+   } zend_catch {
+   bailout = 1;
+   PS(mod_user_implemented) = 0;
+   } zend_end_try();
+
PS(mod_user_implemented) = 0;
 
+   if (bailout) {
+   if (retval) {
+   zval_ptr_dtor(retval);
+   }
+   zend_bailout();
+   }
+
FINISH;
 }


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



[PHP-CVS] com php-src: improve the fix: ext/session/mod_user.c

2012-08-14 Thread Xinchen Hui
Commit:b2fe342d04d6a7ef5b56a55723e2d2b975a8622e
Author:Xinchen Hui larue...@php.net Wed, 15 Aug 2012 00:25:06 
+0800
Parents:   da3660a4c42cb90c8d5626ac1da71c1201f98d4b
Branches:  PHP-5.4

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

Log:
improve the fix

Changed paths:
  M  ext/session/mod_user.c


Diff:
diff --git a/ext/session/mod_user.c b/ext/session/mod_user.c
index 41a63fc..7fe147b 100644
--- a/ext/session/mod_user.c
+++ b/ext/session/mod_user.c
@@ -114,8 +114,6 @@ PS_CLOSE_FUNC(user)
PS(mod_user_implemented) = 0;
} zend_end_try();
 
-   PS(mod_user_implemented) = 0;
-
if (bailout) {
if (retval) {
zval_ptr_dtor(retval);
@@ -123,6 +121,8 @@ PS_CLOSE_FUNC(user)
zend_bailout();
}
 
+   PS(mod_user_implemented) = 0;
+
FINISH;
 }


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



[PHP-CVS] com php-src: Attempt to fix segfault due to retval is not initialized: ext/session/mod_user.c

2012-08-14 Thread Xinchen Hui
Commit:9be55beb91378562e6e02ef4f1d010c4b1acbff9
Author:Xinchen Hui larue...@php.net Wed, 15 Aug 2012 00:31:57 
+0800
Parents:   b2fe342d04d6a7ef5b56a55723e2d2b975a8622e
Branches:  PHP-5.4

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

Log:
Attempt to fix segfault due to retval is not initialized

Changed paths:
  M  ext/session/mod_user.c


Diff:
diff --git a/ext/session/mod_user.c b/ext/session/mod_user.c
index 7fe147b..e18e826 100644
--- a/ext/session/mod_user.c
+++ b/ext/session/mod_user.c
@@ -63,7 +63,7 @@ static zval *ps_call_handler(zval *func, int argc, zval 
**argv TSRMLS_DC)
 }
 
 #define STDVARS
\
-   zval *retval;   \
+   zval *retval = NULL;\
int ret = FAILURE
 
 #define PSF(a) PS(mod_user_names).name.ps_##a


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



[PHP-CVS] com php-src: Fixed bug (segfault due to retval is not initialized): NEWS ext/session/mod_user.c

2012-08-14 Thread Xinchen Hui
Commit:a5a409ebff1037f4b00fdf6d46dd61c72cb6d315
Author:Xinchen Hui larue...@php.net Wed, 15 Aug 2012 00:44:47 
+0800
Parents:   e1c610fb44385cd2894be1957cc32f74b476
Branches:  PHP-5.3

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

Log:
Fixed bug (segfault due to retval is not initialized)

Changed paths:
  M  NEWS
  M  ext/session/mod_user.c


Diff:
diff --git a/NEWS b/NEWS
index 985e274..c7afe53 100644
--- a/NEWS
+++ b/NEWS
@@ -26,6 +26,9 @@ PHP   
 NEWS
   . Fixed bug #62715 (ReflectionParameter::isDefaultValueAvailable() wrong
 result). (Laruence)
 
+- Session:
+  . Fixed bug (segfault due to retval is not initialized). (Laruence)
+
 - SPL:
   . Fixed bug #62616 (ArrayIterator::count() from IteratorIterator instance
 gives Segmentation fault). (Laruence, Gustavo)
diff --git a/ext/session/mod_user.c b/ext/session/mod_user.c
index 17af624..c187e26 100644
--- a/ext/session/mod_user.c
+++ b/ext/session/mod_user.c
@@ -63,7 +63,7 @@ static zval *ps_call_handler(zval *func, int argc, zval 
**argv TSRMLS_DC)
 }
 
 #define STDVARS1   \
-   zval *retval;   \
+   zval *retval = NULL;\
int ret = FAILURE
 
 #define STDVARS
\


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



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

2012-08-14 Thread Xinchen Hui
Commit:bec5e1015556df91b18b3fbfb6e611c3a9273d02
Author:Xinchen Hui larue...@php.net Wed, 15 Aug 2012 00:46:56 
+0800
Parents:   9be55beb91378562e6e02ef4f1d010c4b1acbff9
Branches:  PHP-5.4

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

Log:
update NEWS

Changed paths:
  M  NEWS


Diff:
diff --git a/NEWS b/NEWS
index 78b8652..c7fb47f 100644
--- a/NEWS
+++ b/NEWS
@@ -22,6 +22,7 @@ PHP   
 NEWS
 result). (Laruence)
 
 - Session:
+  . Fixed bug (segfault due to retval is not initialized). (Laruence)
   . Fixed bug (segfault due to PS(mod_user_implemented) not be reseted 
 when close handler call exit). (Laruence)


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



[PHP-CVS] com php-src: Merge fix e7535e06e63104ccc0c90c4425b6c2541aa3c939 to 5.3: ext/standard/file.c

2012-08-14 Thread Xinchen Hui
Commit:8848778a59ddde777258261a3888baeb3a70dea1
Author:Xinchen Hui larue...@php.net Wed, 15 Aug 2012 01:06:10 
+0800
Parents:   a5a409ebff1037f4b00fdf6d46dd61c72cb6d315
Branches:  PHP-5.3

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

Log:
Merge fix e7535e06e63104ccc0c90c4425b6c2541aa3c939 to 5.3

thanks for reeze@gmail.com notice this

Changed paths:
  M  ext/standard/file.c


Diff:
diff --git a/ext/standard/file.c b/ext/standard/file.c
index 44d3a4e..7147e98 100644
--- a/ext/standard/file.c
+++ b/ext/standard/file.c
@@ -162,6 +162,7 @@ static void file_globals_ctor(php_file_globals 
*file_globals_p TSRMLS_DC)
FG(pclose_ret) = 0;
FG(user_stream_current_filename) = NULL;
FG(def_chunk_size) = PHP_SOCK_CHUNK_SIZE;
+   FG(wrapper_errors) = NULL;
 }
 
 static void file_globals_dtor(php_file_globals *file_globals_p TSRMLS_DC)


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



[PHP-CVS] com php-src: better fix this test pass now: ext/session/mod_user.c ext/session/tests/bug60634_error_5.phpt

2012-08-14 Thread Xinchen Hui
Commit:1a527397cc5cf6d745205c21d7e34a9e789189f1
Author:Xinchen Hui larue...@php.net Wed, 15 Aug 2012 01:25:31 
+0800
Parents:   6bafbb9abf3d5050f732fa263b188f0089c52b0e
Branches:  PHP-5.4

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

Log:
better fix  this test pass now

Changed paths:
  M  ext/session/mod_user.c
  M  ext/session/tests/bug60634_error_5.phpt


Diff:
diff --git a/ext/session/mod_user.c b/ext/session/mod_user.c
index e18e826..84a28d3 100644
--- a/ext/session/mod_user.c
+++ b/ext/session/mod_user.c
@@ -111,9 +111,10 @@ PS_CLOSE_FUNC(user)
retval = ps_call_handler(PSF(close), 0, NULL TSRMLS_CC);
} zend_catch {
bailout = 1;
-   PS(mod_user_implemented) = 0;
} zend_end_try();
 
+   PS(mod_user_implemented) = 0;
+
if (bailout) {
if (retval) {
zval_ptr_dtor(retval);
@@ -121,8 +122,6 @@ PS_CLOSE_FUNC(user)
zend_bailout();
}
 
-   PS(mod_user_implemented) = 0;
-
FINISH;
 }
 
diff --git a/ext/session/tests/bug60634_error_5.phpt 
b/ext/session/tests/bug60634_error_5.phpt
index 376b65f..8081ab9 100644
--- a/ext/session/tests/bug60634_error_5.phpt
+++ b/ext/session/tests/bug60634_error_5.phpt
@@ -1,7 +1,5 @@
 --TEST--
 Bug #60634 (Segmentation fault when trying to die() in 
SessionHandler::write()) - fatal error in close during exec
---XFAIL--
-Long term low priority bug, working on it
 --INI--
 session.save_path=
 session.name=PHPSESSID


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



[PHP-CVS] com php-src: Fix intl tests failed because of missing skipif section: ext/intl/tests/breakiter___construct.phpt ext/intl/tests/breakiter_clone_basic.phpt ext/intl/tests/breakiter_current_bas

2012-08-14 Thread Xinchen Hui
Commit:80044a0879d65f524f40d0dc01121a4446e16856
Author:Reeze Xia reeze@gmail.com Wed, 15 Aug 2012 01:03:56 
+0800
Parents:   1190bc440be0ab8ef6703dc9cb1dc4d64bf538f0
Branches:  master

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

Log:
Fix intl tests failed because of missing skipif section

Changed paths:
  M  ext/intl/tests/breakiter___construct.phpt
  M  ext/intl/tests/breakiter_clone_basic.phpt
  M  ext/intl/tests/breakiter_current_basic.phpt
  M  ext/intl/tests/breakiter_factories_basic.phpt
  M  ext/intl/tests/breakiter_factories_error.phpt
  M  ext/intl/tests/breakiter_first_basic.phpt
  M  ext/intl/tests/breakiter_first_last_previous_current_error.phpt
  M  ext/intl/tests/breakiter_following_basic.phpt
  M  ext/intl/tests/breakiter_following_preceding_isBoundary_error.phpt
  M  ext/intl/tests/breakiter_getLocale_basic.phpt
  M  ext/intl/tests/breakiter_getLocale_error.phpt
  M  ext/intl/tests/breakiter_getPartsIterator_basic.phpt
  M  ext/intl/tests/breakiter_getText_basic.phpt
  M  ext/intl/tests/breakiter_getText_error.phpt
  M  ext/intl/tests/breakiter_isBoundary_basic.phpt
  M  ext/intl/tests/breakiter_last_basic.phpt
  M  ext/intl/tests/breakiter_next_basic.phpt
  M  ext/intl/tests/breakiter_next_error.phpt
  M  ext/intl/tests/breakiter_preceding_basic.phpt
  M  ext/intl/tests/breakiter_previous_basic.phpt
  M  ext/intl/tests/breakiter_setText_basic.phpt
  M  ext/intl/tests/breakiter_setText_error.phpt
  M  ext/intl/tests/dateformat___construct_bad_tz_cal.phpt
  M  ext/intl/tests/dateformat_create_cal_arg.phpt
  M  ext/intl/tests/dateformat_getCalendarObject_error.phpt
  M  ext/intl/tests/dateformat_getTimeZone_error.phpt
  M  ext/intl/tests/dateformat_get_set_calendar.phpt
  M  ext/intl/tests/dateformat_get_set_timezone.phpt
  M  ext/intl/tests/dateformat_setTimeZoneID_deprecation.phpt
  M  ext/intl/tests/dateformat_setTimeZone_error.phpt
  M  ext/intl/tests/dateformat_timezone_arg_variations.phpt
  M  ext/intl/tests/rbbiter___construct_basic.phpt
  M  ext/intl/tests/rbbiter_getRuleStatusVec_basic.phpt
  M  ext/intl/tests/rbbiter_getRuleStatus_basic.phpt
  M  ext/intl/tests/rbbiter_getRules_basic.phpt

diff --git a/ext/intl/tests/breakiter___construct.phpt 
b/ext/intl/tests/breakiter___construct.phpt
index 9ea6a9c..a818075 100644
--- a/ext/intl/tests/breakiter___construct.phpt
+++ b/ext/intl/tests/breakiter___construct.phpt
@@ -1,6 +1,7 @@
 --TEST--
 IntlBreakIterator::__construct() should not be callable
 --SKIPIF--
+?php
 if (!extension_loaded('intl'))
die('skip intl extension not enabled');
 --FILE--
diff --git a/ext/intl/tests/breakiter_clone_basic.phpt 
b/ext/intl/tests/breakiter_clone_basic.phpt
index f5bcefc..d838f81 100644
--- a/ext/intl/tests/breakiter_clone_basic.phpt
+++ b/ext/intl/tests/breakiter_clone_basic.phpt
@@ -1,5 +1,9 @@
 --TEST--
 IntlBreakIterator: clone handler
+--SKIPIF--
+?php
+if (!extension_loaded('intl'))
+   die('skip intl extension not enabled');
 --FILE--
 ?php
 ini_set(intl.error_level, E_WARNING);
diff --git a/ext/intl/tests/breakiter_current_basic.phpt 
b/ext/intl/tests/breakiter_current_basic.phpt
index 515cb55..2ce6da7 100644
--- a/ext/intl/tests/breakiter_current_basic.phpt
+++ b/ext/intl/tests/breakiter_current_basic.phpt
@@ -1,5 +1,9 @@
 --TEST--
 IntlBreakIterator::current(): basic test
+--SKIPIF--
+?php
+if (!extension_loaded('intl'))
+   die('skip intl extension not enabled');
 --FILE--
 ?php
 ini_set(intl.error_level, E_WARNING);
diff --git a/ext/intl/tests/breakiter_factories_basic.phpt 
b/ext/intl/tests/breakiter_factories_basic.phpt
index 333023a..dcfcede 100644
--- a/ext/intl/tests/breakiter_factories_basic.phpt
+++ b/ext/intl/tests/breakiter_factories_basic.phpt
@@ -1,6 +1,7 @@
 --TEST--
 IntlBreakIterator factories: basic tests
 --SKIPIF--
+?php
 if (!extension_loaded('intl'))
die('skip intl extension not enabled');
 --FILE--
diff --git a/ext/intl/tests/breakiter_factories_error.phpt 
b/ext/intl/tests/breakiter_factories_error.phpt
index 6001946..c35339f 100644
--- a/ext/intl/tests/breakiter_factories_error.phpt
+++ b/ext/intl/tests/breakiter_factories_error.phpt
@@ -1,5 +1,9 @@
 --TEST--
 IntlBreakIterator factory methods: argument errors
+--SKIPIF--
+?php
+if (!extension_loaded('intl'))
+   die('skip intl extension not enabled');
 --FILE--
 ?php
 ini_set(intl.error_level, E_WARNING);
diff --git a/ext/intl/tests/breakiter_first_basic.phpt 
b/ext/intl/tests/breakiter_first_basic.phpt
index c8427ad..364d5f2 100644
--- a/ext/intl/tests/breakiter_first_basic.phpt
+++ b/ext/intl/tests/breakiter_first_basic.phpt
@@ -1,6 +1,7 @@
 --TEST--
 IntlBreakIterator::first(): basic test
 --SKIPIF--
+?php
 if (!extension_loaded('intl'))
die('skip intl extension not enabled');
 --FILE--
diff --git a/ext/intl/tests/breakiter_first_last_previous_current_error.phpt 
b/ext/intl/tests/breakiter_first_last_previous_current_error.phpt
index 

[PHP-CVS] com php-src: Fixed bug #62763 (register_shutdown_function and extending class): NEWS Zend/tests/bug62763.phpt ext/standard/basic_functions.c

2012-08-12 Thread Xinchen Hui
Commit:4970926e4543c15e16b0c047d85dddfb4c09b581
Author:Xinchen Hui larue...@php.net Sun, 12 Aug 2012 20:58:09 
+0800
Parents:   e1180b4f1aea83ee5dc7f62832a10056e0f62f18
Branches:  PHP-5.3

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

Log:
Fixed bug #62763 (register_shutdown_function and extending class)

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

Changed paths:
  M  NEWS
  A  Zend/tests/bug62763.phpt
  M  ext/standard/basic_functions.c


Diff:
diff --git a/NEWS b/NEWS
index 70cbe8e..985e274 100644
--- a/NEWS
+++ b/NEWS
@@ -3,6 +3,8 @@ PHP 
   NEWS
 ?? ??? 2012, PHP 5.3.16
 
 - Core:
+  . Fixed bug #62763 (register_shutdown_function and extending class). 
+(Laruence)
   . Fixed bug #62744 (dangling pointers made by zend_disable_class). (Laruence)
   . Fixed bug #62716 (munmap() is called with the incorrect length). 
 (slang...@google.com)
diff --git a/Zend/tests/bug62763.phpt b/Zend/tests/bug62763.phpt
new file mode 100644
index 000..50c27bd
--- /dev/null
+++ b/Zend/tests/bug62763.phpt
@@ -0,0 +1,23 @@
+--TEST--
+Bug #62763 (register_shutdown_function and extending class)
+--FILE--
+?php
+class test1 {
+public function __construct() {
+register_shutdown_function(array($this, 'shutdown')); 
+}
+public function shutdown() { 
+exit(__METHOD__);
+}
+}
+
+class test2 extends test1 {
+public function __destruct() { 
+   exit (__METHOD__); 
+}
+}
+new test1;
+new test2;
+?
+--EXPECT--
+test1::shutdowntest2::__destruct
diff --git a/ext/standard/basic_functions.c b/ext/standard/basic_functions.c
index 99831a1..4858b6e 100644
--- a/ext/standard/basic_functions.c
+++ b/ext/standard/basic_functions.c
@@ -5108,8 +5108,11 @@ void php_free_shutdown_functions(TSRMLS_D) /* {{{ */
zend_hash_destroy(BG(user_shutdown_function_names));
FREE_HASHTABLE(BG(user_shutdown_function_names));
BG(user_shutdown_function_names) = NULL;
-   }
-   zend_end_try();
+   } zend_catch {
+   /* maybe shutdown method call exit, we just ignore it */
+   FREE_HASHTABLE(BG(user_shutdown_function_names));
+   BG(user_shutdown_function_names) = NULL;
+   } zend_end_try();
 }
 /* }}} */


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



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

2012-08-12 Thread Xinchen Hui
Commit:be818e7ea7a7627ab12faa70d9e70a85c823f738
Author:Xinchen Hui larue...@php.net Sun, 12 Aug 2012 20:59:33 
+0800
Parents:   dda0565b53803a3fbed36b94e4c03a02d7b7d2a0
Branches:  PHP-5.4

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

Log:
Update NEWS

Changed paths:
  M  NEWS


Diff:
diff --git a/NEWS b/NEWS
index 236f8e5..da53df0 100644
--- a/NEWS
+++ b/NEWS
@@ -3,17 +3,17 @@ PHP   
 NEWS
 ?? ??? 2012, PHP 5.4.7
 
 - Core:
+  . Fixed bug #62763 (register_shutdown_function and extending class).
+(Laruence)
   . Fixed bug #62725 (Calling exit() in a shutdown function does not return
 the exit value). (Laruence)
+  . Fixed bug #62328 (implementing __toString and a cast to string fails)
+(Laruence)
   . Fixed bug #51363 (Fatal error raised by var_export() not caught by error 
 handler). (Lonny Kapelushnik)
   . Fixed bug #40459 (Stat and Dir stream wrapper methods do not call 
 constructor). (Stas)
 
-- SimpleXML:
-  . Fixed bug #62328 (implementing __toString and a cast to string fails)
-(Laruence)
-
 - PDO:
   . Fixed bug #62685 (Wrong return datatype in PDO::inTransaction()). 
(Laruence)


--
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.3' into PHP-5.4: ext/standard/basic_functions.c

2012-08-12 Thread Xinchen Hui
Commit:dda0565b53803a3fbed36b94e4c03a02d7b7d2a0
Author:Xinchen Hui larue...@php.net Sun, 12 Aug 2012 20:58:45 
+0800
Parents:   786670f53682c1e43f52c7642e6e47ed25f6708d 
4970926e4543c15e16b0c047d85dddfb4c09b581
Branches:  PHP-5.4

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

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

Changed paths:
  MM  ext/standard/basic_functions.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.4': ext/standard/basic_functions.c

2012-08-12 Thread Xinchen Hui
Commit:253760bb6b73ad39ec1143aad4ecc95ee281dc7b
Author:Xinchen Hui larue...@php.net Sun, 12 Aug 2012 21:00:01 
+0800
Parents:   9787e7af44096dec749bcb1f71dbf6e9d75e1de5 
be818e7ea7a7627ab12faa70d9e70a85c823f738
Branches:  master

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

Log:
Merge branch 'PHP-5.4'

Changed paths:
  MM  ext/standard/basic_functions.c


Diff:



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



[PHP-CVS] com php-src: Test for bug 62328: Zend/tests/bug62328.phpt

2012-08-12 Thread Xinchen Hui
Commit:222ab9da1aa086a47279d29c16a8ebea514257fe
Author:Leigh lei...@gmail.com Fri, 10 Aug 2012 11:43:53 +0100
Parents:   a5dfd414941953c282bb68f6b08685252ca93a1a
Branches:  master

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

Log:
Test for bug 62328

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

Changed paths:
  A  Zend/tests/bug62328.phpt


Diff:
diff --git a/Zend/tests/bug62328.phpt b/Zend/tests/bug62328.phpt
new file mode 100644
index 000..c56ddc2
--- /dev/null
+++ b/Zend/tests/bug62328.phpt
@@ -0,0 +1,22 @@
+--TEST--
+Bug #62328 (cast_object takes precedence over __toString)
+--FILE--
+?php
+
+class SplFileInfo62328 extends SplFileInfo
+{
+   public function __toString()
+   {
+   return '__toString';
+   }
+}
+
+$fi = new SplFileInfo62328(__FILE__);
+
+echo (string)$fi . PHP_EOL;
+echo (string)$fi-__toString() . PHP_EOL;
+
+?
+--EXPECT--
+__toString
+__toString


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



[PHP-CVS] com php-src: Fixed bug #62328 (implementing __toString and a cast to string fails): NEWS Zend/zend.c ext/xml/tests/bug62328.phpt

2012-08-12 Thread Xinchen Hui
Commit:7b307fb930e6cf328993dee4b060f6f823c39d24
Author:Xinchen Hui larue...@php.net Sun, 12 Aug 2012 11:50:28 
+0800
Parents:   d4f9bbfae248687c1aa68370564b14544eb4eafd
Branches:  PHP-5.4

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

Log:
Fixed bug #62328 (implementing __toString and a cast to string fails)

__toString should has a high priority

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

Changed paths:
  M  NEWS
  M  Zend/zend.c
  A  ext/xml/tests/bug62328.phpt


Diff:
diff --git a/NEWS b/NEWS
index 60fe2b9..6efc0df 100644
--- a/NEWS
+++ b/NEWS
@@ -3,6 +3,8 @@ PHP 
   NEWS
 ?? ??? 2012, PHP 5.4.7
 
 - Core:
+  . Fixed bug #62328 (implementing __toString and a cast to string fails)
+(Laruence)
   . Fixed bug #62725 (Calling exit() in a shutdown function does not return
 the exit value). (Laruence)
   . Fixed bug #51363 (Fatal error raised by var_export() not caught by error 
diff --git a/Zend/zend.c b/Zend/zend.c
index 18c4f11..09338e7 100644
--- a/Zend/zend.c
+++ b/Zend/zend.c
@@ -258,6 +258,9 @@ ZEND_API void zend_make_printable_zval(zval *expr, zval 
*expr_copy, int *use_cop
{
TSRMLS_FETCH();
 
+   if (zend_std_cast_object_tostring(expr, 
expr_copy, IS_STRING TSRMLS_CC) == SUCCESS) {
+   break;
+   }
if (Z_OBJ_HANDLER_P(expr, cast_object)) {
zval *val;
 
@@ -270,12 +273,6 @@ ZEND_API void zend_make_printable_zval(zval *expr, zval 
*expr_copy, int *use_cop
}
zval_ptr_dtor(val);
}
-   /* Standard PHP objects */
-   if (Z_OBJ_HT_P(expr) == std_object_handlers || 
!Z_OBJ_HANDLER_P(expr, cast_object)) {
-   if (zend_std_cast_object_tostring(expr, 
expr_copy, IS_STRING TSRMLS_CC) == SUCCESS) {
-   break;
-   }
-   }
if (!Z_OBJ_HANDLER_P(expr, cast_object)  
Z_OBJ_HANDLER_P(expr, get)) {
zval *z = Z_OBJ_HANDLER_P(expr, 
get)(expr TSRMLS_CC);
 
diff --git a/ext/xml/tests/bug62328.phpt b/ext/xml/tests/bug62328.phpt
new file mode 100644
index 000..e4c3c59
--- /dev/null
+++ b/ext/xml/tests/bug62328.phpt
@@ -0,0 +1,21 @@
+--TEST--
+Bug #62328 (implementing __toString and a cast to string fails)
+--SKIPIF--
+?php
+require_once(skipif.inc);
+?
+--FILE--
+?php
+class UberSimpleXML extends SimpleXMLElement {
+public function __toString() {
+return 'stringification';
+}
+}
+
+$xml = new UberSimpleXML('xml/');
+
+var_dump((string) $xml);
+var_dump($xml-__toString());
+--EXPECT--
+string(15) stringification
+string(15) stringification


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



[PHP-CVS] com php-src: zend_make_printable_zval choses cast_object over __toString: Zend/zend.c

2012-08-12 Thread Xinchen Hui
Commit:a5dfd414941953c282bb68f6b08685252ca93a1a
Author:Leigh lei...@gmail.com Fri, 10 Aug 2012 11:09:25 +0100
Parents:   7e4c0125dac2167b13ff279d8213ee46be45d4c7
Branches:  master

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

Log:
zend_make_printable_zval choses cast_object over __toString

https://bugs.php.net/bug.php?id=62328

Added a check to see if the object implements a __toString magic
method. This should be called instead of the cast_object method of
built-in classes when defined.

Changed paths:
  M  Zend/zend.c


Diff:
diff --git a/Zend/zend.c b/Zend/zend.c
index 18c4f11..be30e92 100644
--- a/Zend/zend.c
+++ b/Zend/zend.c
@@ -258,6 +258,12 @@ ZEND_API void zend_make_printable_zval(zval *expr, zval 
*expr_copy, int *use_cop
{
TSRMLS_FETCH();
 
+   if (Z_OBJCE_P(expr)-__tostring) {
+   if (zend_std_cast_object_tostring(expr, 
expr_copy, IS_STRING TSRMLS_CC) == SUCCESS) {
+   break;
+   }
+   }
+
if (Z_OBJ_HANDLER_P(expr, cast_object)) {
zval *val;


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



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

2012-08-12 Thread Xinchen Hui
Commit:786670f53682c1e43f52c7642e6e47ed25f6708d
Author:Xinchen Hui larue...@php.net Sun, 12 Aug 2012 12:00:16 
+0800
Parents:   7b307fb930e6cf328993dee4b060f6f823c39d24
Branches:  PHP-5.4

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

Log:
Update NEWS

Changed paths:
  M  NEWS


Diff:
diff --git a/NEWS b/NEWS
index 6efc0df..236f8e5 100644
--- a/NEWS
+++ b/NEWS
@@ -3,8 +3,6 @@ PHP 
   NEWS
 ?? ??? 2012, PHP 5.4.7
 
 - Core:
-  . Fixed bug #62328 (implementing __toString and a cast to string fails)
-(Laruence)
   . Fixed bug #62725 (Calling exit() in a shutdown function does not return
 the exit value). (Laruence)
   . Fixed bug #51363 (Fatal error raised by var_export() not caught by error 
@@ -12,6 +10,10 @@ PHP  
  NEWS
   . Fixed bug #40459 (Stat and Dir stream wrapper methods do not call 
 constructor). (Stas)
 
+- SimpleXML:
+  . Fixed bug #62328 (implementing __toString and a cast to string fails)
+(Laruence)
+
 - PDO:
   . Fixed bug #62685 (Wrong return datatype in PDO::inTransaction()). 
(Laruence)


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



<    1   2   3   4   5   6   7   8   >