xref: /PHP-7.3/ext/pdo/tests/bug_69356.phpt (revision 08089f01)
1--TEST--
2PDO Common: Bug #69356 (PDOStatement::debugDumpParams() truncates query)
3--SKIPIF--
4<?php
5if (!extension_loaded('pdo')) die('skip');
6$dir = getenv('REDIR_TEST_DIR');
7if (false == $dir) die('skip no driver');
8require_once $dir . 'pdo_test.inc';
9PDOTest::skip();
10?>
11--FILE--
12<?php
13if (getenv('REDIR_TEST_DIR') === false) putenv('REDIR_TEST_DIR='.dirname(__FILE__) . '/../../pdo/tests/');
14require_once getenv('REDIR_TEST_DIR') . 'pdo_test.inc';
15
16$db = PDOTest::factory();
17$db->setAttribute(PDO::ATTR_EMULATE_PREPARES, true);
18$stmt = $db->query("
19    SELECT '
20        Dumps the informations contained by a prepared statement directly on the output. It will provide the SQL query in use, the number of parameters used (Params), the list of parameters, with their name, type (paramtype) as an integer, their key name or position, and the position in the query (if this is supported by the PDO driver, otherwise, it will be -1).
21        This is a debug function, which dump directly the data on the normal output.
22        Tip:
23        As with anything that outputs its result directly to the browser, the output-control functions can be used to capture the output of this function, and save it in a string (for example).
24        This will only dumps the parameters in the statement at the moment of the dump. Extra parameters are not stored in the statement, and not displayed.
25    '
26");
27var_dump($stmt->debugDumpParams());
28?>
29--EXPECT--
30SQL: [835]
31    SELECT '
32        Dumps the informations contained by a prepared statement directly on the output. It will provide the SQL query in use, the number of parameters used (Params), the list of parameters, with their name, type (paramtype) as an integer, their key name or position, and the position in the query (if this is supported by the PDO driver, otherwise, it will be -1).
33        This is a debug function, which dump directly the data on the normal output.
34        Tip:
35        As with anything that outputs its result directly to the browser, the output-control functions can be used to capture the output of this function, and save it in a string (for example).
36        This will only dumps the parameters in the statement at the moment of the dump. Extra parameters are not stored in the statement, and not displayed.
37    '
38
39Params:  0
40NULL
41