PHP  
 PHP_HEAD
downloads | QA | documentation | faq | getting help | mailing lists | reporting bugs | php.net sites | links | my php.net 
 

Test Failure Report for ext/pdo_oci/tests/pdo_oci_quote1.phpt ('Test PDO->quote() for PDO_OCI')

Script

1: <?php
2:
3:
require dirname(__FILE__) . '/../../pdo/tests/pdo_test.inc';
4:
$db PDOTest::factory();
5:
6: @
$db->exec("drop table poq_tab");
7:
$db->query("create table poq_tab (t varchar2(100))");
8:
$stmt $db->prepare('select * from poq_tab');
9:
10:
// The intent is that the fetched data be identical to the unquoted string.
11: // Remember!: use bind variables instead of PDO->quote()
12:
13:
$a = array(null"""a""ab""abc""ab'cd""a\b\n""'""''""a'""'z""a''b"'"');
14: foreach (
$a as $u) {
15:     
$q $db->quote($u);
16:     echo 
"Unquoted : ";
17:     
var_dump($u);
18:     echo 
"Quoted   : ";
19:     
var_dump($q);
20:
21:     
$db->exec("delete from poq_tab");
22:
23:     
$db->query("insert into poq_tab (t) values($q)");
24:     
$stmt->execute();
25:     
var_dump($stmt->fetchAll(PDO::FETCH_ASSOC));
26: }
27:
28: echo 
"Done\n";
29:
30: @
$db->exec("drop table poq_tab");
31:
32:
?>
33:

Expected

Unquoted : NULL
Quoted   : string(2) "''"
array(1) {
  [0]=>
  array(1) {
    ["t"]=>
    NULL
  }
}
Unquoted : string(0) ""
Quoted   : string(2) "''"
array(1) {
  [0]=>
  array(1) {
    ["t"]=>
    NULL
  }
}
Unquoted : string(1) "a"
Quoted   : string(3) "'a'"
array(1) {
  [0]=>
  array(1) {
    ["t"]=>
    string(1) "a"
  }
}
Unquoted : string(2) "ab"
Quoted   : string(4) "'ab'"
array(1) {
  [0]=>
  array(1) {
    ["t"]=>
    string(2) "ab"
  }
}
Unquoted : string(3) "abc"
Quoted   : string(5) "'abc'"
array(1) {
  [0]=>
  array(1) {
    ["t"]=>
    string(3) "abc"
  }
}
Unquoted : string(5) "ab'cd"
Quoted   : string(8) "'ab''cd'"
array(1) {
  [0]=>
  array(1) {
    ["t"]=>
    string(5) "ab'cd"
  }
}
Unquoted : string(4) "a\b
"
Quoted   : string(6) "'a\b
'"
array(1) {
  [0]=>
  array(1) {
    ["t"]=>
    string(4) "a\b
"
  }
}
Unquoted : string(1) "'"
Quoted   : string(4) "''''"
array(1) {
  [0]=>
  array(1) {
    ["t"]=>
    string(1) "'"
  }
}
Unquoted : string(2) "''"
Quoted   : string(6) "''''''"
array(1) {
  [0]=>
  array(1) {
    ["t"]=>
    string(2) "''"
  }
}
Unquoted : string(2) "a'"
Quoted   : string(5) "'a'''"
array(1) {
  [0]=>
  array(1) {
    ["t"]=>
    string(2) "a'"
  }
}
Unquoted : string(2) "'z"
Quoted   : string(5) "'''z'"
array(1) {
  [0]=>
  array(1) {
    ["t"]=>
    string(2) "'z"
  }
}
Unquoted : string(4) "a''b"
Quoted   : string(8) "'a''''b'"
array(1) {
  [0]=>
  array(1) {
    ["t"]=>
    string(4) "a''b"
  }
}
Unquoted : string(1) """
Quoted   : string(3) "'"'"
array(1) {
  [0]=>
  array(1) {
    ["t"]=>
    string(1) """
  }
}
Done

Output

***********************************************************************
Fatal NI connect error 12541, connecting to:
 (DESCRIPTION=(CONNECT_DATA=(SERVICE_NAME=XE)(CID=(PROGRAM=php)(HOST=nex2.php.net)(USER=nlopess)))(ADDRESS=(PROTOCOL=TCP)(HOST=127.0.0.1)(PORT=1521)))

  VERSION INFORMATION:
	TNS for Linux: Version 11.2.0.2.0 - Beta
	TCP/IP NT Protocol Adapter for Linux: Version 11.2.0.2.0 - Beta
  Time: 17-JUN-2018 09:53:49
  Tracing not turned on.
  Tns error struct:
    ns main err code: 12541
    TNS-12541: TNS:no listener
    ns secondary err code: 12560
    nt main err code: 511
    TNS-00511: No listener

Fatal error: Uncaught PDOException: SQLSTATE[HY000]: pdo_oci_handle_factory: ORA-12541: TNS:no listener
 (/var/php_gcov/PHP_HEAD/ext/pdo_oci/oci_driver.c:634) in /var/php_gcov/PHP_HEAD/ext/pdo/tests/pdo_test.inc:35
Stack trace:
#0 /var/php_gcov/PHP_HEAD/ext/pdo/tests/pdo_test.inc(35): PDO->__construct('oci:dbname=//lo...', 'system', 'oracle', NULL)
#1 /var/php_gcov/PHP_HEAD/ext/pdo_oci/tests/pdo_oci_quote1.php(4): PDOTest::factory()
#2 {main}
  thrown in /var/php_gcov/PHP_HEAD/ext/pdo/tests/pdo_test.inc on line 35
    nt secondary err code: 111
    nt OS err code: 0

Diff

001+ ***********************************************************************
002+ Fatal NI connect error 12541, connecting to:
003+  (DESCRIPTION=(CONNECT_DATA=(SERVICE_NAME=XE)(CID=(PROGRAM=php)(HOST=nex2.php.net)(USER=nlopess)))(ADDRESS=(PROTOCOL=TCP)(HOST=127.0.0.1)(PORT=1521)))
004+ 
005+   VERSION INFORMATION:
006+ 	TNS for Linux: Version 11.2.0.2.0 - Beta
007+ 	TCP/IP NT Protocol Adapter for Linux: Version 11.2.0.2.0 - Beta
008+   Time: 17-JUN-2018 09:53:49
009+   Tracing not turned on.
010+   Tns error struct:
011+     ns main err code: 12541
012+     TNS-12541: TNS:no listener
013+     ns secondary err code: 12560
014+     nt main err code: 511
015+     TNS-00511: No listener
016+ 
017+ Fatal error: Uncaught PDOException: SQLSTATE[HY000]: pdo_oci_handle_factory: ORA-12541: TNS:no listener
018+  (/var/php_gcov/PHP_HEAD/ext/pdo_oci/oci_driver.c:634) in /var/php_gcov/PHP_HEAD/ext/pdo/tests/pdo_test.inc:35
019+ Stack trace:
020+ #0 /var/php_gcov/PHP_HEAD/ext/pdo/tests/pdo_test.inc(35): PDO->__construct('oci:dbname=//lo...', 'system', 'oracle', NULL)
021+ #1 /var/php_gcov/PHP_HEAD/ext/pdo_oci/tests/pdo_oci_quote1.php(4): PDOTest::factory()
022+ #2 {main}
023+   thrown in /var/php_gcov/PHP_HEAD/ext/pdo/tests/pdo_test.inc on line 35
024+     nt secondary err code: 111
025+     nt OS err code: 0
001- Unquoted : NULL
002- Quoted   : string(2) "''"
003- array(1) {
004-   [0]=>
005-   array(1) {
006-     ["t"]=>
007-     NULL
008-   }
009- }
010- Unquoted : string(0) ""
011- Quoted   : string(2) "''"
012- array(1) {
013-   [0]=>
014-   array(1) {
015-     ["t"]=>
016-     NULL
017-   }
018- }
019- Unquoted : string(1) "a"
020- Quoted   : string(3) "'a'"
021- array(1) {
022-   [0]=>
023-   array(1) {
024-     ["t"]=>
025-     string(1) "a"
026-   }
027- }
028- Unquoted : string(2) "ab"
029- Quoted   : string(4) "'ab'"
030- array(1) {
031-   [0]=>
032-   array(1) {
033-     ["t"]=>
034-     string(2) "ab"
035-   }
036- }
037- Unquoted : string(3) "abc"
038- Quoted   : string(5) "'abc'"
039- array(1) {
040-   [0]=>
041-   array(1) {
042-     ["t"]=>
043-     string(3) "abc"
044-   }
045- }
046- Unquoted : string(5) "ab'cd"
047- Quoted   : string(8) "'ab''cd'"
048- array(1) {
049-   [0]=>
050-   array(1) {
051-     ["t"]=>
052-     string(5) "ab'cd"
053-   }
054- }
055- Unquoted : string(4) "a\b
056- "
057- Quoted   : string(6) "'a\b
058- '"
059- array(1) {
060-   [0]=>
061-   array(1) {
062-     ["t"]=>
063-     string(4) "a\b
064- "
065-   }
066- }
067- Unquoted : string(1) "'"
068- Quoted   : string(4) "''''"
069- array(1) {
070-   [0]=>
071-   array(1) {
072-     ["t"]=>
073-     string(1) "'"
074-   }
075- }
076- Unquoted : string(2) "''"
077- Quoted   : string(6) "''''''"
078- array(1) {
079-   [0]=>
080-   array(1) {
081-     ["t"]=>
082-     string(2) "''"
083-   }
084- }
085- Unquoted : string(2) "a'"
086- Quoted   : string(5) "'a'''"
087- array(1) {
088-   [0]=>
089-   array(1) {
090-     ["t"]=>
091-     string(2) "a'"
092-   }
093- }
094- Unquoted : string(2) "'z"
095- Quoted   : string(5) "'''z'"
096- array(1) {
097-   [0]=>
098-   array(1) {
099-     ["t"]=>
100-     string(2) "'z"
101-   }
102- }
103- Unquoted : string(4) "a''b"
104- Quoted   : string(8) "'a''''b'"
105- array(1) {
106-   [0]=>
107-   array(1) {
108-     ["t"]=>
109-     string(4) "a''b"
110-   }
111- }
112- Unquoted : string(1) """
113- Quoted   : string(3) "'"'"
114- array(1) {
115-   [0]=>
116-   array(1) {
117-     ["t"]=>
118-     string(1) """
119-   }
120- }
121- Done

 

Generated at Mon, 18 Jun 2018 17:33:50 +0000 (20 hours ago)

Copyright © 2005-2018 The PHP Group
All rights reserved.