mirror of
https://github.com/php/php-src.git
synced 2025-01-07 03:13:33 +08:00
861d51223f
- Fixed bug #44409 (PDO::FETCH_SERIALIZE calls __construct()) Patch by: matteo at beccati dot com
52 lines
1.1 KiB
PHP
52 lines
1.1 KiB
PHP
--TEST--
|
|
PDO Common: Bug #44409 (PDO::FETCH_SERIALIZE calls __construct())
|
|
--SKIPIF--
|
|
<?php # vim:ft=php
|
|
if (!extension_loaded('pdo')) die('skip');
|
|
$dir = getenv('REDIR_TEST_DIR');
|
|
if (false == $dir) die('skip no driver');
|
|
require_once $dir . 'pdo_test.inc';
|
|
PDOTest::skip();
|
|
?>
|
|
--FILE--
|
|
<?php
|
|
if (getenv('REDIR_TEST_DIR') === false) putenv('REDIR_TEST_DIR='.dirname(__FILE__) . '/../../pdo/tests/');
|
|
require getenv('REDIR_TEST_DIR') . 'pdo_test.inc';
|
|
$db = PDOTest::factory();
|
|
|
|
$db->exec("CREATE TABLE test (dat varchar(100))");
|
|
$db->exec("INSERT INTO test (dat) VALUES ('Data from DB')");
|
|
|
|
class bug44409 implements Serializable
|
|
{
|
|
public function __construct()
|
|
{
|
|
printf("Method called: %s()\n", __METHOD__);
|
|
}
|
|
|
|
public function serialize()
|
|
{
|
|
return "any data from serizalize()";
|
|
}
|
|
|
|
public function unserialize($dat)
|
|
{
|
|
printf("Method called: %s(%s)\n", __METHOD__, var_export($dat, true));
|
|
}
|
|
}
|
|
|
|
$stmt = $db->query("SELECT * FROM test");
|
|
|
|
print_r($stmt->fetchAll(PDO::FETCH_CLASS|PDO::FETCH_SERIALIZE, "bug44409"));
|
|
|
|
?>
|
|
--EXPECT--
|
|
Method called: bug44409::unserialize('Data from DB')
|
|
Array
|
|
(
|
|
[0] => bug44409 Object
|
|
(
|
|
)
|
|
|
|
)
|