diff options
author | Felipe Pena <felipe@php.net> | 2009-11-15 16:20:37 +0000 |
---|---|---|
committer | Felipe Pena <felipe@php.net> | 2009-11-15 16:20:37 +0000 |
commit | 4bafbf58f8803707cfa3449dccc08f0fc45d7697 (patch) | |
tree | cb42a3e34c1c0bec0c99dd718549f3a1500cdbd6 /ext/pdo_sqlite | |
parent | 3a9f74967d85a2d5c41be48b4b56131df5bf6f78 (diff) | |
download | php-git-4bafbf58f8803707cfa3449dccc08f0fc45d7697.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.phpt | 39 |
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" +} |