~ubuntu-branches/ubuntu/gutsy/php5/gutsy

« back to all changes in this revision

Viewing changes to ext/oci8/tests/define2.phpt

  • Committer: Bazaar Package Importer
  • Author(s): Martin Pitt, CVE-2007-0905, CVE-2007-0906, CVE-2007-0909, CVE-2007-0910
  • Date: 2007-02-20 17:54:46 UTC
  • mfrom: (1.1.6 upstream)
  • Revision ID: james.westby@ubuntu.com-20070220175446-nudqyuv0dfowel3r
Tags: 5.2.1-0ubuntu1
* New upstream security/bugfix release:
  - safe_mode & open_basedir bypasses inside the session extension
    [CVE-2007-0905]
  - multiple buffer overflows in various extensions and functions
    [CVE-2007-0906]
  - underflow in the internal sapi_header_op() function [CVE-2007-0907]
  - information disclosure in the wddx extension [CVE-2007-0908]
  - string format vulnerability in *print() functions on 64 bit systems
    [CVE-2007-0909]
  - possible clobbering of super-globals in several code paths
    [CVE-2007-0910]
* Adapted patches to new upstream release:
  - 006-debian_quirks.patch
  - 034-apache2_umask_fix.patch
  - 044-strtod_arm_fix.patch
* Drop 109-libdb4.4.patch: Obsolete, upstream now checks for db 4.5 and 4.4.
* Drop 114-zend_alloc.c_m68k_alignment.patch and
  115-zend_alloc.c_memleak.patch: Applied upstream.
* Add debian/patches/000upstream-str_ireplace_offbyone.patch:
  - Fix off-by-one in str_ireplace(), a regression introduced in 5.2.1.
  - Patch taken from upstream CVS:
    http://cvs.php.net/viewvc.cgi/php-src/ext/standard/string.c?r1=1.630&r2=1.631
  - CVE-2007-0911
* debian/control: Set Ubuntu maintainer.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
--TEST--
 
2
Test oci_define_by_name types
 
3
--SKIPIF--
 
4
<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
 
5
--FILE--
 
6
<?php
 
7
 
 
8
require dirname(__FILE__)."/connect.inc";
 
9
 
 
10
$stmt = oci_parse($c, "create table phptestrawtable( id number(10), fileimage raw(1000))");
 
11
oci_execute($stmt);
 
12
 
 
13
$stmt = oci_parse ($c, "insert into phptestrawtable (id, fileimage) values (:id, :fileimage)");
 
14
$i=1;
 
15
$fileimage = file_get_contents( dirname(__FILE__)."/test.gif");
 
16
$fileimage = substr($fileimage, 0, 300);
 
17
var_dump(md5($fileimage));
 
18
 
 
19
oci_bind_by_name( $stmt, ":id", $i, -1);
 
20
oci_bind_by_name( $stmt, ":fileimage", $fileimage, -1, SQLT_BIN);
 
21
oci_execute($stmt, OCI_DEFAULT);
 
22
oci_commit($c);
 
23
 
 
24
echo "Test 1\n";
 
25
$stmt = oci_parse($c, "SELECT fileimage FROM phptestrawtable");
 
26
var_dump(oci_define_by_name($stmt, 'FILEIMAGE', $fi));
 
27
oci_execute($stmt);
 
28
 
 
29
while (oci_fetch($stmt)) {
 
30
        var_dump($fi);
 
31
        echo "file md5:" . md5($fi) . "\n";
 
32
}
 
33
 
 
34
echo "Test 2\n";
 
35
$stmt = oci_parse($c, "SELECT fileimage FROM phptestrawtable");
 
36
var_dump(oci_define_by_name($stmt, 'FILEIMAGE', $fi));
 
37
oci_execute($stmt);
 
38
 
 
39
while (oci_fetch($stmt)) {
 
40
        var_dump($fi);
 
41
        echo "file md5:" . md5($fi) . "\n";
 
42
}
 
43
 
 
44
echo "Test 3 - test repeatability\n";
 
45
$stmt = oci_parse($c, "SELECT fileimage FROM phptestrawtable");
 
46
var_dump(oci_define_by_name($stmt, 'FILEIMAGE', $fi, SQLT_STR));
 
47
oci_execute($stmt);
 
48
 
 
49
while (oci_fetch($stmt)) {
 
50
        var_dump($fi);
 
51
        echo "file md5:" . md5($fi) . "\n";
 
52
}
 
53
 
 
54
echo "Test 4 - wrong type\n";
 
55
$stmt = oci_parse($c, "SELECT fileimage FROM phptestrawtable");
 
56
var_dump(oci_define_by_name($stmt, 'FILEIMAGE', $fi, SQLT_RSET));
 
57
oci_execute($stmt);
 
58
 
 
59
while (oci_fetch($stmt)) {
 
60
        var_dump($fi);
 
61
        echo "file md5:" . md5($fi) . "\n";
 
62
}
 
63
 
 
64
$stmt = oci_parse($c, "drop table phptestrawtable");
 
65
oci_execute($stmt);
 
66
 
 
67
echo "Done\n";
 
68
?>
 
69
--EXPECTF--
 
70
string(32) "88b274d7a257ac6f70435b83abd4e26e"
 
71
Test 1
 
72
bool(true)
 
73
string(300) "GIF89%s"
 
74
file md5:88b274d7a257ac6f70435b83abd4e26e
 
75
Test 2
 
76
bool(true)
 
77
string(300) "GIF89%s"
 
78
file md5:88b274d7a257ac6f70435b83abd4e26e
 
79
Test 3 - test repeatability
 
80
bool(true)
 
81
string(600) "47494638396178004300E66A007F82B839374728252ACCCDE2A1A4CBD3D5E7B2B4D44342588386B98283B35252729092C2C2C4DEAAACD04C4B635B5C83DDDEEC3B383C6E71A56A6D9D61638D7579B17B7EB5E5E6F0999CC68C8DC1B9BAD96B6B924E4E6B7174A97A7AA3888BBD7274A37473988E90C15A5B7EE2E3EF7B7DADA4A5D06D70A27276AC9596C8BBBDD97478AE8588BB9295C3D8D9EA9292C46466926B6E9FA5A8CE9496C52E2B2F535168B3B4D76C6A8C5C5B768A8DBF666896686A9A9C9FC8312E39AEB0D39C9CCD5556789EA1CA9699C58182AF6769973F3D50BCBEDA5E60899899C88C8EBF898ABA57587CB6B7D7D5D7E8221E206C6F9ECED0E4BFC0DC777BB47678A75F5E7D9999CC6E6F987377AE221E1FFFFFFF908E8F595657C7C6C7EEEEF5D5D4D5F6F6"
 
82
file md5:80bb3201e2a8bdcb8ab3e1a44a82bb8a
 
83
Test 4 - wrong type
 
84
bool(true)
 
85
 
 
86
Warning: oci_fetch(): ORA-00932: inconsistent datatypes%s on line %d
 
87
Done