Find this useful? Enter your email to receive occasional updates for securing PHP code.

Signing you up...

Thank you for signing up!

PHP Decode

--TEST-- PDO Common: Bug #34687 (query doesn't return error information) --SKIPIF-- <?php ..

Decoded Output download

--TEST--
PDO Common: Bug #34687 (query doesn't return error information)
--SKIPIF--
<?php # vim:ft=php
if (!extension_loaded('pdo')) die('skip no PDO');
if (!extension_loaded('pdo_4d')) die('skip no PDO for 4D extension');

require dirname(__FILE__) . '/../../../ext/pdo/tests/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->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_SILENT);
$x = $db->query("UPDATE non_existent_pdo_test_table set foo = 'bar'");

var_dump($x);
$code = $db->errorCode();
if ($code !== '00000' && strlen($code)) {
	echo "OK: $code
";
} else {
	echo "ERR: $code
";
	print_r($db->errorInfo());
}

?>
--EXPECTF--
bool(false)
OK: %s

Did this file decode correctly?

Original Code

--TEST--
PDO Common: Bug #34687 (query doesn't return error information)
--SKIPIF--
<?php # vim:ft=php
if (!extension_loaded('pdo')) die('skip no PDO');
if (!extension_loaded('pdo_4d')) die('skip no PDO for 4D extension');

require dirname(__FILE__) . '/../../../ext/pdo/tests/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->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_SILENT);
$x = $db->query("UPDATE non_existent_pdo_test_table set foo = 'bar'");

var_dump($x);
$code = $db->errorCode();
if ($code !== '00000' && strlen($code)) {
	echo "OK: $code\n";
} else {
	echo "ERR: $code\n";
	print_r($db->errorInfo());
}

?>
--EXPECTF--
bool(false)
OK: %s

Function Calls

dirname 1
extension_loaded 2

Variables

None

Stats

MD5 b05c24d71648c472a98564039713231c
Eval Count 0
Decode Time 109 ms