From fb24b74d54c1f386be4f0147a791ca60fe304989 Mon Sep 17 00:00:00 2001 From: George Peter Banyard Date: Sun, 29 Oct 2023 15:37:41 +0000 Subject: [PATCH 1/3] PDO: Fix parrallel conflicts? --- ext/pdo/tests/bug_43139.phpt | 9 ++++----- ext/pdo/tests/bug_43663.phpt | 8 ++++---- ext/pdo/tests/bug_44861.phpt | 19 +++++++++++++------ ext/pdo/tests/bug_60665.phpt | 4 ++-- ext/pdo/tests/bug_69356.phpt | 10 ++++------ ext/pdo/tests/bug_72788.phpt | 6 +++--- ext/pdo/tests/pdo_011.phpt | 6 +++--- ext/pdo/tests/pdo_012.phpt | 6 +++--- ext/pdo/tests/pdo_013.phpt | 6 +++--- ext/pdo/tests/pdo_014.phpt | 4 ++-- ext/pdo/tests/pdo_023.phpt | 4 ++-- ext/pdo_firebird/tests/bug_76449.phpt | 4 ++-- ext/pdo_firebird/tests/bug_76452.phpt | 4 ++-- ext/pdo_mysql/tests/bug_41698.phpt | 14 ++++++++++---- ext/pdo_sqlite/tests/bug46139.phpt | 14 +++++++------- ext/pdo_sqlite/tests/bug_47769.phpt | 6 +++--- ext/pdo_sqlite/tests/pdo_fetch_func_001.phpt | 6 +++--- 17 files changed, 70 insertions(+), 60 deletions(-) diff --git a/ext/pdo/tests/bug_43139.phpt b/ext/pdo/tests/bug_43139.phpt index 2976a96562aa1..487edb3ebdcee 100644 --- a/ext/pdo/tests/bug_43139.phpt +++ b/ext/pdo/tests/bug_43139.phpt @@ -18,11 +18,10 @@ $db = PDOTest::factory(); $db->setAttribute(PDO::ATTR_DEFAULT_FETCH_MODE, PDO::FETCH_ASSOC); $db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_WARNING); -$from = ''; -if ($db->getAttribute(PDO::ATTR_DRIVER_NAME) == 'oci') { - $from = 'from dual'; -} else if ($db->getAttribute(PDO::ATTR_DRIVER_NAME) == 'firebird') { - $from = 'FROM RDB$DATABASE'; +switch ($db->getAttribute(PDO::ATTR_DRIVER_NAME)) { + case 'oci': $from = ' FROM DUAL'; break; + case 'firebird': $from = ' FROM RDB$DATABASE'; break; + default: $from = ''; break; } var_dump($db->query("select 0 as abc, 1 as xyz, 2 as def $from")->fetchAll(PDO::FETCH_GROUP)); diff --git a/ext/pdo/tests/bug_43663.phpt b/ext/pdo/tests/bug_43663.phpt index dddf87748957f..ff816045a63c9 100644 --- a/ext/pdo/tests/bug_43663.phpt +++ b/ext/pdo/tests/bug_43663.phpt @@ -11,7 +11,7 @@ PDOTest::skip(); ?> --FILE-- foo(); $a->bar(); ?> --EXPECT-- -Called foo in test -Called bar in test +Called foo in TestClass +Called bar in TestClass diff --git a/ext/pdo/tests/bug_44861.phpt b/ext/pdo/tests/bug_44861.phpt index bc0f902f684cc..4484fcaa2aa8f 100644 --- a/ext/pdo/tests/bug_44861.phpt +++ b/ext/pdo/tests/bug_44861.phpt @@ -27,12 +27,19 @@ $db = PDOTest::factory(); $db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); -if ($db->getAttribute(PDO::ATTR_DRIVER_NAME) == 'oci') { - $from = 'FROM DUAL'; - $ob = '1'; -} else { - $from = ''; - $ob = 'r'; +switch ($db->getAttribute(PDO::ATTR_DRIVER_NAME)) { + case 'oci': + $from = 'FROM DUAL'; + $ob = '1'; + break; + case 'firebird': + $from = 'FROM RDB$DATABASE'; + $ob = 'r'; + break; + default: + $from = ''; + $ob = 'r'; + break; } $query = "SELECT 'row1' AS r $from UNION SELECT 'row2' $from UNION SELECT 'row3' $from UNION SELECT 'row4' $from ORDER BY $ob"; diff --git a/ext/pdo/tests/bug_60665.phpt b/ext/pdo/tests/bug_60665.phpt index e995d581c2b3a..9fd449f925601 100644 --- a/ext/pdo/tests/bug_60665.phpt +++ b/ext/pdo/tests/bug_60665.phpt @@ -15,8 +15,8 @@ if (getenv('REDIR_TEST_DIR') === false) putenv('REDIR_TEST_DIR='.__DIR__ . '/../ require_once getenv('REDIR_TEST_DIR') . 'pdo_test.inc'; $db = PDOTest::factory(); switch ($db->getAttribute(PDO::ATTR_DRIVER_NAME)) { - case 'oci': $from = 'from dual'; break; - case 'firebird': $from = 'from rdb$database'; break; + case 'oci': $from = ' FROM DUAL'; break; + case 'firebird': $from = ' FROM RDB$DATABASE'; break; default: $from = ''; break; } $statement = $db->prepare("SELECT NULL AS null_value, 0 AS zero, 1 AS one $from"); diff --git a/ext/pdo/tests/bug_69356.phpt b/ext/pdo/tests/bug_69356.phpt index a2cf219a857ce..604897c282b34 100644 --- a/ext/pdo/tests/bug_69356.phpt +++ b/ext/pdo/tests/bug_69356.phpt @@ -28,13 +28,11 @@ SELECT ' SQL; switch ($db->getAttribute(PDO::ATTR_DRIVER_NAME)) { - case 'oci': - $query .= ' FROM DUAL'; - break; - case 'firebird': - $query .= ' FROM RDB$DATABASE'; - break; + case 'oci': $from = ' FROM DUAL'; break; + case 'firebird': $from = ' FROM RDB$DATABASE'; break; + default: $from = ''; break; } +$query .= $from; $stmt = $db->query($query); var_dump($stmt->debugDumpParams()); diff --git a/ext/pdo/tests/bug_72788.phpt b/ext/pdo/tests/bug_72788.phpt index 683d582f4ec30..35e934e6d0c3a 100644 --- a/ext/pdo/tests/bug_72788.phpt +++ b/ext/pdo/tests/bug_72788.phpt @@ -16,7 +16,7 @@ require_once getenv('REDIR_TEST_DIR') . 'pdo_test.inc'; putenv("PDOTEST_ATTR=" . serialize(array(PDO::ATTR_PERSISTENT => true))); -function test() { +function callback() { $db = PDOTest::factory('PDO', false); $stmt = @$db->query("SELECT 1 FROM TABLE_DOES_NOT_EXIST"); if ($stmt === false) { @@ -24,8 +24,8 @@ function test() { } } -test(); -test(); +callback(); +callback(); echo "Done"; ?> --EXPECT-- diff --git a/ext/pdo/tests/pdo_011.phpt b/ext/pdo/tests/pdo_011.phpt index 950fd278b7316..0069743ed401c 100644 --- a/ext/pdo/tests/pdo_011.phpt +++ b/ext/pdo/tests/pdo_011.phpt @@ -52,7 +52,7 @@ class Test1 } } -function test($id,$val='N/A') +function callback($id,$val='N/A') { echo __METHOD__ . "($id,$val)\n"; return array($id=>$val); @@ -61,10 +61,10 @@ function test($id,$val='N/A') $f = new Test1(0,0); $select1->execute(); -var_dump($select1->fetchAll(PDO::FETCH_FUNC|PDO::FETCH_GROUP, 'test')); +var_dump($select1->fetchAll(PDO::FETCH_FUNC|PDO::FETCH_GROUP, 'callback')); $select2->execute(); -var_dump($select2->fetchAll(PDO::FETCH_FUNC, 'test')); +var_dump($select2->fetchAll(PDO::FETCH_FUNC, 'callback')); $select2->execute(); var_dump($select2->fetchAll(PDO::FETCH_FUNC, array('Test1','factory'))); diff --git a/ext/pdo/tests/pdo_012.phpt b/ext/pdo/tests/pdo_012.phpt index 2db0ca82fd132..7e8d4eba98830 100644 --- a/ext/pdo/tests/pdo_012.phpt +++ b/ext/pdo/tests/pdo_012.phpt @@ -24,7 +24,7 @@ $SELECT = 'SELECT val, grp FROM test012'; $stmt = $db->query($SELECT, PDO::FETCH_NUM); var_dump($stmt->fetchAll()); -class Test +class TestClass { public $val; public $grp; @@ -37,13 +37,13 @@ class Test unset($stmt); -$stmt = $db->query($SELECT, PDO::FETCH_CLASS, 'Test'); +$stmt = $db->query($SELECT, PDO::FETCH_CLASS, TestClass::class); var_dump($stmt->fetchAll()); unset($stmt); $stmt = $db->query($SELECT, PDO::FETCH_NUM); -$stmt->setFetchMode(PDO::FETCH_CLASS, 'Test', array('Changed')); +$stmt->setFetchMode(PDO::FETCH_CLASS, TestClass::class, array('Changed')); var_dump($stmt->fetchAll()); ?> diff --git a/ext/pdo/tests/pdo_013.phpt b/ext/pdo/tests/pdo_013.phpt index 44d1f41d7be61..f38c4d957e5f1 100644 --- a/ext/pdo/tests/pdo_013.phpt +++ b/ext/pdo/tests/pdo_013.phpt @@ -30,7 +30,7 @@ foreach ($stmt as $data) var_dump($data); } -class Test +class TestClass { public $val; public $grp; @@ -43,14 +43,14 @@ class Test unset($stmt); -foreach ($db->query($SELECT, PDO::FETCH_CLASS, 'Test') as $data) +foreach ($db->query($SELECT, PDO::FETCH_CLASS, TestClass::class) as $data) { var_dump($data); } unset($stmt); -$stmt = $db->query($SELECT, PDO::FETCH_CLASS, 'Test', array('WOW')); +$stmt = $db->query($SELECT, PDO::FETCH_CLASS, TestClass::class, array('WOW')); foreach($stmt as $data) { diff --git a/ext/pdo/tests/pdo_014.phpt b/ext/pdo/tests/pdo_014.phpt index 4231db64f6f60..4596ab198ae87 100644 --- a/ext/pdo/tests/pdo_014.phpt +++ b/ext/pdo/tests/pdo_014.phpt @@ -20,7 +20,7 @@ $db->exec("INSERT INTO test014 VALUES(1, 'A', 'Group1')"); $db->exec("INSERT INTO test014 VALUES(2, 'B', 'Group2')"); $SELECT = 'SELECT val, grp FROM test014'; -class Test +class TestClass { public $val; public $grp; @@ -31,7 +31,7 @@ class Test } } -$stmt = $db->query($SELECT, PDO::FETCH_CLASS, 'Test', array('WOW')); +$stmt = $db->query($SELECT, PDO::FETCH_CLASS, TestClass::class, array('WOW')); $it = new IteratorIterator($stmt); /* check if we can convert that thing */ diff --git a/ext/pdo/tests/pdo_023.phpt b/ext/pdo/tests/pdo_023.phpt index e8f857abc2e35..cc92b5bc15f32 100644 --- a/ext/pdo/tests/pdo_023.phpt +++ b/ext/pdo/tests/pdo_023.phpt @@ -42,7 +42,7 @@ class PDODatabaseX extends PDO echo __METHOD__ . "()\n"; } - function test() + function testMethod() { $this->test2 = 2; var_dump($this->test1); @@ -60,7 +60,7 @@ class PDODatabaseX extends PDO } $db = PDOTest::factory('PDODatabaseX'); -$db->test(); +$db->testMethod(); var_dump($db); $db->query('CREATE TABLE test023(id INT NOT NULL PRIMARY KEY, val VARCHAR(10))'); diff --git a/ext/pdo_firebird/tests/bug_76449.phpt b/ext/pdo_firebird/tests/bug_76449.phpt index c4ed14fb9e909..0f9ca89ffa96f 100644 --- a/ext/pdo_firebird/tests/bug_76449.phpt +++ b/ext/pdo_firebird/tests/bug_76449.phpt @@ -12,12 +12,12 @@ require_once "payload_server.inc"; $address = run_server(__DIR__ . "/bug_76449.data"); // no need to change the credentials; we're running against a fake server -$dsn = "firebird:dbname=inet://$address/test"; +$dsn = "firebird:dbname=inet://$address/test76449"; $username = 'SYSDBA'; $password = 'masterkey'; $dbh = new PDO($dsn, $username, $password, [PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION]); -var_dump($dbh->exec("INSERT INTO test VALUES ('hihi2', 'xxxxx')")); +var_dump($dbh->exec("INSERT INTO test76449 VALUES ('hihi2', 'xxxxx')")); ?> --EXPECT-- bool(false) diff --git a/ext/pdo_firebird/tests/bug_76452.phpt b/ext/pdo_firebird/tests/bug_76452.phpt index 5c60c759b3358..fffc0bee5196e 100644 --- a/ext/pdo_firebird/tests/bug_76452.phpt +++ b/ext/pdo_firebird/tests/bug_76452.phpt @@ -11,12 +11,12 @@ require_once "payload_server.inc"; $address = run_server(__DIR__ . "/bug_76452.data"); // no need to change the credentials; we're running against a falke server -$dsn = "firebird:dbname=inet://$address/test"; +$dsn = "firebird:dbname=inet://$address/test76452"; $username = 'SYSDBA'; $password = 'masterkey'; $dbh = new PDO($dsn, $username, $password, [PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION]); -$query = $dbh->prepare("select * from test"); +$query = $dbh->prepare("SELECT * FROM test76452"); $query->execute(); var_dump($query->fetch()); ?> diff --git a/ext/pdo_mysql/tests/bug_41698.phpt b/ext/pdo_mysql/tests/bug_41698.phpt index 9df6d47d134be..5c22f9569ce71 100644 --- a/ext/pdo_mysql/tests/bug_41698.phpt +++ b/ext/pdo_mysql/tests/bug_41698.phpt @@ -17,12 +17,18 @@ $db = PDOTest::test_factory(__DIR__ . '/common.phpt'); setlocale(LC_ALL, "de","de_DE","de_DE.ISO8859-1","de_DE.ISO_8859-1","de_DE.UTF-8"); -$db->exec('CREATE TABLE test(floatval DECIMAL(8,6))'); -$db->exec('INSERT INTO test VALUES(2.34)'); +$db->exec('CREATE TABLE test_41698(floatval DECIMAL(8,6))'); +$db->exec('INSERT INTO test_41698 VALUES(2.34)'); $value=4.56; -$stmt = $db->prepare('INSERT INTO test VALUES(?)'); +$stmt = $db->prepare('INSERT INTO test_41698 VALUES(?)'); $stmt->execute(array($value)); -var_dump($db->query('SELECT * from test')->fetchAll(PDO::FETCH_ASSOC)); +var_dump($db->query('SELECT * FROM test_41698')->fetchAll(PDO::FETCH_ASSOC)); +?> +--CLEAN-- +exec("DROP TABLE IF EXISTS test_41698"); ?> --EXPECT-- array(2) { diff --git a/ext/pdo_sqlite/tests/bug46139.phpt b/ext/pdo_sqlite/tests/bug46139.phpt index 7ec94aff0cfce..7f78c56320f94 100644 --- a/ext/pdo_sqlite/tests/bug46139.phpt +++ b/ext/pdo_sqlite/tests/bug46139.phpt @@ -10,26 +10,26 @@ $db = PDOTest::test_factory(__DIR__ . '/common.phpt'); #[AllowDynamicProperties] class Person { - public $test = NULL; + public $testProp = NULL; public function __construct() { var_dump($this->test); } } -$stmt = $db->query("SELECT 'foo' test, 1"); +$stmt = $db->query("SELECT 'foo' testProp, 1"); $stmt->setFetchMode(PDO::FETCH_CLASS | PDO::FETCH_PROPS_LATE, 'Person'); $r1 = $stmt->fetch(); -printf("'%s'\n", $r1->test); +printf("'%s'\n", $r1->testProp); -$stmt = $db->query("SELECT 'foo' test, 1"); +$stmt = $db->query("SELECT 'foo' testProp, 1"); $stmt->setFetchMode(PDO::FETCH_CLASS | PDO::FETCH_PROPS_LATE, 'Person'); $r1 = $stmt->fetchAll(); -printf("'%s'\n", $r1[0]->test); +printf("'%s'\n", $r1[0]->testProp); -$stmt = $db->query("SELECT 'foo' test, 1"); +$stmt = $db->query("SELECT 'foo' testProp, 1"); $stmt->setFetchMode(PDO::FETCH_CLASS | PDO::FETCH_PROPS_LATE, 'Person'); $r1 = $stmt->fetch(PDO::FETCH_CLASS | PDO::FETCH_PROPS_LATE); -printf("'%s'\n", $r1->test); +printf("'%s'\n", $r1->testProp); ?> --EXPECT-- diff --git a/ext/pdo_sqlite/tests/bug_47769.phpt b/ext/pdo_sqlite/tests/bug_47769.phpt index dcceb44890827..04ece675edf90 100644 --- a/ext/pdo_sqlite/tests/bug_47769.phpt +++ b/ext/pdo_sqlite/tests/bug_47769.phpt @@ -5,7 +5,7 @@ pdo_sqlite --FILE-- quote('foo'); $test->isProtected(); @@ -33,7 +33,7 @@ this is a protected method. this is a private method. foo -Fatal error: Uncaught Error: Call to protected method test::isProtected() from global scope in %s:%d +Fatal error: Uncaught Error: Call to protected method TestClass::isProtected() from global scope in %s:%d Stack trace: #0 {main} thrown in %s on line %d diff --git a/ext/pdo_sqlite/tests/pdo_fetch_func_001.phpt b/ext/pdo_sqlite/tests/pdo_fetch_func_001.phpt index 3ae9113173acd..e67f954a1af52 100644 --- a/ext/pdo_sqlite/tests/pdo_fetch_func_001.phpt +++ b/ext/pdo_sqlite/tests/pdo_fetch_func_001.phpt @@ -63,7 +63,7 @@ class bar extends foo { var_dump($st->fetchAll(PDO::FETCH_FUNC, array($this, 'parent::method'))); } - static public function test($x, $y) { + static public function test1($x, $y) { return $x .'---'. $y; } @@ -79,7 +79,7 @@ class bar extends foo { new bar($db); $st = $db->query('SELECT * FROM test_fetch_func_001'); -var_dump($st->fetchAll(PDO::FETCH_FUNC, array('bar', 'test'))); +var_dump($st->fetchAll(PDO::FETCH_FUNC, array('bar', 'test1'))); try { $st = $db->query('SELECT * FROM test_fetch_func_001'); @@ -113,7 +113,7 @@ object(PDOStatement)#%d (1) { ["queryString"]=> string(33) "SELECT * FROM test_fetch_func_001" } -data: 2, +data: 2, array(2) { [0]=> string(3) "PHP" From 465e86420d7ebc608145a6105a530c4aa466b763 Mon Sep 17 00:00:00 2001 From: George Peter Banyard Date: Sun, 29 Oct 2023 17:21:38 +0000 Subject: [PATCH 2/3] Update tests --- ext/pdo/tests/pdo_011.phpt | 16 ++++++++-------- ext/pdo/tests/pdo_012.phpt | 16 ++++++++-------- ext/pdo/tests/pdo_013.phpt | 16 ++++++++-------- ext/pdo/tests/pdo_014.phpt | 8 ++++---- ext/pdo_sqlite/tests/bug46139.phpt | 2 +- ext/pdo_sqlite/tests/pdo_fetch_func_001.phpt | 13 ++++++++++--- 6 files changed, 39 insertions(+), 32 deletions(-) diff --git a/ext/pdo/tests/pdo_011.phpt b/ext/pdo/tests/pdo_011.phpt index 0069743ed401c..88c2677c08991 100644 --- a/ext/pdo/tests/pdo_011.phpt +++ b/ext/pdo/tests/pdo_011.phpt @@ -90,10 +90,10 @@ PDOTest::dropTableIfExists($db, "test011"); --EXPECTF-- DerivedStatement::__construct(Overloaded) Test1::__construct(0,0) -test(1,N/A) -test(2,N/A) -test(3,N/A) -test(4,N/A) +callback(1,N/A) +callback(2,N/A) +callback(3,N/A) +callback(4,N/A) array(2) { ["Group1"]=> array(2) { @@ -122,10 +122,10 @@ array(2) { } } } -test(1,A) -test(2,B) -test(3,C) -test(4,D) +callback(1,A) +callback(2,B) +callback(3,C) +callback(4,D) array(4) { [0]=> array(1) { diff --git a/ext/pdo/tests/pdo_012.phpt b/ext/pdo/tests/pdo_012.phpt index 7e8d4eba98830..0798f42406c6e 100644 --- a/ext/pdo/tests/pdo_012.phpt +++ b/ext/pdo/tests/pdo_012.phpt @@ -70,36 +70,36 @@ array(2) { string(6) "Group2" } } -Test::__construct(N/A) -Test::__construct(N/A) +TestClass::__construct(N/A) +TestClass::__construct(N/A) array(2) { [0]=> - object(Test)#%d (2) { + object(TestClass)#%d (2) { ["val"]=> string(1) "A" ["grp"]=> string(6) "Group1" } [1]=> - object(Test)#%d (2) { + object(TestClass)#%d (2) { ["val"]=> string(1) "B" ["grp"]=> string(6) "Group2" } } -Test::__construct(Changed) -Test::__construct(Changed) +TestClass::__construct(Changed) +TestClass::__construct(Changed) array(2) { [0]=> - object(Test)#%d (2) { + object(TestClass)#%d (2) { ["val"]=> string(1) "A" ["grp"]=> string(6) "Group1" } [1]=> - object(Test)#%d (2) { + object(TestClass)#%d (2) { ["val"]=> string(1) "B" ["grp"]=> diff --git a/ext/pdo/tests/pdo_013.phpt b/ext/pdo/tests/pdo_013.phpt index f38c4d957e5f1..e41fb8b129ee1 100644 --- a/ext/pdo/tests/pdo_013.phpt +++ b/ext/pdo/tests/pdo_013.phpt @@ -76,29 +76,29 @@ array(2) { [1]=> string(6) "Group2" } -Test::__construct(N/A) -object(Test)#%d (2) { +TestClass::__construct(N/A) +object(TestClass)#%d (2) { ["val"]=> string(1) "A" ["grp"]=> string(6) "Group1" } -Test::__construct(N/A) -object(Test)#%d (2) { +TestClass::__construct(N/A) +object(TestClass)#%d (2) { ["val"]=> string(1) "B" ["grp"]=> string(6) "Group2" } -Test::__construct(WOW) -object(Test)#%d (2) { +TestClass::__construct(WOW) +object(TestClass)#%d (2) { ["val"]=> string(1) "A" ["grp"]=> string(6) "Group1" } -Test::__construct(WOW) -object(Test)#%d (2) { +TestClass::__construct(WOW) +object(TestClass)#%d (2) { ["val"]=> string(1) "B" ["grp"]=> diff --git a/ext/pdo/tests/pdo_014.phpt b/ext/pdo/tests/pdo_014.phpt index 4596ab198ae87..cea2fb8ba336a 100644 --- a/ext/pdo/tests/pdo_014.phpt +++ b/ext/pdo/tests/pdo_014.phpt @@ -78,15 +78,15 @@ $db = PDOTest::factory(); PDOTest::dropTableIfExists($db, "test014"); ?> --EXPECTF-- -Test::__construct(WOW) -object(Test)#%d (2) { +TestClass::__construct(WOW) +object(TestClass)#%d (2) { ["val"]=> string(1) "A" ["grp"]=> string(6) "Group1" } -Test::__construct(WOW) -object(Test)#%d (2) { +TestClass::__construct(WOW) +object(TestClass)#%d (2) { ["val"]=> string(1) "B" ["grp"]=> diff --git a/ext/pdo_sqlite/tests/bug46139.phpt b/ext/pdo_sqlite/tests/bug46139.phpt index 7f78c56320f94..0766130065e67 100644 --- a/ext/pdo_sqlite/tests/bug46139.phpt +++ b/ext/pdo_sqlite/tests/bug46139.phpt @@ -12,7 +12,7 @@ $db = PDOTest::test_factory(__DIR__ . '/common.phpt'); class Person { public $testProp = NULL; public function __construct() { - var_dump($this->test); + var_dump($this->testProp); } } diff --git a/ext/pdo_sqlite/tests/pdo_fetch_func_001.phpt b/ext/pdo_sqlite/tests/pdo_fetch_func_001.phpt index e67f954a1af52..e9c2c7e5d5e4b 100644 --- a/ext/pdo_sqlite/tests/pdo_fetch_func_001.phpt +++ b/ext/pdo_sqlite/tests/pdo_fetch_func_001.phpt @@ -12,7 +12,12 @@ $db->exec('CREATE TABLE test_fetch_func_001 (id INTEGER , name VARCHAR)'); $db->exec('INSERT INTO test_fetch_func_001 VALUES(1, "php"), (2, "")'); $st = $db->query('SELECT * FROM test_fetch_func_001'); -$st->fetchAll(PDO::FETCH_FUNC, function($x, $y) use ($st) { var_dump($st); print "data: $x, $y\n"; }); +$st->fetchAll( + PDO::FETCH_FUNC, + function($x, $y) use ($st) { + var_dump($st, $x, $y); + } +); $st = $db->query('SELECT name FROM test_fetch_func_001'); var_dump($st->fetchAll(PDO::FETCH_FUNC, 'strtoupper')); @@ -108,12 +113,14 @@ object(PDOStatement)#%d (1) { ["queryString"]=> string(33) "SELECT * FROM test_fetch_func_001" } -data: 1, php +int(1) +string(3) "php" object(PDOStatement)#%d (1) { ["queryString"]=> string(33) "SELECT * FROM test_fetch_func_001" } -data: 2, +int(2) +string(0) "" array(2) { [0]=> string(3) "PHP" From 8e0606d7f37ced452dbab579eae7a9dc4983533a Mon Sep 17 00:00:00 2001 From: George Peter Banyard Date: Sun, 29 Oct 2023 17:50:17 +0000 Subject: [PATCH 3/3] lower case property name --- ext/pdo_sqlite/tests/bug46139.phpt | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/ext/pdo_sqlite/tests/bug46139.phpt b/ext/pdo_sqlite/tests/bug46139.phpt index 0766130065e67..7b3fd4fb025d0 100644 --- a/ext/pdo_sqlite/tests/bug46139.phpt +++ b/ext/pdo_sqlite/tests/bug46139.phpt @@ -10,26 +10,26 @@ $db = PDOTest::test_factory(__DIR__ . '/common.phpt'); #[AllowDynamicProperties] class Person { - public $testProp = NULL; + public $test_prop = NULL; public function __construct() { - var_dump($this->testProp); + var_dump($this->test_prop); } } -$stmt = $db->query("SELECT 'foo' testProp, 1"); +$stmt = $db->query("SELECT 'foo' test_prop, 1"); $stmt->setFetchMode(PDO::FETCH_CLASS | PDO::FETCH_PROPS_LATE, 'Person'); $r1 = $stmt->fetch(); -printf("'%s'\n", $r1->testProp); +printf("'%s'\n", $r1->test_prop); -$stmt = $db->query("SELECT 'foo' testProp, 1"); +$stmt = $db->query("SELECT 'foo' test_prop, 1"); $stmt->setFetchMode(PDO::FETCH_CLASS | PDO::FETCH_PROPS_LATE, 'Person'); $r1 = $stmt->fetchAll(); -printf("'%s'\n", $r1[0]->testProp); +printf("'%s'\n", $r1[0]->test_prop); -$stmt = $db->query("SELECT 'foo' testProp, 1"); +$stmt = $db->query("SELECT 'foo' test_prop, 1"); $stmt->setFetchMode(PDO::FETCH_CLASS | PDO::FETCH_PROPS_LATE, 'Person'); $r1 = $stmt->fetch(PDO::FETCH_CLASS | PDO::FETCH_PROPS_LATE); -printf("'%s'\n", $r1->testProp); +printf("'%s'\n", $r1->test_prop); ?> --EXPECT--