diff options
author | Marcus Boerger <helly@php.net> | 2006-03-13 22:56:20 +0000 |
---|---|---|
committer | Marcus Boerger <helly@php.net> | 2006-03-13 22:56:20 +0000 |
commit | 0bcd459300d80e2d4787836eb3cb32ca1761ae38 (patch) | |
tree | 259e2ae6e88b99f0191433493229449e203f58c7 | |
parent | a371a8c15350f0d7a97078b807fbe00f3409a56f (diff) | |
download | php-git-0bcd459300d80e2d4787836eb3cb32ca1761ae38.tar.gz |
- bug #36625 fix
-rw-r--r-- | ext/pgsql/pgsql.c | 2 | ||||
-rwxr-xr-x | ext/pgsql/tests/80_bug36625.phpt | 49 |
2 files changed, 50 insertions, 1 deletions
diff --git a/ext/pgsql/pgsql.c b/ext/pgsql/pgsql.c index 2617d711c7..60cd217757 100644 --- a/ext/pgsql/pgsql.c +++ b/ext/pgsql/pgsql.c @@ -2360,7 +2360,7 @@ PHP_FUNCTION(pg_trace) RETURN_FALSE; } - if (FAILURE == php_stream_cast(stream, PHP_STREAM_AS_STDIO, (void**)fp, REPORT_ERRORS)) { + if (FAILURE == php_stream_cast(stream, PHP_STREAM_AS_STDIO, (void**)&fp, REPORT_ERRORS)) { php_stream_close(stream); RETURN_FALSE; } diff --git a/ext/pgsql/tests/80_bug36625.phpt b/ext/pgsql/tests/80_bug36625.phpt new file mode 100755 index 0000000000..a95cea7110 --- /dev/null +++ b/ext/pgsql/tests/80_bug36625.phpt @@ -0,0 +1,49 @@ +--TEST-- +Bug #36625 (pg_trace() does not work) +--SKIPIF-- +<?php +require_once('skipif.inc'); +?> +--FILE-- +<?php + +require_once('config.inc'); + +$dbh = @pg_connect($conn_str); +if (!$dbh) { + die ('Could not connect to the server'); +} + +$tracefile = dirname(__FILE__) . '/trace.tmp'; + +@unlink($tracefile); +var_dump(file_exists($tracefile)); + +pg_trace($tracefile, 'w', $dbh); +$res = pg_query($dbh, 'select 1'); +var_dump($res); +pg_close($dbh); + +$found = 0; +function search_trace_file($line) +{ + if (strpos($line, '"select 1"') !== false || strpos($line, "'select 1'") !== false) { + $GLOBALS['found']++; + } +} + +$trace = file($tracefile); +array_walk($trace, 'search_trace_file'); +var_dump($found > 0); +var_dump(file_exists($tracefile)); + +?> +===DONE=== +--CLEAN-- +<?php unlink($tracefile); ?> +--EXPECTF-- +bool(false) +resource(%d) of type (pgsql result) +bool(true) +bool(true) +===DONE=== |