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