[PHP-CVS] cvs: php-src(PHP_5_3) /ext/reflection php_reflection.c /ext/reflection/tests bug42976.phpt

2007-10-28 Thread Ilia Alshanetsky
iliaa   Sun Oct 28 13:42:24 2007 UTC

  Added files: (Branch: PHP_5_3)
/php-src/ext/reflection/tests   bug42976.phpt 

  Modified files:  
/php-src/ext/reflection php_reflection.c 
  Log:
  Fixed bug #42976 (Crash when constructor for newInstance() or 
  newInstanceArgs() fails)
  
  
http://cvs.php.net/viewvc.cgi/php-src/ext/reflection/php_reflection.c?r1=1.164.2.33.2.45.2.3r2=1.164.2.33.2.45.2.4diff_format=u
Index: php-src/ext/reflection/php_reflection.c
diff -u php-src/ext/reflection/php_reflection.c:1.164.2.33.2.45.2.3 
php-src/ext/reflection/php_reflection.c:1.164.2.33.2.45.2.4
--- php-src/ext/reflection/php_reflection.c:1.164.2.33.2.45.2.3 Sun Oct  7 
05:22:05 2007
+++ php-src/ext/reflection/php_reflection.c Sun Oct 28 13:42:24 2007
@@ -20,7 +20,7 @@
+--+
 */
 
-/* $Id: php_reflection.c,v 1.164.2.33.2.45.2.3 2007/10/07 05:22:05 davidw Exp 
$ */
+/* $Id: php_reflection.c,v 1.164.2.33.2.45.2.4 2007/10/28 13:42:24 iliaa Exp $ 
*/
 
 #ifdef HAVE_CONFIG_H
 #include config.h
@@ -3405,7 +3405,7 @@
Returns an instance of this class */
 ZEND_METHOD(reflection_class, newInstance)
 {
-   zval *retval_ptr;
+   zval *retval_ptr = NULL;
reflection_object *intern;
zend_class_entry *ce;
int argc = ZEND_NUM_ARGS();
@@ -3449,7 +3449,9 @@
 
if (zend_call_function(fci, fcc TSRMLS_CC) == FAILURE) {
efree(params);
-   zval_ptr_dtor(retval_ptr);
+   if (retval_ptr) {
+   zval_ptr_dtor(retval_ptr);
+   }
zend_error(E_WARNING, Invocation of %s's constructor 
failed, ce-name);
RETURN_NULL();
}
@@ -3469,7 +3471,7 @@
Returns an instance of this class */
 ZEND_METHOD(reflection_class, newInstanceArgs)
 {
-   zval *retval_ptr;
+   zval *retval_ptr = NULL;
reflection_object *intern;
zend_class_entry *ce;
int argc = 0;
@@ -3524,7 +3526,9 @@
if (params) {
efree(params);
}
-   zval_ptr_dtor(retval_ptr);
+   if (retval_ptr) {
+   zval_ptr_dtor(retval_ptr);
+   }
zend_error(E_WARNING, Invocation of %s's constructor 
failed, ce-name);
RETURN_NULL();
}
@@ -4903,7 +4907,7 @@
php_info_print_table_start();
php_info_print_table_header(2, Reflection, enabled);
 
-   php_info_print_table_row(2, Version, $Id: php_reflection.c,v 
1.164.2.33.2.45.2.3 2007/10/07 05:22:05 davidw Exp $);
+   php_info_print_table_row(2, Version, $Id: php_reflection.c,v 
1.164.2.33.2.45.2.4 2007/10/28 13:42:24 iliaa Exp $);
 
php_info_print_table_end();
 } /* }}} */

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

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



[PHP-CVS] cvs: php-src /ext/reflection php_reflection.c /ext/reflection/tests bug42976.phpt

2007-10-28 Thread Ilia Alshanetsky
iliaa   Sun Oct 28 13:44:09 2007 UTC

  Modified files:  
/php-src/ext/reflection/tests   bug42976.phpt 
/php-src/ext/reflection php_reflection.c 
  Log:
  
  MFB: Fixed bug #42976 (Crash when constructor for newInstance() or 
  newInstanceArgs() fails)
  
http://cvs.php.net/viewvc.cgi/php-src/ext/reflection/tests/bug42976.phpt?r1=1.1r2=1.2diff_format=u
Index: php-src/ext/reflection/tests/bug42976.phpt
diff -u /dev/null php-src/ext/reflection/tests/bug42976.phpt:1.2
--- /dev/null   Sun Oct 28 13:44:09 2007
+++ php-src/ext/reflection/tests/bug42976.phpt  Sun Oct 28 13:44:09 2007
@@ -0,0 +1,34 @@
+--TEST--
+Bug #42976 (Crash when constructor for newInstance() or newInstanceArgs() 
fails)
+--FILE--
+?php
+
+Class C {
+   function __construct($x) {
+   $x = x.changed;
+   }
+}
+
+$x = x.original;
+new C($x); // OK
+var_dump($x);
+
+$rc = new ReflectionClass('C');
+$x = x.original;
+$rc-newInstance($x); // causes crash
+var_dump($x);
+$x = x.original;
+$rc-newInstanceArgs(array($x)); // causes crash   
+var_dump($x);
+
+echo Done\n;
+?
+--EXPECTF--
+string(9) x.changed
+
+Warning: Invocation of C's constructor failed in %s/bug42976.php on line %d
+string(10) x.original
+
+Warning: Invocation of C's constructor failed in %s/bug42976.php on line %d
+string(10) x.original
+Done
http://cvs.php.net/viewvc.cgi/php-src/ext/reflection/php_reflection.c?r1=1.286r2=1.287diff_format=u
Index: php-src/ext/reflection/php_reflection.c
diff -u php-src/ext/reflection/php_reflection.c:1.286 
php-src/ext/reflection/php_reflection.c:1.287
--- php-src/ext/reflection/php_reflection.c:1.286   Sun Oct  7 05:15:04 2007
+++ php-src/ext/reflection/php_reflection.c Sun Oct 28 13:44:09 2007
@@ -20,7 +20,7 @@
+--+
 */
 
-/* $Id: php_reflection.c,v 1.286 2007/10/07 05:15:04 davidw Exp $ */
+/* $Id: php_reflection.c,v 1.287 2007/10/28 13:44:09 iliaa Exp $ */
 
 #ifdef HAVE_CONFIG_H
 #include config.h
@@ -3484,7 +3484,7 @@
Returns an instance of this class */
 ZEND_METHOD(reflection_class, newInstance)
 {
-   zval *retval_ptr;
+   zval *retval_ptr = NULL;
reflection_object *intern;
zend_class_entry *ce;
int argc = ZEND_NUM_ARGS();
@@ -3528,7 +3528,9 @@
 
if (zend_call_function(fci, fcc TSRMLS_CC) == FAILURE) {
efree(params);
-   zval_ptr_dtor(retval_ptr);
+   if (retval_ptr) {
+   zval_ptr_dtor(retval_ptr);
+   }
zend_error(E_WARNING, Invocation of %v's constructor 
failed, ce-name);
RETURN_NULL();
}
@@ -3548,7 +3550,7 @@
Returns an instance of this class */
 ZEND_METHOD(reflection_class, newInstanceArgs)
 {
-   zval *retval_ptr;
+   zval *retval_ptr = NULL;
reflection_object *intern;
zend_class_entry *ce;
int argc = 0;
@@ -3603,7 +3605,9 @@
if (params) {
efree(params);
}
-   zval_ptr_dtor(retval_ptr);
+   if (retval_ptr) {
+   zval_ptr_dtor(retval_ptr);
+   }
zend_error(E_WARNING, Invocation of %v's constructor 
failed, ce-name);
RETURN_NULL();
}
@@ -5022,7 +5026,7 @@
php_info_print_table_start();
php_info_print_table_header(2, Reflection, enabled);
 
-   php_info_print_table_row(2, Version, $Id: php_reflection.c,v 1.286 
2007/10/07 05:15:04 davidw Exp $);
+   php_info_print_table_row(2, Version, $Id: php_reflection.c,v 1.287 
2007/10/28 13:44:09 iliaa Exp $);
 
php_info_print_table_end();
 } /* }}} */

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



[PHP-CVS] cvs: php-src(PHP_5_2) / NEWS /ext/reflection php_reflection.c /ext/reflection/tests bug42976.phpt

2007-10-28 Thread Ilia Alshanetsky
iliaa   Sun Oct 28 13:47:15 2007 UTC

  Added files: (Branch: PHP_5_2)
/php-src/ext/reflection/tests   bug42976.phpt 

  Modified files:  
/php-src/ext/reflection php_reflection.c 
/php-srcNEWS 
  Log:
  
  MFB: Fixed bug #42976 (Crash when constructor for newInstance() or 
  newInstanceArgs() fails)
  
http://cvs.php.net/viewvc.cgi/php-src/ext/reflection/php_reflection.c?r1=1.164.2.33.2.46r2=1.164.2.33.2.47diff_format=u
Index: php-src/ext/reflection/php_reflection.c
diff -u php-src/ext/reflection/php_reflection.c:1.164.2.33.2.46 
php-src/ext/reflection/php_reflection.c:1.164.2.33.2.47
--- php-src/ext/reflection/php_reflection.c:1.164.2.33.2.46 Thu Sep 27 
09:15:20 2007
+++ php-src/ext/reflection/php_reflection.c Sun Oct 28 13:47:14 2007
@@ -20,7 +20,7 @@
+--+
 */
 
-/* $Id: php_reflection.c,v 1.164.2.33.2.46 2007/09/27 09:15:20 tony2001 Exp $ 
*/
+/* $Id: php_reflection.c,v 1.164.2.33.2.47 2007/10/28 13:47:14 iliaa Exp $ */
 
 #ifdef HAVE_CONFIG_H
 #include config.h
@@ -3405,7 +3405,7 @@
Returns an instance of this class */
 ZEND_METHOD(reflection_class, newInstance)
 {
-   zval *retval_ptr;
+   zval *retval_ptr = NULL;
reflection_object *intern;
zend_class_entry *ce;
int argc = ZEND_NUM_ARGS();
@@ -3449,7 +3449,9 @@
 
if (zend_call_function(fci, fcc TSRMLS_CC) == FAILURE) {
efree(params);
-   zval_ptr_dtor(retval_ptr);
+   if (retval_ptr) {
+   zval_ptr_dtor(retval_ptr);
+   }
zend_error(E_WARNING, Invocation of %s's constructor 
failed, ce-name);
RETURN_NULL();
}
@@ -3469,7 +3471,7 @@
Returns an instance of this class */
 ZEND_METHOD(reflection_class, newInstanceArgs)
 {
-   zval *retval_ptr;
+   zval *retval_ptr = NULL;
reflection_object *intern;
zend_class_entry *ce;
int argc = 0;
@@ -3524,7 +3526,9 @@
if (params) {
efree(params);
}
-   zval_ptr_dtor(retval_ptr);
+   if (retval_ptr) {
+   zval_ptr_dtor(retval_ptr);
+   }
zend_error(E_WARNING, Invocation of %s's constructor 
failed, ce-name);
RETURN_NULL();
}
@@ -4903,7 +4907,7 @@
php_info_print_table_start();
php_info_print_table_header(2, Reflection, enabled);
 
-   php_info_print_table_row(2, Version, $Id: php_reflection.c,v 
1.164.2.33.2.46 2007/09/27 09:15:20 tony2001 Exp $);
+   php_info_print_table_row(2, Version, $Id: php_reflection.c,v 
1.164.2.33.2.47 2007/10/28 13:47:14 iliaa Exp $);
 
php_info_print_table_end();
 } /* }}} */
http://cvs.php.net/viewvc.cgi/php-src/NEWS?r1=1.2027.2.547.2.989r2=1.2027.2.547.2.990diff_format=u
Index: php-src/NEWS
diff -u php-src/NEWS:1.2027.2.547.2.989 php-src/NEWS:1.2027.2.547.2.990
--- php-src/NEWS:1.2027.2.547.2.989 Fri Oct 26 17:45:26 2007
+++ php-src/NEWSSun Oct 28 13:47:14 2007
@@ -44,6 +44,8 @@
   (Ilia)
 - Fixed bug #43020 (Warning message is missing with shuffle() and more
   than one argument). (Scott)
+- Fixed bug #42976 (Crash when constructor for newInstance() or 
+  newInstanceArgs() fails) (Ilia)
 - Fixed bug #42943 (ext/mssql: Move *timeout initialization from RINIT
   to connect time). (Ilia)
 - Fixed bug #42917 (PDO::FETCH_KEY_PAIR doesn't work with setFetchMode).

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

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



Re: [PHP-CVS] cvs: php-src(PHP_5_3) /ext/mysqli mysqli.c /ext/mysqlnd mysqlnd_priv.h

2007-10-28 Thread Marcus Boerger
Hello Andi,

  he's not replicating them, he added them as a fallback. Which allows him
  to use the same sources for 5.2 - I guess.

marcus

Sunday, October 28, 2007, 4:31:59 AM, you wrote:

 Hi Andrey,

 Are you sure it's a good idea to replicate these macros? It kind of
 breaks the ability to tweak them in a central place.
 What's the reasoning for it?

 Andi

 -Original Message-
 From: Andrey Hristov [mailto:[EMAIL PROTECTED]
 Sent: Tuesday, October 16, 2007 1:56 PM
 To: php-cvs@lists.php.net
 Subject: [PHP-CVS] cvs: php-src(PHP_5_3) /ext/mysqli mysqli.c
 /ext/mysqlnd mysqlnd_priv.h
 
 andreyTue Oct 16 20:56:22 2007 UTC
 
   Modified files:  (Branch: PHP_5_3)
 /php-src/ext/mysqli   mysqli.c
 /php-src/ext/mysqlnd  mysqlnd_priv.h
   Log:
   Sync mysqlnd. Should still compile with 5_2 for those who want to
 use
 the
   current stable branch. mysqli from 5_3 patched for mysqlnd should be
 also
   compilable with 5_2.
 
 
 http://cvs.php.net/viewvc.cgi/php-

 src/ext/mysqli/mysqli.c?r1=1.72.2.16.2.17.2.4r2=1.72.2.16.2.17.2.5dif
 f_format=u
 Index: php-src/ext/mysqli/mysqli.c
 diff -u php-src/ext/mysqli/mysqli.c:1.72.2.16.2.17.2.4 php-
 src/ext/mysqli/mysqli.c:1.72.2.16.2.17.2.5
 --- php-src/ext/mysqli/mysqli.c:1.72.2.16.2.17.2.4Tue Oct 16
 13:20:14 2007
 +++ php-src/ext/mysqli/mysqli.c   Tue Oct 16 20:56:22 2007
 @@ -15,7 +15,7 @@
| Author: Georg Richter [EMAIL PROTECTED]
 |

 +---
 ---+
 
 -  $Id: mysqli.c,v 1.72.2.16.2.17.2.4 2007/10/16 13:20:14 tony2001 Exp
 $
 +  $Id: mysqli.c,v 1.72.2.16.2.17.2.5 2007/10/16 20:56:22 andrey Exp $
  */
 
  #ifdef HAVE_CONFIG_H
 @@ -315,6 +315,14 @@
  }
  /* }}} */
 
 +#ifndef Z_ADDREF_P
 +/* PHP 5.2, old GC */
 +#define Z_ADDREF_P(pz)
 (++(pz)-refcount)
 +#define Z_REFCOUNT_P(pz) ((pz)-refcount)
 +#define Z_SET_REFCOUNT_P(pz, rc) ((pz)-refcount = rc)
 +#endif
 +
 +
  /* {{{ mysqli_read_property */
  zval *mysqli_read_property(zval *object, zval *member, int type
 TSRMLS_DC)
  {
 http://cvs.php.net/viewvc.cgi/php-
 src/ext/mysqlnd/mysqlnd_priv.h?r1=1.4.2.2r2=1.4.2.3diff_format=u
 Index: php-src/ext/mysqlnd/mysqlnd_priv.h
 diff -u php-src/ext/mysqlnd/mysqlnd_priv.h:1.4.2.2 php-
 src/ext/mysqlnd/mysqlnd_priv.h:1.4.2.3
 --- php-src/ext/mysqlnd/mysqlnd_priv.h:1.4.2.2Fri Oct  5
 21:23:56
 2007
 +++ php-src/ext/mysqlnd/mysqlnd_priv.hTue Oct 16 20:56:22 2007
 @@ -18,11 +18,21 @@

 +---
 ---+
  */
 
 -/* $Id: mysqlnd_priv.h,v 1.4.2.2 2007/10/05 21:23:56 andrey Exp $ */
 +/* $Id: mysqlnd_priv.h,v 1.4.2.3 2007/10/16 20:56:22 andrey Exp $ */
 
  #ifndef MYSQLND_PRIV_H
  #define MYSQLND_PRIV_H
 
 +#ifndef Z_ADDREF_P
 +/* PHP 5.2, old GC */
 +#define Z_ADDREF_P(pz)
 (++(pz)-refcount)
 +#define Z_DELREF_P(pz)
 (--(pz)-refcount)
 +#define Z_REFCOUNT_P(pz) ((pz)-refcount)
 +#define Z_SET_REFCOUNT_P(pz, rc) ((pz)-refcount = rc)
 +#define Z_REFCOUNT_PP(ppz)   Z_REFCOUNT_P(*(ppz))
 +#define Z_DELREF_PP(ppz) Z_DELREF_P(*(ppz))
 +#endif
 +
  #ifdef ZTS
  #include TSRM.h
  #endif
 
 --
 PHP CVS Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php




Best regards,
 Marcus

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



Re: [PHP-CVS] cvs: php-src(PHP_5_3) /ext/mysqli mysqli.c /ext/mysqlnd mysqlnd_priv.h

2007-10-28 Thread Andrey Hristov
 Hi helly, Andi
Marcus Boerger wrote:
 Hello Andi,
 
   he's not replicating them, he added them as a fallback. Which allows him
   to use the same sources for 5.2 - I guess.

right, mysqlnd currently has one code base (stored in two branches).
There are people, and probably there will be more that would like to try
mysqlnd with 5.2 . Is there a new number of the extension API version,
which I could use instead of checking whether some macros are defined?

 marcus
 
 Sunday, October 28, 2007, 4:31:59 AM, you wrote:
 
 Hi Andrey,
 
 Are you sure it's a good idea to replicate these macros? It kind of
 breaks the ability to tweak them in a central place.
 What's the reasoning for it?
 
 Andi
 
 -Original Message-
 From: Andrey Hristov [mailto:[EMAIL PROTECTED]
 Sent: Tuesday, October 16, 2007 1:56 PM
 To: php-cvs@lists.php.net
 Subject: [PHP-CVS] cvs: php-src(PHP_5_3) /ext/mysqli mysqli.c
 /ext/mysqlnd mysqlnd_priv.h

 andreyTue Oct 16 20:56:22 2007 UTC

   Modified files:  (Branch: PHP_5_3)
 /php-src/ext/mysqli   mysqli.c
 /php-src/ext/mysqlnd  mysqlnd_priv.h
   Log:
   Sync mysqlnd. Should still compile with 5_2 for those who want to
 use
 the
   current stable branch. mysqli from 5_3 patched for mysqlnd should be
 also
   compilable with 5_2.


 http://cvs.php.net/viewvc.cgi/php-

 src/ext/mysqli/mysqli.c?r1=1.72.2.16.2.17.2.4r2=1.72.2.16.2.17.2.5dif
 f_format=u
 Index: php-src/ext/mysqli/mysqli.c
 diff -u php-src/ext/mysqli/mysqli.c:1.72.2.16.2.17.2.4 php-
 src/ext/mysqli/mysqli.c:1.72.2.16.2.17.2.5
 --- php-src/ext/mysqli/mysqli.c:1.72.2.16.2.17.2.4Tue Oct 16
 13:20:14 2007
 +++ php-src/ext/mysqli/mysqli.c   Tue Oct 16 20:56:22 2007
 @@ -15,7 +15,7 @@
| Author: Georg Richter [EMAIL PROTECTED]
 |

 +---
 ---+

 -  $Id: mysqli.c,v 1.72.2.16.2.17.2.4 2007/10/16 13:20:14 tony2001 Exp
 $
 +  $Id: mysqli.c,v 1.72.2.16.2.17.2.5 2007/10/16 20:56:22 andrey Exp $
  */

  #ifdef HAVE_CONFIG_H
 @@ -315,6 +315,14 @@
  }
  /* }}} */

 +#ifndef Z_ADDREF_P
 +/* PHP 5.2, old GC */
 +#define Z_ADDREF_P(pz)
 (++(pz)-refcount)
 +#define Z_REFCOUNT_P(pz) ((pz)-refcount)
 +#define Z_SET_REFCOUNT_P(pz, rc) ((pz)-refcount = rc)
 +#endif
 +
 +
  /* {{{ mysqli_read_property */
  zval *mysqli_read_property(zval *object, zval *member, int type
 TSRMLS_DC)
  {
 http://cvs.php.net/viewvc.cgi/php-
 src/ext/mysqlnd/mysqlnd_priv.h?r1=1.4.2.2r2=1.4.2.3diff_format=u
 Index: php-src/ext/mysqlnd/mysqlnd_priv.h
 diff -u php-src/ext/mysqlnd/mysqlnd_priv.h:1.4.2.2 php-
 src/ext/mysqlnd/mysqlnd_priv.h:1.4.2.3
 --- php-src/ext/mysqlnd/mysqlnd_priv.h:1.4.2.2Fri Oct  5
 21:23:56
 2007
 +++ php-src/ext/mysqlnd/mysqlnd_priv.hTue Oct 16 20:56:22 2007
 @@ -18,11 +18,21 @@

 +---
 ---+
  */

 -/* $Id: mysqlnd_priv.h,v 1.4.2.2 2007/10/05 21:23:56 andrey Exp $ */
 +/* $Id: mysqlnd_priv.h,v 1.4.2.3 2007/10/16 20:56:22 andrey Exp $ */

  #ifndef MYSQLND_PRIV_H
  #define MYSQLND_PRIV_H

 +#ifndef Z_ADDREF_P
 +/* PHP 5.2, old GC */
 +#define Z_ADDREF_P(pz)
 (++(pz)-refcount)
 +#define Z_DELREF_P(pz)
 (--(pz)-refcount)
 +#define Z_REFCOUNT_P(pz) ((pz)-refcount)
 +#define Z_SET_REFCOUNT_P(pz, rc) ((pz)-refcount = rc)
 +#define Z_REFCOUNT_PP(ppz)   Z_REFCOUNT_P(*(ppz))
 +#define Z_DELREF_PP(ppz) Z_DELREF_P(*(ppz))
 +#endif
 +
  #ifdef ZTS
  #include TSRM.h
  #endif

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

Regards,
Andrey

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