]> git.pld-linux.org Git - packages/php.git/blob - php-bug-50458.patch
c656983540448067fda492ae51350a7649da3963
[packages/php.git] / php-bug-50458.patch
1 --- php/php-src/branches/PHP_5_3/ext/pdo/pdo_stmt.c     2009/12/11 22:30:46     292003
2 +++ php/php-src/branches/PHP_5_3/ext/pdo/pdo_stmt.c     2009/12/14 03:44:33     292107
3 @@ -784,95 +784,20 @@
4  
5  static int make_callable_ex(pdo_stmt_t *stmt, zval *callable, zend_fcall_info * fci, zend_fcall_info_cache * fcc, int num_args TSRMLS_DC) /* {{{ */
6  {
7 -       zval *object = NULL, **method = NULL;
8 -       char *fname = NULL, *cname;
9 -       zend_class_entry * ce = NULL, **pce;
10 -       zend_function *function_handler;
11 -       
12 -       if (Z_TYPE_P(callable) == IS_ARRAY) {
13 -               if (Z_ARRVAL_P(callable)->nNumOfElements < 2) {
14 -                       pdo_raise_impl_error(stmt->dbh, stmt, "HY000", "user-supplied function must be a valid callback" TSRMLS_CC);
15 -                       return 0;
16 -               }
17 -               object = *(zval**)Z_ARRVAL_P(callable)->pListHead->pData;
18 -               method = (zval**)Z_ARRVAL_P(callable)->pListHead->pListNext->pData;
19 +       char *is_callable_error = NULL;
20  
21 -               if (Z_TYPE_P(object) == IS_STRING) { /* static call */
22 -                       if (zend_lookup_class(Z_STRVAL_P(object), Z_STRLEN_P(object), &pce TSRMLS_CC) == FAILURE) {
23 -                               pdo_raise_impl_error(stmt->dbh, stmt, "HY000", "user-supplied class does not exist" TSRMLS_CC);
24 -                               return 0;
25 -                       } else {
26 -                               ce = *pce;
27 -                       }
28 -                       object = NULL;
29 -               } else if (Z_TYPE_P(object) == IS_OBJECT) { /* object call */
30 -                       ce = Z_OBJCE_P(object);
31 +       if (zend_fcall_info_init(callable, 0, fci, fcc, NULL, &is_callable_error TSRMLS_CC) == FAILURE) { 
32 +               if (is_callable_error) {
33 +                       pdo_raise_impl_error(stmt->dbh, stmt, "HY000", is_callable_error TSRMLS_CC);
34 +                       efree(is_callable_error);
35                 } else {
36 -                       pdo_raise_impl_error(stmt->dbh, stmt, "HY000", "user-supplied function must be a valid callback; bogus object/class name" TSRMLS_CC);
37 -                       return 0;
38 -               }
39 -               
40 -               if (Z_TYPE_PP(method) != IS_STRING) {
41 -                       pdo_raise_impl_error(stmt->dbh, stmt, "HY000", "user-supplied function must be a valid callback; bogus method name" TSRMLS_CC);
42 -                       return 0;
43 -               }
44 -       } else if (Z_TYPE_P(callable) == IS_STRING) {
45 -               method = &callable;
46 -       }
47 -       
48 -       if (!method || !zend_is_callable(callable, 0, &fname TSRMLS_CC)) {
49 -               pdo_raise_impl_error(stmt->dbh, stmt, "HY000", "user-supplied function must be a valid callback" TSRMLS_CC);
50 -               if (fname) {
51 -                       efree(fname);
52 +                       pdo_raise_impl_error(stmt->dbh, stmt, "HY000", "user-supplied function must be a valid callback" TSRMLS_CC);
53                 }
54                 return 0;
55         }
56         
57 -       /* ATM we do not support array($obj, "CLASS::FUNC") or "CLASS_FUNC" */
58 -       cname = fname;
59 -       if ((fname = strstr(fname, "::")) == NULL) {
60 -               fname = cname;
61 -               cname = NULL;
62 -       } else {
63 -               *fname = '\0';
64 -               fname += 2;
65 -       }
66 -       if (cname) {
67 -               if (zend_lookup_class(cname, strlen(cname), &pce TSRMLS_CC) == FAILURE) {
68 -                       pdo_raise_impl_error(stmt->dbh, stmt, "HY000", "user-supplied class does not exist" TSRMLS_CC);
69 -                       return 0;
70 -               } else {
71 -                       if (ce) {
72 -                               /* pce must be base of ce or ce itself */
73 -                               if (ce != *pce && !instanceof_function(ce, *pce TSRMLS_CC)) {
74 -                                       pdo_raise_impl_error(stmt->dbh, stmt, "HY000", "user-supplied class has bogus lineage" TSRMLS_CC);
75 -                                       return 0;
76 -                               }
77 -                       }
78 -                       ce = *pce;
79 -               }
80 -       }
81 -
82 -       zend_str_tolower_copy(fname, fname, strlen(fname));
83 -       fci->function_table = ce ? &ce->function_table : EG(function_table);
84 -       if (zend_hash_find(fci->function_table, fname, strlen(fname)+1, (void **)&function_handler) == FAILURE) {
85 -               pdo_raise_impl_error(stmt->dbh, stmt, "HY000", "user-supplied function does not exist" TSRMLS_CC);
86 -               return 0;
87 -       }
88 -       efree(cname ? cname : fname);
89 -
90 -       fci->size = sizeof(zend_fcall_info);
91 -       fci->function_name = NULL;
92 -       fci->symbol_table = NULL;
93         fci->param_count = num_args; /* probably less */
94         fci->params = safe_emalloc(sizeof(zval**), num_args, 0);
95 -       fci->object_ptr = object;
96 -
97 -       fcc->initialized = 1;
98 -       fcc->function_handler = function_handler;
99 -       fcc->calling_scope = EG(scope);
100 -       fcc->called_scope = object ? Z_OBJCE_P(object) : NULL;
101 -       fcc->object_ptr = object;
102         
103         return 1;
104  }
105 @@ -1568,7 +1493,9 @@
106                 case 3:
107                 case 2:
108                         stmt->fetch.func.function = arg2;
109 -                       do_fetch_func_prepare(stmt TSRMLS_CC);
110 +                       if (do_fetch_func_prepare(stmt TSRMLS_CC) == 0) {
111 +                               error = 1;
112 +                       }
113                         break;
114                 }
115                 break;
This page took 0.032158 seconds and 2 git commands to generate.