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

2005-12-27 Thread Steph Fox
- ok so I'm slowly catching up on weeklies (even tho' it's Christmas Day 
bleh)


This doesn't make any sense to me, at all.

#if defined(__CYGWIN__)
zend_bool more_entropy = 1;
#else
zend_bool more_entropy = 0;
#endif
...
...
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, |sb, prefix, 
prefix_len,

more_entropy)) {
 return;
}
...
...

#if HAVE_USLEEP  !defined(PHP_WIN32)
if (!more_entropy) {
#if defined(__CYGWIN__)
 php_error_docref(NULL TSRMLS_CC, E_WARNING, You must use 'more entropy' 
under CYGWIN.);

 RETURN_FALSE;
#else
 usleep(1);
#endif
}
#endif


I can just about get my head around the idea that PHP_WIN32 might not be 
defined where CYGWIN is (just about) but, assuming it gets past that crisis, 
the only time you'd ever see that warning would be when you'd _used_ the 
optional 'more_entropy' parameter under Cygwin to pass 0...


Wouldn't it be better to start with more_entropy = 0 for everyone, force 
more_entropy = 1 under Cygwin regardless of (but after) user input, and/or 
maybe emit a more appropriate E_NOTICE/E_WARNING if the Cygwin-based user 
tries to set it to 0?



- Original Message - 
From: Marcus Boerger [EMAIL PROTECTED]

To: Ilia Alshanetsky [EMAIL PROTECTED]
Cc: php-cvs@lists.php.net
Sent: Wednesday, October 19, 2005 8:27 PM
Subject: Re: [PHP-CVS] cvs: php-src /ext/standard uniqid.c



Hello Ilia,

 why did you change this, the E_ERROR was there to make clear it does not
work and can never work

Wednesday, October 19, 2005, 3:41:37 PM, you wrote:


iliaa   Wed Oct 19 09:41:37 2005 EDT



  Modified files:
/php-src/ext/standard   uniqid.c
  Log:
  Change E_ERROR to E_WARNING when more_entropy flag is off on Cygwin.


http://cvs.php.net/diff.php/php-src/ext/standard/uniqid.c?r1=1.42r2=1.43ty=u
Index: php-src/ext/standard/uniqid.c
diff -u php-src/ext/standard/uniqid.c:1.42 
php-src/ext/standard/uniqid.c:1.43

--- php-src/ext/standard/uniqid.c:1.42  Tue Aug 23 08:53:30 2005
+++ php-src/ext/standard/uniqid.c   Wed Oct 19 09:41:36 2005
@@ -16,7 +16,7 @@

+--+
  */

-/* $Id: uniqid.c,v 1.42 2005/08/23 12:53:30 dmitry Exp $ */
+/* $Id: uniqid.c,v 1.43 2005/10/19 13:41:36 iliaa Exp $ */

 #include php.h

@@ -61,8 +61,8 @@
 #if HAVE_USLEEP  !defined(PHP_WIN32)
if (!more_entropy) {
 #if defined(__CYGWIN__)
-   php_error_docref(NULL TSRMLS_CC, E_ERROR, You must use 
'more entropy' under CYGWIN.);

-   return;
+   php_error_docref(NULL TSRMLS_CC, E_WARNING, You must use 
'more entropy' under CYGWIN.);

+   RETURN_FALSE;
 #else
usleep(1);
 #endif





Best regards,
Marcus

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



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



[PHP-CVS] cvs: php-src(PHP_5_1) /ext/openssl/tests 001.phpt bug25614.phpt skipif.inc

2005-12-27 Thread Ilia Alshanetsky
iliaa   Tue Dec 27 17:16:41 2005 EDT

  Removed files:   (Branch: PHP_5_1)
/php-src/ext/openssl/tests  skipif.inc 

  Modified files:  
/php-src/ext/openssl/tests  001.phpt bug25614.phpt 
  Log:
  Improve skip checks
  
  
http://cvs.php.net/viewcvs.cgi/php-src/ext/openssl/tests/001.phpt?r1=1.5r2=1.5.4.1diff_format=u
Index: php-src/ext/openssl/tests/001.phpt
diff -u php-src/ext/openssl/tests/001.phpt:1.5 
php-src/ext/openssl/tests/001.phpt:1.5.4.1
--- php-src/ext/openssl/tests/001.phpt:1.5  Wed May 19 08:56:49 2004
+++ php-src/ext/openssl/tests/001.phpt  Tue Dec 27 17:16:40 2005
@@ -1,8 +1,10 @@
 --TEST--
 OpenSSL private key functions
 --SKIPIF--
-?php // vim600:syn=php
-include('skipif.inc'); ?
+?php 
+if (!extension_loaded(openssl)) die(skip); 
+if ([EMAIL PROTECTED]()) die(skip cannot create private key); 
+?
 --FILE--
 ?php
 echo Creating private key\n;
http://cvs.php.net/viewcvs.cgi/php-src/ext/openssl/tests/bug25614.phpt?r1=1.3r2=1.3.4.1diff_format=u
Index: php-src/ext/openssl/tests/bug25614.phpt
diff -u php-src/ext/openssl/tests/bug25614.phpt:1.3 
php-src/ext/openssl/tests/bug25614.phpt:1.3.4.1
--- php-src/ext/openssl/tests/bug25614.phpt:1.3 Wed Sep 24 10:35:19 2003
+++ php-src/ext/openssl/tests/bug25614.phpt Tue Dec 27 17:16:40 2005
@@ -1,7 +1,10 @@
 --TEST--
 openssl: get public key from generated private key
 --SKIPIF--
-?php if (!extension_loaded(openssl)) print skip; ?
+?php 
+if (!extension_loaded(openssl)) die(skip); 
+if ([EMAIL PROTECTED]()) die(skip cannot create private key); 
+?
 --FILE--
 ?php 
 $priv = openssl_pkey_new();

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



[PHP-CVS] cvs: php-src /ext/openssl/tests 001.phpt bug25614.phpt skipif.inc

2005-12-27 Thread Ilia Alshanetsky
iliaa   Tue Dec 27 17:17:10 2005 EDT

  Removed files:   
/php-src/ext/openssl/tests  skipif.inc 

  Modified files:  
/php-src/ext/openssl/tests  001.phpt bug25614.phpt 
  Log:
  MFB51: Improve skip checks
  
  
http://cvs.php.net/viewcvs.cgi/php-src/ext/openssl/tests/001.phpt?r1=1.5r2=1.6diff_format=u
Index: php-src/ext/openssl/tests/001.phpt
diff -u php-src/ext/openssl/tests/001.phpt:1.5 
php-src/ext/openssl/tests/001.phpt:1.6
--- php-src/ext/openssl/tests/001.phpt:1.5  Wed May 19 08:56:49 2004
+++ php-src/ext/openssl/tests/001.phpt  Tue Dec 27 17:17:10 2005
@@ -1,8 +1,10 @@
 --TEST--
 OpenSSL private key functions
 --SKIPIF--
-?php // vim600:syn=php
-include('skipif.inc'); ?
+?php 
+if (!extension_loaded(openssl)) die(skip); 
+if ([EMAIL PROTECTED]()) die(skip cannot create private key); 
+?
 --FILE--
 ?php
 echo Creating private key\n;
http://cvs.php.net/viewcvs.cgi/php-src/ext/openssl/tests/bug25614.phpt?r1=1.3r2=1.4diff_format=u
Index: php-src/ext/openssl/tests/bug25614.phpt
diff -u php-src/ext/openssl/tests/bug25614.phpt:1.3 
php-src/ext/openssl/tests/bug25614.phpt:1.4
--- php-src/ext/openssl/tests/bug25614.phpt:1.3 Wed Sep 24 10:35:19 2003
+++ php-src/ext/openssl/tests/bug25614.phpt Tue Dec 27 17:17:10 2005
@@ -1,7 +1,10 @@
 --TEST--
 openssl: get public key from generated private key
 --SKIPIF--
-?php if (!extension_loaded(openssl)) print skip; ?
+?php 
+if (!extension_loaded(openssl)) die(skip); 
+if ([EMAIL PROTECTED]()) die(skip cannot create private key); 
+?
 --FILE--
 ?php 
 $priv = openssl_pkey_new();

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



[PHP-CVS] cvs: php-src(PHP_5_1) / NEWS /ext/standard array.c /ext/standard/tests/array bug35821.phpt

2005-12-27 Thread Antony Dovgal
tony2001Tue Dec 27 22:32:01 2005 EDT

  Added files: (Branch: PHP_5_1)
/php-src/ext/standard/tests/array   bug35821.phpt 

  Modified files:  
/php-srcNEWS 
/php-src/ext/standard   array.c 
  Log:
  fix #35821 (array_map() segfaults when exception is throwed from the callback)
  
  
http://cvs.php.net/viewcvs.cgi/php-src/NEWS?r1=1.2027.2.328r2=1.2027.2.329diff_format=u
Index: php-src/NEWS
diff -u php-src/NEWS:1.2027.2.328 php-src/NEWS:1.2027.2.329
--- php-src/NEWS:1.2027.2.328   Mon Dec 26 16:18:44 2005
+++ php-src/NEWSTue Dec 27 22:32:01 2005
@@ -7,6 +7,8 @@
 - Fixed segfault/leak in imagecolormatch(). (Pierre)
 - Fixed small leak in mysqli_stmt_fetch() when bound variable was empty string.
   (Andrey)
+- Fixed bug #35821 (array_map() segfaults when exception is throwed from 
+  the callback). (Tony)
 - Fixed bug #35781 (stream_filter_append() can cause segfault). (Tony)
 - Fixed bug #35759 (mysqli_stmt_bind_result() makes huge allocation when
   column empty). (Andrey)
http://cvs.php.net/viewcvs.cgi/php-src/ext/standard/array.c?r1=1.308.2.13r2=1.308.2.14diff_format=u
Index: php-src/ext/standard/array.c
diff -u php-src/ext/standard/array.c:1.308.2.13 
php-src/ext/standard/array.c:1.308.2.14
--- php-src/ext/standard/array.c:1.308.2.13 Mon Dec  5 22:53:55 2005
+++ php-src/ext/standard/array.cTue Dec 27 22:32:01 2005
@@ -21,7 +21,7 @@
+--+
 */
 
-/* $Id: array.c,v 1.308.2.13 2005/12/05 22:53:55 sniper Exp $ */
+/* $Id: array.c,v 1.308.2.14 2005/12/27 22:32:01 tony2001 Exp $ */
 
 #include php.h
 #include php_ini.h
@@ -4347,7 +4347,7 @@
fci.params = params[1];
fci.no_separation = 0;
 
-   if (!zend_call_function(fci, fci_cache TSRMLS_CC) == 
SUCCESS  result) {
+   if (!zend_call_function(fci, fci_cache TSRMLS_CC) == 
SUCCESS || !result) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, An 
error occurred while invoking the map callback);
efree(array_len);
efree(args);

http://cvs.php.net/viewcvs.cgi/php-src/ext/standard/tests/array/bug35821.phpt?view=markuprev=1.1
Index: php-src/ext/standard/tests/array/bug35821.phpt
+++ php-src/ext/standard/tests/array/bug35821.phpt

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



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

2005-12-27 Thread Antony Dovgal
tony2001Tue Dec 27 22:33:40 2005 EDT

  Modified files:  
/php-src/ext/standard   array.c 
  Log:
  MF51: fix #35821 (array_map() segfaults when exception is throwed from the 
callback)
  
  
http://cvs.php.net/viewcvs.cgi/php-src/ext/standard/array.c?r1=1.333r2=1.334diff_format=u
Index: php-src/ext/standard/array.c
diff -u php-src/ext/standard/array.c:1.333 php-src/ext/standard/array.c:1.334
--- php-src/ext/standard/array.c:1.333  Mon Dec  5 22:53:15 2005
+++ php-src/ext/standard/array.cTue Dec 27 22:33:40 2005
@@ -21,7 +21,7 @@
+--+
 */
 
-/* $Id: array.c,v 1.333 2005/12/05 22:53:15 sniper Exp $ */
+/* $Id: array.c,v 1.334 2005/12/27 22:33:40 tony2001 Exp $ */
 
 #include php.h
 #include php_ini.h
@@ -4603,7 +4603,7 @@
fci.params = params[1];
fci.no_separation = 0;
 
-   if (!zend_call_function(fci, fci_cache TSRMLS_CC) == 
SUCCESS  result) {
+   if (!zend_call_function(fci, fci_cache TSRMLS_CC) == 
SUCCESS || !result) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, An 
error occurred while invoking the map callback);
efree(array_len);
efree(args);

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



[PHP-CVS] cvs: php-src /ext/standard/tests/array bug35821.phpt

2005-12-27 Thread Antony Dovgal
tony2001Tue Dec 27 22:35:18 2005 EDT

  Modified files:  
/php-src/ext/standard/tests/array   bug35821.phpt 
  Log:
  add test for #35821
  
  
http://cvs.php.net/viewcvs.cgi/php-src/ext/standard/tests/array/bug35821.phpt?r1=1.1r2=1.2diff_format=u
Index: php-src/ext/standard/tests/array/bug35821.phpt
diff -u /dev/null php-src/ext/standard/tests/array/bug35821.phpt:1.2
--- /dev/null   Tue Dec 27 22:35:18 2005
+++ php-src/ext/standard/tests/array/bug35821.phpt  Tue Dec 27 22:35:18 2005
@@ -0,0 +1,34 @@
+--TEST--
+Bug #35821 (array_map() segfaults when exception is throwed from the callback)
+--FILE--
+?php
+
+class Element
+{
+   public function ThrowException ()
+   {
+   throw new Exception();
+   }
+
+   public static function CallBack(Element $elem)
+   {
+   $elem-ThrowException();
+   }
+}
+
+$arr = array(new Element(), new Element(), new Element());
+array_map(array('Element', 'CallBack'), $arr);
+
+echo Done\n;
+?
+--EXPECTF--
+
+Warning: array_map(): An error occurred while invoking the map callback in %s 
on line %d
+
+Fatal error: Uncaught exception 'Exception' in %s:%d
+Stack trace:
+#0 %s(%d): Element-ThrowException()
+#1 [internal function]: Element::CallBack(Object(Element))
+#2 %s(%d): array_map(Array, Array)
+#3 {main}
+  thrown in %s on line %d

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



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

2005-12-27 Thread Marcus Boerger
Hello Antony,

  that looks pretty wrong (actually was wrong before already). The code
should read:
  if (zend_call_function(fci, fci_cache TSRMLS_CC) != SUCCESS || !result) {
or like this:
  if (zend_call_function(fci, fci_cache TSRMLS_CC) == FAILURE || !result) {

best regards
marcus

Tuesday, December 27, 2005, 11:33:40 PM, you wrote:

 tony2001Tue Dec 27 22:33:40 2005 EDT

   Modified files:  
 /php-src/ext/standard   array.c 
   Log:
   MF51: fix #35821 (array_map() segfaults when exception is throwed from the 
 callback)
   
   
 http://cvs.php.net/viewcvs.cgi/php-src/ext/standard/array.c?r1=1.333r2=1.334diff_format=u
 Index: php-src/ext/standard/array.c
 diff -u php-src/ext/standard/array.c:1.333 php-src/ext/standard/array.c:1.334
 --- php-src/ext/standard/array.c:1.333  Mon Dec  5 22:53:15 2005
 +++ php-src/ext/standard/array.cTue Dec 27 22:33:40 2005
 @@ -21,7 +21,7 @@
 +--+
  */
  
 -/* $Id: array.c,v 1.333 2005/12/05 22:53:15 sniper Exp $ */
 +/* $Id: array.c,v 1.334 2005/12/27 22:33:40 tony2001 Exp $ */
  
  #include php.h
  #include php_ini.h
 @@ -4603,7 +4603,7 @@
 fci.params = params[1];
 fci.no_separation = 0;
  
 -   if (!zend_call_function(fci, fci_cache TSRMLS_CC) 
 == SUCCESS  result) {
 +   if (!zend_call_function(fci, fci_cache TSRMLS_CC) 
 == SUCCESS || !result) {
 php_error_docref(NULL TSRMLS_CC,
 E_WARNING, An error occurred while invoking the map callback);
 efree(array_len);
 efree(args);




Best regards,
 Marcus

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



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

2005-12-27 Thread Antony Dovgal
tony2001Tue Dec 27 23:26:55 2005 EDT

  Modified files:  (Branch: PHP_5_1)
/php-src/ext/standard   array.c 
  Log:
  tweak the fix
  
  
http://cvs.php.net/viewcvs.cgi/php-src/ext/standard/array.c?r1=1.308.2.14r2=1.308.2.15diff_format=u
Index: php-src/ext/standard/array.c
diff -u php-src/ext/standard/array.c:1.308.2.14 
php-src/ext/standard/array.c:1.308.2.15
--- php-src/ext/standard/array.c:1.308.2.14 Tue Dec 27 22:32:01 2005
+++ php-src/ext/standard/array.cTue Dec 27 23:26:55 2005
@@ -21,7 +21,7 @@
+--+
 */
 
-/* $Id: array.c,v 1.308.2.14 2005/12/27 22:32:01 tony2001 Exp $ */
+/* $Id: array.c,v 1.308.2.15 2005/12/27 23:26:55 tony2001 Exp $ */
 
 #include php.h
 #include php_ini.h
@@ -4347,7 +4347,7 @@
fci.params = params[1];
fci.no_separation = 0;
 
-   if (!zend_call_function(fci, fci_cache TSRMLS_CC) == 
SUCCESS || !result) {
+   if (zend_call_function(fci, fci_cache TSRMLS_CC) != 
SUCCESS || !result) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, An 
error occurred while invoking the map callback);
efree(array_len);
efree(args);

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



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

2005-12-27 Thread Antony Dovgal
tony2001Tue Dec 27 23:27:02 2005 EDT

  Modified files:  
/php-src/ext/standard   array.c 
  Log:
  tweak the fix
  
  
http://cvs.php.net/viewcvs.cgi/php-src/ext/standard/array.c?r1=1.334r2=1.335diff_format=u
Index: php-src/ext/standard/array.c
diff -u php-src/ext/standard/array.c:1.334 php-src/ext/standard/array.c:1.335
--- php-src/ext/standard/array.c:1.334  Tue Dec 27 22:33:40 2005
+++ php-src/ext/standard/array.cTue Dec 27 23:27:02 2005
@@ -21,7 +21,7 @@
+--+
 */
 
-/* $Id: array.c,v 1.334 2005/12/27 22:33:40 tony2001 Exp $ */
+/* $Id: array.c,v 1.335 2005/12/27 23:27:02 tony2001 Exp $ */
 
 #include php.h
 #include php_ini.h
@@ -4603,7 +4603,7 @@
fci.params = params[1];
fci.no_separation = 0;
 
-   if (!zend_call_function(fci, fci_cache TSRMLS_CC) == 
SUCCESS || !result) {
+   if (zend_call_function(fci, fci_cache TSRMLS_CC) != 
SUCCESS || !result) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, An 
error occurred while invoking the map callback);
efree(array_len);
efree(args);

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



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

2005-12-27 Thread Antony Dovgal

On 28.12.2005 02:12, Marcus Boerger wrote:

Hello Antony,

  that looks pretty wrong (actually was wrong before already). The code
should read:
  if (zend_call_function(fci, fci_cache TSRMLS_CC) != SUCCESS || !result) {
or like this:
  if (zend_call_function(fci, fci_cache TSRMLS_CC) == FAILURE || !result) {


Ah, yeah.. thanks for noticing it.

--
Wbr, 
Antony Dovgal


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