pg_trace

FunctionParams changed in PHP 8.3

Enable tracing a PostgreSQL connection.

PHP 5
PHP 7
PHP 8.0
Improved
PHP 8.1
Improved
PHP 8.2-8.3
PHP 8.4
PHP 8.5
PHP 8.6

pg_trace Function synopsis

pg_trace(
    string $filename,
    string $mode = "w",
    ?PgSql\Connection $connection = null,
    int $trace_mode = 0
  ): bool

Parameters

$filename

Typestring

The full path and file name of the file in which to write the trace log. Same as in fopen.

$mode

OptionalTypestringDefault value"w"

An optional file access mode, same as for fopen.

$connection

OptionalType?PgSql\ConnectionDefault valuenull

$trace_mode

OptionalTypeintDefault value0

An optional trace mode with the following constants PGSQL_TRACE_SUPPRESS_TIMESTAMPS and PGSQL_TRACE_REGRESS_MODE

Return value

Typebool

Returns true on success, false on failure

Changes to the pg_trace Function

PHP 8.3

  • Optional parameter added - #4: int $trace_mode = 0
 pg_trace(
     string $filename,
     string $mode = "w",
-    ?PgSql\Connection $connection = null
+    ?PgSql\Connection $connection = null,
+    int $trace_mode = 0
   ): bool

PHP 8.1

  • Parameter type added for parameter #3 ($connection): ?PgSql\Connection
  pg_trace(
      string $filename,
      string $mode = "w",
-     $connection = null
+     ?PgSql\Connection $connection = null
    ): bool

PHP 8.0

  • Return type added: bool
  • Parameter type added for parameter #1 ($filename): string
  • Parameter type added for parameter #2 ($mode): string
  • Parameter default value added for position #2 ($mode): "w"
  • Parameter default value added for position #3 ($connection): null
  pg_trace(
-     $filename,
+     string $filename,
-     $mode,
+     string $mode = "w",
-     $connection
+     $connection = null
-   )
+   ): bool

pg_trace Function Availability

PHP VersionAvailability
PHP 8.6Upcoming Release Yes
PHP 8.5Supported (Latest) Yes
PHP 8.4Supported Yes
PHP 8.3Security-Fixes Only Yes
PHP 8.2Security-Fixes Only Yes
PHP 8.1Unsupported Yes
PHP 8.0Unsupported Yes
PHP 7.4Unsupported Yes
PHP 7.3Unsupported Yes
PHP 7.2Unsupported Yes
PHP 7.1Unsupported Yes
PHP 7.0Unsupported Yes
PHP 5.6Unsupported Yes
PHP 5.5Unsupported Yes
PHP 5.4Unsupported Yes
PHP 5.3Unsupported Yes