@@ -235,21 +235,18 @@ safe:
235235 php_stream_from_zval_no_verify (stm, parameter);
236236 if (stm) {
237237 zend_string *buf;
238+ zend_string *quoted;
238239
239240 buf = php_stream_copy_to_mem (stm, PHP_STREAM_COPY_ALL, 0 );
240241 if (!buf) {
241242 buf = ZSTR_EMPTY_ALLOC ();
242243 }
243- if (!stmt->dbh ->methods ->quoter (stmt->dbh , ZSTR_VAL (buf), ZSTR_LEN (buf), &plc->quoted , &plc->qlen ,
244- param->param_type )) {
245- /* bork */
246- ret = -1 ;
247- strncpy (stmt->error_code , stmt->dbh ->error_code , 6 );
248- if (buf) {
249- zend_string_release_ex (buf, 0 );
250- }
251- goto clean_up;
252- }
244+
245+ quoted = stmt->dbh ->methods ->quoter (stmt->dbh , buf, param->param_type );
246+
247+ plc->quoted = ZSTR_VAL (quoted);
248+ plc->qlen = ZSTR_LEN (quoted);
249+
253250 if (buf) {
254251 zend_string_release_ex (buf, 0 );
255252 }
@@ -289,12 +286,10 @@ safe:
289286 plc->freeq = 0 ;
290287 break ;
291288
292- default :
289+ default : {
293290 buf = zval_get_string (parameter);
294- if (EG (exception) ||
295- !stmt->dbh ->methods ->quoter (stmt->dbh , ZSTR_VAL (buf),
296- ZSTR_LEN (buf), &plc->quoted , &plc->qlen ,
297- param_type)) {
291+
292+ if (EG (exception)) {
298293 /* bork */
299294 ret = -1 ;
300295 strncpy (stmt->error_code , stmt->dbh ->error_code , 6 );
@@ -303,7 +298,12 @@ safe:
303298 }
304299 goto clean_up;
305300 }
301+
302+ zend_string *quoted = stmt->dbh ->methods ->quoter (stmt->dbh , buf, param->param_type );
303+ plc->quoted = ZSTR_VAL (quoted);
304+ plc->qlen = ZSTR_LEN (quoted);
306305 plc->freeq = 1 ;
306+ }
307307 }
308308
309309 if (buf) {
0 commit comments