Skip to content

Commit 273311c

Browse files
committed
ext/pdo_pgsql: stop using smart_str_append_printf()
There isn't really a need for using the printf variant here
1 parent 2d0c3e0 commit 273311c

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

ext/pdo_pgsql/pgsql_driver.c

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1437,15 +1437,20 @@ static int pdo_pgsql_handle_factory(pdo_dbh_t *dbh, zval *driver_options) /* {{{
14371437
tmp_pass = !strstr((char *) dbh->data_source, "password=") ? _pdo_pgsql_escape_credentials(dbh->password) : NULL;
14381438

14391439
smart_str_appendl(&conn_str, dbh->data_source, dbh->data_source_len);
1440-
smart_str_append_printf(&conn_str, " connect_timeout=" ZEND_LONG_FMT, connect_timeout);
1440+
smart_str_append_literal(&conn_str, " connect_timeout=");
1441+
smart_str_append_long(&conn_str, connect_timeout);
14411442

14421443
/* support both full connection string & connection string + login and/or password */
14431444
if (tmp_user) {
1444-
smart_str_append_printf(&conn_str, " user='%s'", ZSTR_VAL(tmp_user));
1445+
smart_str_append_literal(&conn_str, " user='");
1446+
smart_str_append(&conn_str, tmp_user);
1447+
smart_str_appendc(&conn_str, '\'');
14451448
}
14461449

14471450
if (tmp_pass) {
1448-
smart_str_append_printf(&conn_str, " password='%s'", ZSTR_VAL(tmp_pass));
1451+
smart_str_append_literal(&conn_str, " password='");
1452+
smart_str_append(&conn_str, tmp_pass);
1453+
smart_str_appendc(&conn_str, '\'');
14491454
}
14501455
smart_str_0(&conn_str);
14511456

0 commit comments

Comments
 (0)