tony2001                Sun Jul 30 11:19:56 2006 UTC

  Added files:                 (Branch: PHP_5_2)
    /php-src/ext/pdo/tests      bug_38253.phpt 

  Modified files:              
    /php-src    NEWS 
    /php-src/ext/pdo    pdo_stmt.c 
  Log:
  fix bug #38253 (PDO produces segfault with default fetch mode)
  add test
  
  
http://cvs.php.net/viewvc.cgi/php-src/NEWS?r1=1.2027.2.547.2.162&r2=1.2027.2.547.2.163&diff_format=u
Index: php-src/NEWS
diff -u php-src/NEWS:1.2027.2.547.2.162 php-src/NEWS:1.2027.2.547.2.163
--- php-src/NEWS:1.2027.2.547.2.162     Sat Jul 29 22:30:22 2006
+++ php-src/NEWS        Sun Jul 30 11:19:56 2006
@@ -20,6 +20,7 @@
 - Fixed a bug in the filter extension that prevented magic_quotes_gpc from
   being applied when RAW filter is used. (Ilia)
 - Fixed bug #38255 (openssl possible leaks while passing keys) (Pierre)
+- Fixed bug #38253 (PDO produces segfault with default fetch mode). (Tony)
 - Fixed bug #38236 (Binary data gets corrupted on multipart/formdata POST).
   (Ilia)
 - Fixed bug #38234 (Exception in __clone makes memory leak). (Dmitry, Nuno)
http://cvs.php.net/viewvc.cgi/php-src/ext/pdo/pdo_stmt.c?r1=1.118.2.38.2.3&r2=1.118.2.38.2.4&diff_format=u
Index: php-src/ext/pdo/pdo_stmt.c
diff -u php-src/ext/pdo/pdo_stmt.c:1.118.2.38.2.3 
php-src/ext/pdo/pdo_stmt.c:1.118.2.38.2.4
--- php-src/ext/pdo/pdo_stmt.c:1.118.2.38.2.3   Tue Jun 20 13:26:01 2006
+++ php-src/ext/pdo/pdo_stmt.c  Sun Jul 30 11:19:56 2006
@@ -18,7 +18,7 @@
   +----------------------------------------------------------------------+
 */
 
-/* $Id: pdo_stmt.c,v 1.118.2.38.2.3 2006/06/20 13:26:01 tony2001 Exp $ */
+/* $Id: pdo_stmt.c,v 1.118.2.38.2.4 2006/07/30 11:19:56 tony2001 Exp $ */
 
 /* The PDO Statement Handle Class */
 
@@ -919,6 +919,10 @@
                                        zval_dtor(&val);
                                }
                                ce = stmt->fetch.cls.ce;
+                               if (!ce) {
+                                       pdo_raise_impl_error(stmt->dbh, stmt, 
"HY000", "No fetch class specified" TSRMLS_CC);
+                                       return 0;
+                               }
                                if ((flags & PDO_FETCH_SERIALIZE) == 0) {
                                        object_init_ex(return_value, ce);
                                        if (!stmt->fetch.cls.fci.size) {
@@ -960,6 +964,10 @@
                                break;
 
                        case PDO_FETCH_FUNC:
+                               if (!stmt->fetch.func.function) {
+                                       pdo_raise_impl_error(stmt->dbh, stmt, 
"HY000", "No fetch function specified" TSRMLS_CC);
+                                       return 0;
+                               }
                                if (!stmt->fetch.func.fci.size) {
                                        if (!do_fetch_func_prepare(stmt 
TSRMLS_CC))
                                        {

http://cvs.php.net/viewvc.cgi/php-src/ext/pdo/tests/bug_38253.phpt?view=markup&rev=1.1
Index: php-src/ext/pdo/tests/bug_38253.phpt
+++ php-src/ext/pdo/tests/bug_38253.phpt

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

Reply via email to