Skip to content

Commit e41a200

Browse files
committed
Merge branch 'PHP-5.5' into PHP-5.6
* PHP-5.5: NEWS 5.5 Fixed Bug #69667 segfault in php_pgsql_meta_data fix test output (32bits)
2 parents 4c5efc7 + 4bda39b commit e41a200

File tree

2 files changed

+34
-2
lines changed

2 files changed

+34
-2
lines changed

ext/pgsql/pg_insert_002.phpt

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
--TEST--
2+
PostgreSQL pg_select() - basic test using schema
3+
--SKIPIF--
4+
<?php include("skipif.inc"); ?>
5+
--FILE--
6+
<?php
7+
8+
include('config.inc');
9+
10+
$conn = pg_connect($conn_str);
11+
12+
foreach (array('', '.', '..') as $table) {
13+
var_dump(pg_insert($conn, '', array('id' => 1, 'id2' => 1)));
14+
}
15+
?>
16+
Done
17+
--EXPECTF--
18+
19+
Warning: pg_insert(): The table name must be specified in %s on line %d
20+
bool(false)
21+
22+
Warning: pg_insert(): The table name must be specified in %s on line %d
23+
bool(false)
24+
25+
Warning: pg_insert(): The table name must be specified in %s on line %d
26+
bool(false)
27+
Done

ext/pgsql/pgsql.c

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5479,7 +5479,11 @@ PHP_PGSQL_API int php_pgsql_meta_data(PGconn *pg_link, const char *table_name, z
54795479

54805480
src = estrdup(table_name);
54815481
tmp_name = php_strtok_r(src, ".", &tmp_name2);
5482-
5482+
if (!tmp_name) {
5483+
efree(src);
5484+
php_error_docref(NULL TSRMLS_CC, E_WARNING, "The table name must be specified");
5485+
return FAILURE;
5486+
}
54835487
if (!tmp_name2 || !*tmp_name2) {
54845488
/* Default schema */
54855489
tmp_name2 = tmp_name;
@@ -6496,7 +6500,8 @@ static int do_exec(smart_str *querystr, int expect, PGconn *pg_link, ulong opt T
64966500

64976501
static inline void build_tablename(smart_str *querystr, PGconn *pg_link, const char *table)
64986502
{
6499-
char *table_copy, *escaped, *token, *tmp;
6503+
char *table_copy, *escaped, *tmp;
6504+
const char *token;
65006505
size_t len;
65016506

65026507
/* schame.table should be "schame"."table" */

0 commit comments

Comments
 (0)