summaryrefslogtreecommitdiff
path: root/ext/pdo_sqlite
diff options
context:
space:
mode:
authorFelipe Pena <felipe@php.net>2009-11-15 16:20:37 +0000
committerFelipe Pena <felipe@php.net>2009-11-15 16:20:37 +0000
commit7c3bd45b8254758e9016f1f15d7dc02c5de1b067 (patch)
treeebe9ae1f5d9d33aa04e0b414423560ba3466d2b2 /ext/pdo_sqlite
parent0a8ce9956c73a5a46c31bc436d5af42297ec4e00 (diff)
downloadphp-git-7c3bd45b8254758e9016f1f15d7dc02c5de1b067.tar.gz
- Fixed bug #49521 (PDO fetchObject sets values before calling constructor)
(patch by Pierrick)
Diffstat (limited to 'ext/pdo_sqlite')
-rw-r--r--ext/pdo_sqlite/tests/bug49521.phpt39
1 files changed, 39 insertions, 0 deletions
diff --git a/ext/pdo_sqlite/tests/bug49521.phpt b/ext/pdo_sqlite/tests/bug49521.phpt
new file mode 100644
index 0000000000..26cd2b2171
--- /dev/null
+++ b/ext/pdo_sqlite/tests/bug49521.phpt
@@ -0,0 +1,39 @@
+--TEST--
+Bug #49521 (PDO fetchObject sets values before calling constructor)
+--SKIPIF--
+<?php
+if (!extension_loaded('pdo_sqlite')) die ("skip Need PDO_SQlite support");
+?>
+--FILE--
+<?php
+
+class Book {
+ public $title = 'test';
+ public $author;
+
+ public function __construct($x) {
+ $this->title = '';
+ echo __METHOD__,"\n";
+ }
+ public function __set($a, $b) {
+ echo __METHOD__,"\n";
+ var_dump($a);
+ }
+}
+
+$pdo = new PDO('sqlite::memory:');
+$pdo->exec('CREATE TABLE book(title,author)');
+$pdo->exec('INSERT INTO book VALUES ("PHP","Rasmus")');
+$statement = $pdo->prepare('SELECT * FROM book WHERE title="PHP"');
+$statement->execute();
+var_dump($statement->fetchObject('Book', array(1)));
+
+?>
+--EXPECTF--
+Book::__construct
+object(Book)#%d (2) {
+ [%u|b%"title"]=>
+ string(3) "PHP"
+ [%u|b%"author"]=>
+ string(6) "Rasmus"
+}