@@ -77,7 +77,7 @@ struct placeholder {
77
77
};
78
78
79
79
static void free_param_name (zval *el) {
80
- zend_string_release_ex (Z_PTR_P (el), 0 );
80
+ efree (Z_PTR_P (el));
81
81
}
82
82
83
83
PDO_API int pdo_parse_params (pdo_stmt_t *stmt, zend_string *inquery, zend_string **outquery)
@@ -359,22 +359,20 @@ rewrite:
359
359
360
360
for (plc = placeholders; plc; plc = plc->next ) {
361
361
int skip_map = 0 ;
362
- zend_string *p;
362
+ char *p;
363
363
zend_string *idxbuf;
364
- zend_string *name_str;
365
364
366
365
if (plc->bindno == PDO_PARSER_BINDNO_ESCAPED_CHAR) {
367
366
continue ;
368
367
}
369
368
370
369
name = estrndup (plc->pos , plc->len );
371
- name_str = zend_string_init (name, plc->len , 0 );
372
370
373
371
/* check if bound parameter is already available */
374
- if (!strcmp (name, " ?" ) || (p = zend_hash_find_ptr (stmt->bound_param_map , name_str )) == NULL ) {
372
+ if (!strcmp (name, " ?" ) || (p = zend_hash_str_find_ptr (stmt->bound_param_map , name, plc-> len )) == NULL ) {
375
373
idxbuf = zend_strpprintf (0 , tmpl, bind_no++);
376
374
} else {
377
- idxbuf = p ;
375
+ idxbuf = zend_string_init (p, strlen (p), 0 ) ;
378
376
skip_map = 1 ;
379
377
}
380
378
@@ -384,11 +382,11 @@ rewrite:
384
382
385
383
if (!skip_map && stmt->named_rewrite_template ) {
386
384
/* create a mapping */
387
- zend_hash_update_ptr (stmt->bound_param_map , name_str , plc->quoted );
385
+ zend_hash_str_update_mem (stmt->bound_param_map , name , plc->len , ZSTR_VAL (plc-> quoted ), ZSTR_LEN (plc-> quoted ) + 1 );
388
386
}
389
387
390
388
/* map number to name */
391
- zend_hash_index_update_ptr (stmt->bound_param_map , plc->bindno , plc->quoted );
389
+ zend_hash_index_update_mem (stmt->bound_param_map , plc->bindno , ZSTR_VAL ( plc->quoted ), ZSTR_LEN (plc-> quoted ) + 1 );
392
390
393
391
efree (name);
394
392
}
@@ -407,11 +405,8 @@ rewrite:
407
405
408
406
for (plc = placeholders; plc; plc = plc->next ) {
409
407
char *name;
410
- zend_string *name_str;
411
408
name = estrndup (plc->pos , plc->len );
412
- name_str = zend_string_init (name, plc->len , 0 );
413
- // zend_hash_index_update_mem(stmt->bound_param_map, plc->bindno, name, plc->len + 1);
414
- zend_hash_index_update_ptr (stmt->bound_param_map , plc->bindno , name_str);
409
+ zend_hash_index_update_mem (stmt->bound_param_map , plc->bindno , name, plc->len + 1 );
415
410
efree (name);
416
411
plc->quoted = ZSTR_CHAR (' ?' );
417
412
newbuffer_len -= plc->len - 1 ;
0 commit comments