~clint-fewbar/ubuntu/natty/php5/merge-5.3.3-3

« back to all changes in this revision

Viewing changes to ext/pdo_mysql/tests/bug_45120.phpt

  • Committer: Bazaar Package Importer
  • Author(s): Chuck Short
  • Date: 2010-01-26 14:09:58 UTC
  • mfrom: (1.1.16 upstream) (0.3.6 sid)
  • Revision ID: james.westby@ubuntu.com-20100126140958-sos69zwa00q2nt19
Tags: 5.2.12.dfsg.1-2ubuntu1
* Merge from debian testing.  Remaining changes:
  - debian/control, debian/rules: Disable a few build dependencies and
    accompanying binary packages which we do not want to support in main:
    + firebird2-dev/php5-interbase (we have a seperate php-interbase source)
    + libc-client/php5-imap (we have a seperate php-imap source)
    + libmcrypt-dev/php5-mcrypt (seperate php-mcrypt source)
    + readline support again, now that the libedit issue is fixed.
  - debian/control: Add build dependency: libedit-dev (>= 2.9.cvs.20050518-1)
    CLI readline support.
  - debian/rules:
    + Correctly mangle PHP5_* macros for lpia
  - debian/control:
    + Rename Vcs-Browser & Vcs-Git to XS-Original-Vcs-Browser & XS-Original-Vcs-Git (LP: #323731).
  - debian/control: Move php5-suhoshin to Suggests.
  - debian/rules: Fix broken symlink for pear.
  - main/php_version.h: updated with Ubuntu version info
  - debian/patches/series: Re-enable the 033-we_WANT_libtool.patch patch
  - debian/rules, debian/source_php5.py: Install apport hook. 
* Dropped patches: CVE-2009-3557.patch and CVE-2009-3558.patch, no longer needed.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
--TEST--
 
2
Bug #45120 (PDOStatement->execute() returns true then false for same statement)
 
3
--SKIPIF--
 
4
<?php
 
5
if (!extension_loaded('pdo') || !extension_loaded('pdo_mysql')) die('skip not loaded');
 
6
require dirname(__FILE__) . '/config.inc';
 
7
require dirname(__FILE__) . '/../../../ext/pdo/tests/pdo_test.inc';
 
8
PDOTest::skip();
 
9
?>
 
10
--FILE--
 
11
<?php
 
12
require dirname(__FILE__) . '/config.inc';
 
13
require dirname(__FILE__) . '/../../../ext/pdo/tests/pdo_test.inc';
 
14
$db = PDOTest::test_factory(dirname(__FILE__) . '/common.phpt');
 
15
 
 
16
function bug_45120($db) {
 
17
 
 
18
        $stmt = $db->prepare("SELECT 1 AS 'one'");
 
19
        if (true !== $stmt->execute())
 
20
                printf("[001] Execute has failed: %s\n", var_export($stmt->errorInfo(), true));
 
21
 
 
22
        $res = $stmt->fetch(PDO::FETCH_ASSOC);
 
23
        if ($res['one'] != 1)
 
24
                printf("[002] Wrong results: %s\n", var_export($res, true));
 
25
 
 
26
        if (true !== $stmt->execute())
 
27
                printf("[003] Execute has failed: %s\n", var_export($stmt->errorInfo(), true));
 
28
 
 
29
        $res = $stmt->fetch(PDO::FETCH_ASSOC);
 
30
        if ($res['one'] != 1)
 
31
                printf("[004] Wrong results: %s\n", var_export($res, true));
 
32
 
 
33
}
 
34
 
 
35
print "Emulated Prepared Statements\n";
 
36
$db->setAttribute(PDO::ATTR_EMULATE_PREPARES, 1);
 
37
bug_45120($db);
 
38
 
 
39
print "Native Prepared Statements\n";
 
40
$db->setAttribute(PDO::ATTR_EMULATE_PREPARES, 0);
 
41
bug_45120($db);
 
42
 
 
43
print "done!";
 
44
?>
 
45
--EXPECT--
 
46
Emulated Prepared Statements
 
47
Native Prepared Statements
 
48
done!