1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68
|
--TEST--
Bug #44327 (PDORow::queryString property & numeric offsets / Crash)
--EXTENSIONS--
pdo_mysql
--SKIPIF--
<?php
require_once __DIR__ . '/inc/mysql_pdo_test.inc';
MySQLPDOTest::skip();
?>
--FILE--
<?php
require_once __DIR__ . '/inc/mysql_pdo_test.inc';
$db = MySQLPDOTest::factory();
$db->setAttribute(PDO::ATTR_STRINGIFY_FETCHES, true);
$stmt = $db->prepare("SELECT 1 AS \"one\"");
$stmt->execute();
$row = $stmt->fetch(PDO::FETCH_LAZY);
var_dump($row);
var_dump($row->{0});
var_dump($row->one);
var_dump($row->queryString);
print "----------------------------------\n";
$db->exec("CREATE TABLE test_44327 (id INT)");
$db->exec("INSERT INTO test_44327(id) VALUES (1)");
$stmt = $db->prepare("SELECT id FROM test_44327");
$stmt->execute();
$row = $stmt->fetch(PDO::FETCH_LAZY);
var_dump($row);
var_dump($row->queryString);
print "----------------------------------\n";
$stmt = $db->prepare('foo');
@$stmt->execute();
$row = $stmt->fetch();
var_dump($row->queryString);
?>
--CLEAN--
<?php
require_once __DIR__ . '/inc/mysql_pdo_test.inc';
$db = MySQLPDOTest::factory();
$db->exec("DROP TABLE test_44327");
?>
--EXPECTF--
object(PDORow)#%d (2) {
["queryString"]=>
string(17) "SELECT 1 AS "one""
["one"]=>
string(1) "1"
}
string(1) "1"
string(1) "1"
string(17) "SELECT 1 AS "one""
----------------------------------
object(PDORow)#5 (2) {
["queryString"]=>
string(25) "SELECT id FROM test_44327"
["id"]=>
string(1) "1"
}
string(25) "SELECT id FROM test_44327"
----------------------------------
Warning: Attempt to read property "queryString" on false in %s on line %d
NULL
|