summaryrefslogtreecommitdiff
path: root/ext/pdo_mysql
diff options
context:
space:
mode:
Diffstat (limited to 'ext/pdo_mysql')
-rw-r--r--ext/pdo_mysql/mysql_driver.c47
-rw-r--r--ext/pdo_mysql/php_pdo_mysql_int.h2
-rw-r--r--ext/pdo_mysql/tests/bug44327.phpt26
-rw-r--r--ext/pdo_mysql/tests/bug46292.phpt14
-rw-r--r--ext/pdo_mysql/tests/bug_33689.phpt4
-rw-r--r--ext/pdo_mysql/tests/bug_39858.phpt16
-rw-r--r--ext/pdo_mysql/tests/bug_41698.phpt8
-rw-r--r--ext/pdo_mysql/tests/bug_41997.phpt12
-rw-r--r--ext/pdo_mysql/tests/bug_42499.phpt8
-rw-r--r--ext/pdo_mysql/tests/bug_44707.phpt8
-rw-r--r--ext/pdo_mysql/tests/bug_pecl_12925.phpt8
-rw-r--r--ext/pdo_mysql/tests/bug_pecl_7976.phpt16
-rw-r--r--ext/pdo_mysql/tests/mysql_pdo_test.inc2
-rw-r--r--ext/pdo_mysql/tests/pdo_mysql_attr_case.phpt122
-rw-r--r--ext/pdo_mysql/tests/pdo_mysql_attr_driver_name.phpt2
-rw-r--r--ext/pdo_mysql/tests/pdo_mysql_attr_fetch_table_names.phpt8
-rw-r--r--ext/pdo_mysql/tests/pdo_mysql_attr_init_command.phpt8
-rw-r--r--ext/pdo_mysql/tests/pdo_mysql_attr_oracle_nulls.phpt40
-rw-r--r--ext/pdo_mysql/tests/pdo_mysql_attr_statement_class.phpt24
-rw-r--r--ext/pdo_mysql/tests/pdo_mysql_begintransaction.phpt18
-rw-r--r--ext/pdo_mysql/tests/pdo_mysql_bit.phpt8
-rw-r--r--ext/pdo_mysql/tests/pdo_mysql_connect_charset.phpt66
-rw-r--r--ext/pdo_mysql/tests/pdo_mysql_exec_load_data.phpt4
-rw-r--r--ext/pdo_mysql/tests/pdo_mysql_fetch_both.phpt16
-rw-r--r--ext/pdo_mysql/tests/pdo_mysql_param_str_natl.phpt44
-rw-r--r--ext/pdo_mysql/tests/pdo_mysql_prepare_emulated.phpt68
-rw-r--r--ext/pdo_mysql/tests/pdo_mysql_prepare_emulated_anonymous.phpt8
-rw-r--r--ext/pdo_mysql/tests/pdo_mysql_prepare_load_data.phpt4
-rw-r--r--ext/pdo_mysql/tests/pdo_mysql_quote.phpt34
-rw-r--r--ext/pdo_mysql/tests/pdo_mysql_stmt_errorinfo.phpt20
-rw-r--r--ext/pdo_mysql/tests/pdo_mysql_stmt_fetch_serialize.phpt18
-rw-r--r--ext/pdo_mysql/tests/pdo_mysql_stmt_fetch_serialize_simple.phpt2
-rw-r--r--ext/pdo_mysql/tests/pdo_mysql_stmt_fetchobject.phpt10
-rw-r--r--ext/pdo_mysql/tests/pdo_mysql_stmt_multiquery.phpt16
-rw-r--r--ext/pdo_mysql/tests/pdo_mysql_stmt_nextrowset.phpt160
-rw-r--r--ext/pdo_mysql/tests/pdo_mysql_stmt_unbuffered_2050.phpt48
-rw-r--r--ext/pdo_mysql/tests/pdo_mysql_subclass.phpt10
-rw-r--r--ext/pdo_mysql/tests/pecl_bug_5780.phpt6
-rw-r--r--ext/pdo_mysql/tests/pecl_bug_5802.phpt10
-rw-r--r--ext/pdo_mysql/tests/skipif.inc4
40 files changed, 527 insertions, 422 deletions
diff --git a/ext/pdo_mysql/mysql_driver.c b/ext/pdo_mysql/mysql_driver.c
index deab508dc8..de6b1b6d32 100644
--- a/ext/pdo_mysql/mysql_driver.c
+++ b/ext/pdo_mysql/mysql_driver.c
@@ -300,12 +300,35 @@ static char *pdo_mysql_last_insert_id(pdo_dbh_t *dbh, const char *name, size_t *
static int mysql_handle_quoter(pdo_dbh_t *dbh, const char *unquoted, size_t unquotedlen, char **quoted, size_t *quotedlen, enum pdo_param_type paramtype )
{
pdo_mysql_db_handle *H = (pdo_mysql_db_handle *)dbh->driver_data;
+ zend_bool use_national_character_set = 0;
+
+ if (H->assume_national_character_set_strings) {
+ use_national_character_set = 1;
+ }
+ if ((paramtype & PDO_PARAM_STR_NATL) == PDO_PARAM_STR_NATL) {
+ use_national_character_set = 1;
+ }
+ if ((paramtype & PDO_PARAM_STR_CHAR) == PDO_PARAM_STR_CHAR) {
+ use_national_character_set = 0;
+ }
+
PDO_DBG_ENTER("mysql_handle_quoter");
PDO_DBG_INF_FMT("dbh=%p", dbh);
PDO_DBG_INF_FMT("unquoted=%.*s", (int)unquotedlen, unquoted);
- *quoted = safe_emalloc(2, unquotedlen, 3);
- *quotedlen = mysql_real_escape_string(H->server, *quoted + 1, unquoted, unquotedlen);
- (*quoted)[0] =(*quoted)[++*quotedlen] = '\'';
+ *quoted = safe_emalloc(2, unquotedlen, 3 + (use_national_character_set ? 1 : 0));
+
+ if (use_national_character_set) {
+ *quotedlen = mysql_real_escape_string(H->server, *quoted + 2, unquoted, unquotedlen);
+ (*quoted)[0] = 'N';
+ (*quoted)[1] = '\'';
+
+ ++*quotedlen; /* N prefix */
+ } else {
+ *quotedlen = mysql_real_escape_string(H->server, *quoted + 1, unquoted, unquotedlen);
+ (*quoted)[0] = '\'';
+ }
+
+ (*quoted)[++*quotedlen] = '\'';
(*quoted)[++*quotedlen] = '\0';
PDO_DBG_INF_FMT("quoted=%.*s", (int)*quotedlen, *quoted);
PDO_DBG_RETURN(1);
@@ -369,7 +392,7 @@ static inline int mysql_handle_autocommit(pdo_dbh_t *dbh)
static int pdo_mysql_set_attribute(pdo_dbh_t *dbh, zend_long attr, zval *val)
{
zend_long lval = zval_get_long(val);
- zend_bool bval = lval? 1 : 0;
+ zend_bool bval = lval ? 1 : 0;
PDO_DBG_ENTER("pdo_mysql_set_attribute");
PDO_DBG_INF_FMT("dbh=%p", dbh);
PDO_DBG_INF_FMT("attr=%l", attr);
@@ -382,18 +405,25 @@ static int pdo_mysql_set_attribute(pdo_dbh_t *dbh, zend_long attr, zval *val)
}
PDO_DBG_RETURN(1);
+ case PDO_ATTR_DEFAULT_STR_PARAM:
+ ((pdo_mysql_db_handle *)dbh->driver_data)->assume_national_character_set_strings = lval == PDO_PARAM_STR_NATL ? 1 : 0;
+ PDO_DBG_RETURN(1);
+
case PDO_MYSQL_ATTR_USE_BUFFERED_QUERY:
/* ignore if the new value equals the old one */
((pdo_mysql_db_handle *)dbh->driver_data)->buffered = bval;
PDO_DBG_RETURN(1);
+
case PDO_MYSQL_ATTR_DIRECT_QUERY:
case PDO_ATTR_EMULATE_PREPARES:
/* ignore if the new value equals the old one */
((pdo_mysql_db_handle *)dbh->driver_data)->emulate_prepare = bval;
PDO_DBG_RETURN(1);
+
case PDO_ATTR_FETCH_TABLE_NAMES:
((pdo_mysql_db_handle *)dbh->driver_data)->fetch_table_names = bval;
PDO_DBG_RETURN(1);
+
#ifndef PDO_USE_MYSQLND
case PDO_MYSQL_ATTR_MAX_BUFFER_SIZE:
if (lval < 0) {
@@ -450,10 +480,15 @@ static int pdo_mysql_get_attribute(pdo_dbh_t *dbh, zend_long attr, zval *return_
}
}
break;
+
case PDO_ATTR_AUTOCOMMIT:
ZVAL_LONG(return_value, dbh->auto_commit);
break;
+ case PDO_ATTR_DEFAULT_STR_PARAM:
+ ZVAL_LONG(return_value, H->assume_national_character_set_strings ? PDO_PARAM_STR_NATL : PDO_PARAM_STR_CHAR);
+ break;
+
case PDO_MYSQL_ATTR_USE_BUFFERED_QUERY:
ZVAL_LONG(return_value, H->buffered);
break;
@@ -597,6 +632,7 @@ static int pdo_mysql_handle_factory(pdo_dbh_t *dbh, zval *driver_options)
H->max_buffer_size = 1024*1024;
#endif
+ H->assume_national_character_set_strings = 0;
H->buffered = H->emulate_prepare = 1;
/* handle MySQL options */
@@ -616,6 +652,9 @@ static int pdo_mysql_handle_factory(pdo_dbh_t *dbh, zval *driver_options)
H->emulate_prepare = pdo_attr_lval(driver_options,
PDO_ATTR_EMULATE_PREPARES, H->emulate_prepare);
+ H->assume_national_character_set_strings = pdo_attr_lval(driver_options,
+ PDO_ATTR_DEFAULT_STR_PARAM, 0) == PDO_PARAM_STR_NATL ? 1 : 0;
+
#ifndef PDO_USE_MYSQLND
H->max_buffer_size = pdo_attr_lval(driver_options, PDO_MYSQL_ATTR_MAX_BUFFER_SIZE, H->max_buffer_size);
#endif
diff --git a/ext/pdo_mysql/php_pdo_mysql_int.h b/ext/pdo_mysql/php_pdo_mysql_int.h
index fb437de348..32e79e111c 100644
--- a/ext/pdo_mysql/php_pdo_mysql_int.h
+++ b/ext/pdo_mysql/php_pdo_mysql_int.h
@@ -104,11 +104,11 @@ typedef struct {
typedef struct {
MYSQL *server;
+ unsigned assume_national_character_set_strings:1;
unsigned attached:1;
unsigned buffered:1;
unsigned emulate_prepare:1;
unsigned fetch_table_names:1;
- unsigned _reserved:31;
#if !PDO_USE_MYSQLND
zend_ulong max_buffer_size;
#endif
diff --git a/ext/pdo_mysql/tests/bug44327.phpt b/ext/pdo_mysql/tests/bug44327.phpt
index f82c4302d8..f5ca9e0d9d 100644
--- a/ext/pdo_mysql/tests/bug44327.phpt
+++ b/ext/pdo_mysql/tests/bug44327.phpt
@@ -42,23 +42,23 @@ $db = MySQLPDOTest::factory();
?>
--EXPECTF--
object(PDORow)#%d (2) {
- [%u|b%"queryString"]=>
- %unicode|string%(17) "SELECT 1 AS "one""
- [%u|b%"one"]=>
- %unicode|string%(1) "1"
+ ["queryString"]=>
+ string(17) "SELECT 1 AS "one""
+ ["one"]=>
+ string(1) "1"
}
-%unicode|string%(1) "1"
-%unicode|string%(1) "1"
-%unicode|string%(17) "SELECT 1 AS "one""
+string(1) "1"
+string(1) "1"
+string(17) "SELECT 1 AS "one""
----------------------------------
object(PDORow)#%d (2) {
- [%u|b%"queryString"]=>
- %unicode|string%(19) "SELECT id FROM test"
- [%u|b%"id"]=>
- %unicode|string%(1) "1"
+ ["queryString"]=>
+ string(19) "SELECT id FROM test"
+ ["id"]=>
+ string(1) "1"
}
-%unicode|string%(19) "SELECT id FROM test"
+string(19) "SELECT id FROM test"
----------------------------------
-Notice: Trying to get property of non-object in %s on line %d
+Notice: Trying to get property 'queryString' of non-object in %s on line %d
NULL
diff --git a/ext/pdo_mysql/tests/bug46292.phpt b/ext/pdo_mysql/tests/bug46292.phpt
index a0f9716c61..6a430a4dfb 100644
--- a/ext/pdo_mysql/tests/bug46292.phpt
+++ b/ext/pdo_mysql/tests/bug46292.phpt
@@ -5,8 +5,6 @@ Bug #46292 (PDO::setFetchMode() shouldn't requires the 2nd arg when using FETCH_
require_once(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'skipif.inc');
require_once(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'mysql_pdo_test.inc');
MySQLPDOTest::skip();
-if (version_compare(PHP_VERSION, '5.1.0', '<'))
- die("skip Needs 5.1.0 and Interface Serializable");
?>
--FILE--
<?php
@@ -61,24 +59,24 @@ $db->exec('DROP TABLE IF EXISTS testz');
bool(true)
myclass::__construct()
object(myclass)#%d (1) {
- [%u|b%"value"]=>
- %unicode|string%(1) "1"
+ ["value"]=>
+ string(1) "1"
}
myclass::__construct()
object(myclass2)#%d (1) {
- [%u|b%"value"]=>
- %unicode|string%(1) "2"
+ ["value"]=>
+ string(1) "2"
}
myclass::__construct()
array(2) {
[0]=>
object(myclass)#%d (1) {
- [%u|b%"value"]=>
+ ["value"]=>
NULL
}
[1]=>
object(stdClass)#%d (1) {
- [%u|b%"value"]=>
+ ["value"]=>
NULL
}
}
diff --git a/ext/pdo_mysql/tests/bug_33689.phpt b/ext/pdo_mysql/tests/bug_33689.phpt
index 5969cae6a6..bd193fa9ac 100644
--- a/ext/pdo_mysql/tests/bug_33689.phpt
+++ b/ext/pdo_mysql/tests/bug_33689.phpt
@@ -41,8 +41,8 @@ MySQLPDOTest::dropTestTable();
?>
--EXPECTF--
object(PDOStatement)#%d (1) {
- [%u|b%"queryString"]=>
- %unicode|string%(18) "SELECT * from test"
+ ["queryString"]=>
+ string(18) "SELECT * from test"
}
Array
(
diff --git a/ext/pdo_mysql/tests/bug_39858.phpt b/ext/pdo_mysql/tests/bug_39858.phpt
index cb9cafd9f5..896519f8ab 100644
--- a/ext/pdo_mysql/tests/bug_39858.phpt
+++ b/ext/pdo_mysql/tests/bug_39858.phpt
@@ -75,30 +75,30 @@ Emulated Prepared Statements...
array(1) {
[0]=>
array(1) {
- [%u|b%"2 * 2"]=>
- %unicode|string%(1) "4"
+ ["2 * 2"]=>
+ string(1) "4"
}
}
array(1) {
[0]=>
array(1) {
- [%u|b%"2 * 2"]=>
- %unicode|string%(1) "4"
+ ["2 * 2"]=>
+ string(1) "4"
}
}
Native Prepared Statements...
array(1) {
[0]=>
array(1) {
- [%u|b%"2 * 2"]=>
- %unicode|string%(1) "4"
+ ["2 * 2"]=>
+ string(1) "4"
}
}
array(1) {
[0]=>
array(1) {
- [%u|b%"2 * 2"]=>
- %unicode|string%(1) "4"
+ ["2 * 2"]=>
+ string(1) "4"
}
}
done!
diff --git a/ext/pdo_mysql/tests/bug_41698.phpt b/ext/pdo_mysql/tests/bug_41698.phpt
index 890ba77617..e23aac2a55 100644
--- a/ext/pdo_mysql/tests/bug_41698.phpt
+++ b/ext/pdo_mysql/tests/bug_41698.phpt
@@ -26,12 +26,12 @@ var_dump($db->query('SELECT * from test')->fetchAll(PDO::FETCH_ASSOC));
array(2) {
[0]=>
array(1) {
- [%u|b%"floatval"]=>
- %unicode|string%(8) "2.340000"
+ ["floatval"]=>
+ string(8) "2.340000"
}
[1]=>
array(1) {
- [%u|b%"floatval"]=>
- %unicode|string%(8) "4.560000"
+ ["floatval"]=>
+ string(8) "4.560000"
}
} \ No newline at end of file
diff --git a/ext/pdo_mysql/tests/bug_41997.phpt b/ext/pdo_mysql/tests/bug_41997.phpt
index 56cbe4b087..f001eec7d0 100644
--- a/ext/pdo_mysql/tests/bug_41997.phpt
+++ b/ext/pdo_mysql/tests/bug_41997.phpt
@@ -42,13 +42,13 @@ print "done!";
array(1) {
[0]=>
array(1) {
- [%u|b%"one"]=>
- %unicode|string%(1) "1"
+ ["one"]=>
+ string(1) "1"
}
}
array(3) {
[0]=>
- %unicode|string%(5) "00000"
+ string(5) "00000"
[1]=>
NULL
[2]=>
@@ -57,13 +57,13 @@ array(3) {
array(1) {
[0]=>
array(1) {
- [%u|b%"two"]=>
- %unicode|string%(1) "2"
+ ["two"]=>
+ string(1) "2"
}
}
array(3) {
[0]=>
- %unicode|string%(5) "00000"
+ string(5) "00000"
[1]=>
NULL
[2]=>
diff --git a/ext/pdo_mysql/tests/bug_42499.phpt b/ext/pdo_mysql/tests/bug_42499.phpt
index 4ce497ebf9..e218e0c14e 100644
--- a/ext/pdo_mysql/tests/bug_42499.phpt
+++ b/ext/pdo_mysql/tests/bug_42499.phpt
@@ -61,8 +61,8 @@ Emulated Prepared Statements...
array(1) {
[0]=>
array(1) {
- [%u|b%"_id"]=>
- %unicode|string%(1) "a"
+ ["_id"]=>
+ string(1) "a"
}
}
@@ -71,8 +71,8 @@ Native Prepared Statements...
array(1) {
[0]=>
array(1) {
- [%u|b%"_id"]=>
- %unicode|string%(1) "a"
+ ["_id"]=>
+ string(1) "a"
}
}
diff --git a/ext/pdo_mysql/tests/bug_44707.phpt b/ext/pdo_mysql/tests/bug_44707.phpt
index 18c81040fe..90dc4c20f4 100644
--- a/ext/pdo_mysql/tests/bug_44707.phpt
+++ b/ext/pdo_mysql/tests/bug_44707.phpt
@@ -83,10 +83,10 @@ array(0) {
array(1) {
[0]=>
array(2) {
- [%u|b%"id"]=>
- %unicode|string%(1) "1"
- [%u|b%"mybool"]=>
- %unicode|string%(1) "0"
+ ["id"]=>
+ string(1) "1"
+ ["mybool"]=>
+ string(1) "0"
}
}
done!
diff --git a/ext/pdo_mysql/tests/bug_pecl_12925.phpt b/ext/pdo_mysql/tests/bug_pecl_12925.phpt
index dc6933d4b9..25281fe31c 100644
--- a/ext/pdo_mysql/tests/bug_pecl_12925.phpt
+++ b/ext/pdo_mysql/tests/bug_pecl_12925.phpt
@@ -47,16 +47,16 @@ Emulated...
array(1) {
[0]=>
array(1) {
- [%u|b%"id"]=>
- %unicode|string%(1) "c"
+ ["id"]=>
+ string(1) "c"
}
}
Native...
array(1) {
[0]=>
array(1) {
- [%u|b%"id"]=>
- %unicode|string%(1) "c"
+ ["id"]=>
+ string(1) "c"
}
}
done! \ No newline at end of file
diff --git a/ext/pdo_mysql/tests/bug_pecl_7976.phpt b/ext/pdo_mysql/tests/bug_pecl_7976.phpt
index 5f585bd013..9efba0d537 100644
--- a/ext/pdo_mysql/tests/bug_pecl_7976.phpt
+++ b/ext/pdo_mysql/tests/bug_pecl_7976.phpt
@@ -63,30 +63,30 @@ Emulated...
array(1) {
[0]=>
array(1) {
- [%u|b%"_one"]=>
- %unicode|string%(1) "1"
+ ["_one"]=>
+ string(1) "1"
}
}
array(1) {
[0]=>
array(1) {
- [%u|b%"_one"]=>
- %unicode|string%(1) "1"
+ ["_one"]=>
+ string(1) "1"
}
}
Native...
array(1) {
[0]=>
array(1) {
- [%u|b%"_one"]=>
- %unicode|string%(1) "1"
+ ["_one"]=>
+ string(1) "1"
}
}
array(1) {
[0]=>
array(1) {
- [%u|b%"_one"]=>
- %unicode|string%(1) "1"
+ ["_one"]=>
+ string(1) "1"
}
}
done!
diff --git a/ext/pdo_mysql/tests/mysql_pdo_test.inc b/ext/pdo_mysql/tests/mysql_pdo_test.inc
index 7a97bb4630..4e953ed7e1 100644
--- a/ext/pdo_mysql/tests/mysql_pdo_test.inc
+++ b/ext/pdo_mysql/tests/mysql_pdo_test.inc
@@ -55,7 +55,7 @@ class MySQLPDOTest extends PDOTest {
strpos(PDO_MYSQL_TEST_DSN, ':') + 1,
strlen(PDO_MYSQL_TEST_DSN));
- // no real parser - any excotic setting can fool us
+ // no real parser - any exotic setting can fool us
$parts = explode(';', $dsn);
foreach ($parts as $k => $v) {
$tmp = explode('=', $v);
diff --git a/ext/pdo_mysql/tests/pdo_mysql_attr_case.phpt b/ext/pdo_mysql/tests/pdo_mysql_attr_case.phpt
index 8ce8af4a85..cdbc02b645 100644
--- a/ext/pdo_mysql/tests/pdo_mysql_attr_case.phpt
+++ b/ext/pdo_mysql/tests/pdo_mysql_attr_case.phpt
@@ -90,82 +90,82 @@ require dirname(__FILE__) . '/mysql_pdo_test.inc';
MySQLPDOTest::dropTestTable();
?>
--EXPECTF--
-%unicode|string%(15) "PDO::CASE_LOWER"
+string(15) "PDO::CASE_LOWER"
array(2) {
[0]=>
array(6) {
- [%u|b%"id"]=>
- %unicode|string%(1) "1"
+ ["id"]=>
+ string(1) "1"
[0]=>
- %unicode|string%(1) "1"
- [%u|b%"id_upper"]=>
- %unicode|string%(1) "1"
+ string(1) "1"
+ ["id_upper"]=>
+ string(1) "1"
[1]=>
- %unicode|string%(1) "1"
- [%u|b%"label"]=>
- %unicode|string%(1) "a"
+ string(1) "1"
+ ["label"]=>
+ string(1) "a"
[2]=>
- %unicode|string%(1) "a"
+ string(1) "a"
}
[1]=>
array(6) {
- [%u|b%"id"]=>
- %unicode|string%(1) "2"
+ ["id"]=>
+ string(1) "2"
[0]=>
- %unicode|string%(1) "2"
- [%u|b%"id_upper"]=>
- %unicode|string%(1) "2"
+ string(1) "2"
+ ["id_upper"]=>
+ string(1) "2"
[1]=>
- %unicode|string%(1) "2"
- [%u|b%"label"]=>
- %unicode|string%(1) "b"
+ string(1) "2"
+ ["label"]=>
+ string(1) "b"
[2]=>
- %unicode|string%(1) "b"
+ string(1) "b"
}
}
array(2) {
[0]=>
array(10) {
- [%u|b%"id"]=>
- %unicode|string%(1) "1"
+ ["id"]=>
+ string(1) "1"
[0]=>
- %unicode|string%(1) "1"
- [%u|b%"id_upper"]=>
- %unicode|string%(1) "1"
+ string(1) "1"
+ ["id_upper"]=>
+ string(1) "1"
[1]=>
- %unicode|string%(1) "1"
- [%u|b%"label"]=>
- %unicode|string%(1) "a"
+ string(1) "1"
+ ["label"]=>
+ string(1) "a"
[2]=>
- %unicode|string%(1) "a"
- [%u|b%"mixed"]=>
+ string(1) "a"
+ ["mixed"]=>
NULL
[3]=>
NULL
- [%u|b%"myupper"]=>
+ ["myupper"]=>
NULL
[4]=>
NULL
}
[1]=>
array(10) {
- [%u|b%"id"]=>
- %unicode|string%(1) "2"
+ ["id"]=>
+ string(1) "2"
[0]=>
- %unicode|string%(1) "2"
- [%u|b%"id_upper"]=>
- %unicode|string%(1) "2"
+ string(1) "2"
+ ["id_upper"]=>
+ string(1) "2"
[1]=>
- %unicode|string%(1) "2"
- [%u|b%"label"]=>
- %unicode|string%(1) "b"
+ string(1) "2"
+ ["label"]=>
+ string(1) "b"
[2]=>
- %unicode|string%(1) "b"
- [%u|b%"mixed"]=>
+ string(1) "b"
+ ["mixed"]=>
NULL
[3]=>
NULL
- [%u|b%"myupper"]=>
+ ["myupper"]=>
NULL
[4]=>
NULL
@@ -174,23 +174,23 @@ array(2) {
array(1) {
[0]=>
array(10) {
- [%u|b%"ID"]=>
- %unicode|string%(1) "1"
+ ["ID"]=>
+ string(1) "1"
[0]=>
- %unicode|string%(1) "1"
- [%u|b%"LABEL"]=>
- %unicode|string%(1) "a"
+ string(1) "1"
+ ["LABEL"]=>
+ string(1) "a"
[1]=>
- %unicode|string%(1) "a"
- [%u|b%"MIXED"]=>
+ string(1) "a"
+ ["MIXED"]=>
NULL
[2]=>
NULL
- [%u|b%"MYUPPER"]=>
+ ["MYUPPER"]=>
NULL
[3]=>
NULL
- [%u|b%"LOWER"]=>
+ ["LOWER"]=>
NULL
[4]=>
NULL
@@ -199,26 +199,26 @@ array(1) {
array(1) {
[0]=>
array(10) {
- [%u|b%"id"]=>
- %unicode|string%(1) "1"
+ ["id"]=>
+ string(1) "1"
[0]=>
- %unicode|string%(1) "1"
- [%u|b%"label"]=>
- %unicode|string%(1) "a"
+ string(1) "1"
+ ["label"]=>
+ string(1) "a"
[1]=>
- %unicode|string%(1) "a"
- [%u|b%"MiXeD"]=>
+ string(1) "a"
+ ["MiXeD"]=>
NULL
[2]=>
NULL
- [%u|b%"MYUPPER"]=>
+ ["MYUPPER"]=>
NULL
[3]=>
NULL
- [%u|b%"ID"]=>
- %unicode|string%(1) "1"
+ ["ID"]=>
+ string(1) "1"
[4]=>
- %unicode|string%(1) "1"
+ string(1) "1"
}
}
done! \ No newline at end of file
diff --git a/ext/pdo_mysql/tests/pdo_mysql_attr_driver_name.phpt b/ext/pdo_mysql/tests/pdo_mysql_attr_driver_name.phpt
index 8661dda597..108a7c3984 100644
--- a/ext/pdo_mysql/tests/pdo_mysql_attr_driver_name.phpt
+++ b/ext/pdo_mysql/tests/pdo_mysql_attr_driver_name.phpt
@@ -27,5 +27,5 @@ $db = MySQLPDOTest::factory();
print "done!";
?>
--EXPECTF--
-%unicode|string%(5) "mysql"
+string(5) "mysql"
done! \ No newline at end of file
diff --git a/ext/pdo_mysql/tests/pdo_mysql_attr_fetch_table_names.phpt b/ext/pdo_mysql/tests/pdo_mysql_attr_fetch_table_names.phpt
index b9a4fc934d..cc13ec03d3 100644
--- a/ext/pdo_mysql/tests/pdo_mysql_attr_fetch_table_names.phpt
+++ b/ext/pdo_mysql/tests/pdo_mysql_attr_fetch_table_names.phpt
@@ -28,15 +28,15 @@ MySQLPDOTest::skip();
array(1) {
[0]=>
array(1) {
- [%u|b%"test.label"]=>
- %unicode|string%(1) "a"
+ ["test.label"]=>
+ string(1) "a"
}
}
array(1) {
[0]=>
array(1) {
- [%u|b%"label"]=>
- %unicode|string%(1) "a"
+ ["label"]=>
+ string(1) "a"
}
}
done!
diff --git a/ext/pdo_mysql/tests/pdo_mysql_attr_init_command.phpt b/ext/pdo_mysql/tests/pdo_mysql_attr_init_command.phpt
index 89e6f386e5..4ef6e52976 100644
--- a/ext/pdo_mysql/tests/pdo_mysql_attr_init_command.phpt
+++ b/ext/pdo_mysql/tests/pdo_mysql_attr_init_command.phpt
@@ -36,13 +36,13 @@ error_reporting=E_ALL
print "done!";
?>
--EXPECTF--
-%unicode|string%(58) "CREATE TABLE test_%s(id INT)"
-%unicode|string%(5) "00000"
+string(58) "CREATE TABLE test_%s(id INT)"
+string(5) "00000"
array(1) {
[0]=>
array(1) {
- [%u|b%"id"]=>
- %unicode|string%(1) "1"
+ ["id"]=>
+ string(1) "1"
}
}
done!
diff --git a/ext/pdo_mysql/tests/pdo_mysql_attr_oracle_nulls.phpt b/ext/pdo_mysql/tests/pdo_mysql_attr_oracle_nulls.phpt
index 182080440b..cc8dab5a14 100644
--- a/ext/pdo_mysql/tests/pdo_mysql_attr_oracle_nulls.phpt
+++ b/ext/pdo_mysql/tests/pdo_mysql_attr_oracle_nulls.phpt
@@ -87,35 +87,35 @@ MySQLPDOTest::skip();
array(1) {
[0]=>
array(6) {
- [%u|b%"z"]=>
+ ["z"]=>
NULL
- [%u|b%"a"]=>
+ ["a"]=>
NULL
- [%u|b%"b"]=>
- %unicode|string%(1) " "
- [%u|b%"c"]=>
+ ["b"]=>
+ string(1) " "
+ ["c"]=>
NULL
- [%u|b%"d"]=>
- %unicode|string%(2) " d"
- [%u|b%"e"]=>
- %unicode|string%(3) "%se"
+ ["d"]=>
+ string(2) " d"
+ ["e"]=>
+ string(3) "%se"
}
}
array(1) {
[0]=>
array(6) {
- [%u|b%"z"]=>
+ ["z"]=>
NULL
- [%u|b%"a"]=>
- %unicode|string%(0) ""
- [%u|b%"b"]=>
- %unicode|string%(1) " "
- [%u|b%"c"]=>
- %unicode|string%(0) ""
- [%u|b%"d"]=>
- %unicode|string%(2) " d"
- [%u|b%"e"]=>
- %unicode|string%(3) "%se"
+ ["a"]=>
+ string(0) ""
+ ["b"]=>
+ string(1) " "
+ ["c"]=>
+ string(0) ""
+ ["d"]=>
+ string(2) " d"
+ ["e"]=>
+ string(3) "%se"
}
}
done! \ No newline at end of file
diff --git a/ext/pdo_mysql/tests/pdo_mysql_attr_statement_class.phpt b/ext/pdo_mysql/tests/pdo_mysql_attr_statement_class.phpt
index fb336ba627..6955e0a173 100644
--- a/ext/pdo_mysql/tests/pdo_mysql_attr_statement_class.phpt
+++ b/ext/pdo_mysql/tests/pdo_mysql_attr_statement_class.phpt
@@ -110,7 +110,7 @@ $db = MySQLPDOTest::factory();
--EXPECTF--
array(1) {
[0]=>
- %unicode|string%(12) "PDOStatement"
+ string(12) "PDOStatement"
}
Warning: PDO::setAttribute(): SQLSTATE[HY000]: General error: PDO::ATTR_STATEMENT_CLASS requires format array(classname, array(ctor_args)); the classname must be a string specifying an existing class in %s on line %d
@@ -126,29 +126,29 @@ Warning: PDO::setAttribute(): SQLSTATE[HY000]: General error: user-supplied stat
Warning: PDO::setAttribute(): SQLSTATE[HY000]: General error in %s on line %d
array(2) {
[0]=>
- %unicode|string%(12) "mystatement4"
+ string(12) "mystatement4"
[1]=>
array(1) {
[0]=>
- %unicode|string%(6) "param1"
+ string(6) "param1"
}
}
mystatement4
-%unicode|string%(6) "param1"
+string(6) "param1"
mystatement5
-%unicode|string%(12) "mystatement5"
-%unicode|string%(10) "no data :)"
+string(12) "mystatement5"
+string(10) "no data :)"
array(1) {
[0]=>
array(4) {
- [%u|b%"id"]=>
- %unicode|string%(1) "1"
+ ["id"]=>
+ string(1) "1"
[0]=>
- %unicode|string%(1) "1"
- [%u|b%"label"]=>
- %unicode|string%(1) "a"
+ string(1) "1"
+ ["label"]=>
+ string(1) "a"
[1]=>
- %unicode|string%(1) "a"
+ string(1) "a"
}
}
diff --git a/ext/pdo_mysql/tests/pdo_mysql_begintransaction.phpt b/ext/pdo_mysql/tests/pdo_mysql_begintransaction.phpt
index ac9f8a3114..3fd9827ff2 100644
--- a/ext/pdo_mysql/tests/pdo_mysql_begintransaction.phpt
+++ b/ext/pdo_mysql/tests/pdo_mysql_begintransaction.phpt
@@ -188,19 +188,19 @@ MySQLPDOTest::dropTestTable();
?>
--EXPECTF--
array(2) {
- [%u|b%"id"]=>
- %unicode|string%(1) "1"
- [%u|b%"label"]=>
- %unicode|string%(1) "a"
+ ["id"]=>
+ string(1) "1"
+ ["label"]=>
+ string(1) "a"
}
bool(false)
array(2) {
- [%u|b%"id"]=>
- %unicode|string%(1) "1"
- [%u|b%"label"]=>
- %unicode|string%(1) "z"
+ ["id"]=>
+ string(1) "1"
+ ["label"]=>
+ string(1) "z"
}
[026] Autocommit mode of the MySQL Server should be off, got '1', [0] 00000
[028] I'm confused, how can autocommit be on? Didn't I say I want to manually control transactions?
-%unicode|string%(5) "00000"
+string(5) "00000"
done!
diff --git a/ext/pdo_mysql/tests/pdo_mysql_bit.phpt b/ext/pdo_mysql/tests/pdo_mysql_bit.phpt
index 899231a217..587ac9f2e2 100644
--- a/ext/pdo_mysql/tests/pdo_mysql_bit.phpt
+++ b/ext/pdo_mysql/tests/pdo_mysql_bit.phpt
@@ -55,10 +55,10 @@ $db->exec('DROP TABLE IF EXISTS test');
?>
--EXPECTF--
array(2) {
- [%u|b%"id"]=>
- %unicode|string%(2) "20"
- [%u|b%"label"]=>
- %unicode|string%(1) "1"
+ ["id"]=>
+ string(2) "20"
+ ["label"]=>
+ string(1) "1"
}
int(1)
done! \ No newline at end of file
diff --git a/ext/pdo_mysql/tests/pdo_mysql_connect_charset.phpt b/ext/pdo_mysql/tests/pdo_mysql_connect_charset.phpt
index fb7e9a9d0a..4528213f11 100644
--- a/ext/pdo_mysql/tests/pdo_mysql_connect_charset.phpt
+++ b/ext/pdo_mysql/tests/pdo_mysql_connect_charset.phpt
@@ -1,33 +1,33 @@
---TEST--
-PDO_MYSQL: Defining a connection charset in the DSN
---SKIPIF--
-<?php
-require_once(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'skipif.inc');
-require_once(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'mysql_pdo_test.inc');
-MySQLPDOTest::skip();
-?>
---FILE--
-<?php
- require_once(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'mysql_pdo_test.inc');
-
- /* Connect to mysql to determine the current charset so we can diffinate it */
- $link = MySQLPDOTest::factory();
- $charset = $link->query("SHOW VARIABLES LIKE 'character_set_connection'")->fetchObject()->value;
-
- /* Make sure that we don't attempt to set the current character set to make this case useful */
- $new_charset = ($charset == 'latin1' ? 'ascii' : 'latin1');
-
- /* Done with the original connection, create a second link to test the character set being defined */
- unset($link);
-
- $link = MySQLPDOTest::factory('PDO', false, null, Array('charset' => $new_charset));
- $conn_charset = $link->query("SHOW VARIABLES LIKE 'character_set_connection'")->fetchObject()->value;
-
- if ($charset !== $conn_charset) {
- echo "done!\n";
- } else {
- echo "failed!\n";
- }
-?>
---EXPECTF--
-done!
+--TEST--
+PDO_MYSQL: Defining a connection charset in the DSN
+--SKIPIF--
+<?php
+require_once(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'skipif.inc');
+require_once(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'mysql_pdo_test.inc');
+MySQLPDOTest::skip();
+?>
+--FILE--
+<?php
+ require_once(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'mysql_pdo_test.inc');
+
+ /* Connect to mysql to determine the current charset so we can diffinate it */
+ $link = MySQLPDOTest::factory();
+ $charset = $link->query("SHOW VARIABLES LIKE 'character_set_connection'")->fetchObject()->value;
+
+ /* Make sure that we don't attempt to set the current character set to make this case useful */
+ $new_charset = ($charset == 'latin1' ? 'ascii' : 'latin1');
+
+ /* Done with the original connection, create a second link to test the character set being defined */
+ unset($link);
+
+ $link = MySQLPDOTest::factory('PDO', false, null, Array('charset' => $new_charset));
+ $conn_charset = $link->query("SHOW VARIABLES LIKE 'character_set_connection'")->fetchObject()->value;
+
+ if ($charset !== $conn_charset) {
+ echo "done!\n";
+ } else {
+ echo "failed!\n";
+ }
+?>
+--EXPECTF--
+done!
diff --git a/ext/pdo_mysql/tests/pdo_mysql_exec_load_data.phpt b/ext/pdo_mysql/tests/pdo_mysql_exec_load_data.phpt
index 38b49b6efa..364a8d976e 100644
--- a/ext/pdo_mysql/tests/pdo_mysql_exec_load_data.phpt
+++ b/ext/pdo_mysql/tests/pdo_mysql_exec_load_data.phpt
@@ -77,8 +77,8 @@ if (($row = $stmt->fetch(PDO::FETCH_ASSOC)) && ($row['value'] != '')) {
}
$fp = fopen($filename, "w");
- fwrite($fp, b"1;foo\n");
- fwrite($fp, b"2;bar");
+ fwrite($fp, "1;foo\n");
+ fwrite($fp, "2;bar");
fclose($fp);
$sql = sprintf("LOAD DATA LOCAL INFILE %s INTO TABLE test FIELDS TERMINATED BY ';' LINES TERMINATED BY '\n'", $db->quote($filename));
diff --git a/ext/pdo_mysql/tests/pdo_mysql_fetch_both.phpt b/ext/pdo_mysql/tests/pdo_mysql_fetch_both.phpt
index da886390c0..a508459e55 100644
--- a/ext/pdo_mysql/tests/pdo_mysql_fetch_both.phpt
+++ b/ext/pdo_mysql/tests/pdo_mysql_fetch_both.phpt
@@ -62,27 +62,27 @@ $db = MySQLPDOTest::factory();
[002] Suspicious FETCH_BOTH result, dumping
array(2) {
[0]=>
- %unicode|string%(1) "1"
+ string(1) "1"
[1]=>
- %unicode|string%(1) "1"
+ string(1) "1"
}
array(2) {
[1]=>
- %unicode|string%(1) "1"
+ string(1) "1"
[2]=>
- %unicode|string%(1) "1"
+ string(1) "1"
}
[002] Expected differes from returned data, dumping
array(2) {
[0]=>
- %unicode|string%(1) "1"
+ string(1) "1"
[1]=>
- %unicode|string%(1) "1"
+ string(1) "1"
}
array(2) {
[1]=>
- %unicode|string%(1) "1"
+ string(1) "1"
[2]=>
- %unicode|string%(1) "1"
+ string(1) "1"
}
done! \ No newline at end of file
diff --git a/ext/pdo_mysql/tests/pdo_mysql_param_str_natl.phpt b/ext/pdo_mysql/tests/pdo_mysql_param_str_natl.phpt
new file mode 100644
index 0000000000..56b94483f3
--- /dev/null
+++ b/ext/pdo_mysql/tests/pdo_mysql_param_str_natl.phpt
@@ -0,0 +1,44 @@
+--TEST--
+PDO MySQL national character set parameters don't affect true prepared statements
+--SKIPIF--
+<?php
+if (!extension_loaded('pdo') || !extension_loaded('pdo_mysql')) die('skip not loaded');
+require dirname(__FILE__) . '/config.inc';
+require dirname(__FILE__) . '/../../../ext/pdo/tests/pdo_test.inc';
+PDOTest::skip();
+?>
+--FILE--
+<?php
+require dirname(__FILE__) . '/config.inc';
+require dirname(__FILE__) . '/../../../ext/pdo/tests/pdo_test.inc';
+$db = PDOTest::test_factory(dirname(__FILE__) . '/common.phpt');
+
+$db->setAttribute(PDO::ATTR_EMULATE_PREPARES, 0);
+
+$db->exec('CREATE TABLE test (bar NCHAR(4) NOT NULL)');
+
+$stmt = $db->prepare('INSERT INTO test VALUES(?)');
+$stmt->bindValue(1, 'foo', PDO::PARAM_STR | PDO::PARAM_STR_NATL);
+$stmt->execute();
+
+var_dump($db->query('SELECT * from test'));
+foreach ($db->query('SELECT * from test') as $row) {
+ print_r($row);
+}
+
+?>
+--CLEAN--
+<?php
+require dirname(__FILE__) . '/mysql_pdo_test.inc';
+MySQLPDOTest::dropTestTable();
+?>
+--EXPECTF--
+object(PDOStatement)#%d (1) {
+ ["queryString"]=>
+ string(18) "SELECT * from test"
+}
+Array
+(
+ [bar] => foo
+ [0] => foo
+)
diff --git a/ext/pdo_mysql/tests/pdo_mysql_prepare_emulated.phpt b/ext/pdo_mysql/tests/pdo_mysql_prepare_emulated.phpt
index b2db0d9eed..f8340f7753 100644
--- a/ext/pdo_mysql/tests/pdo_mysql_prepare_emulated.phpt
+++ b/ext/pdo_mysql/tests/pdo_mysql_prepare_emulated.phpt
@@ -329,91 +329,91 @@ PDO's PS parser has some problems with invalid SQL and crashes from time to time
(check with valgrind...)
--EXPECTF--
array(1) {
- [%u|b%"one"]=>
- %unicode|string%(1) "1"
+ ["one"]=>
+ string(1) "1"
}
array(1) {
[0]=>
array(1) {
- [%u|b%"label"]=>
- %unicode|string%(12) ":placeholder"
+ ["label"]=>
+ string(12) ":placeholder"
}
}
array(1) {
[0]=>
array(1) {
- [%u|b%"label"]=>
- %unicode|string%(12) ":placeholder"
+ ["label"]=>
+ string(12) ":placeholder"
}
}
array(2) {
[0]=>
array(1) {
- [%u|b%"label"]=>
- %unicode|string%(9) "first row"
+ ["label"]=>
+ string(9) "first row"
}
[1]=>
array(1) {
- [%u|b%"label"]=>
- %unicode|string%(10) "second row"
+ ["label"]=>
+ string(10) "second row"
}
}
array(2) {
[0]=>
array(2) {
- [%u|b%"id"]=>
- %unicode|string%(1) "1"
- [%u|b%"label"]=>
- %unicode|string%(3) "row"
+ ["id"]=>
+ string(1) "1"
+ ["label"]=>
+ string(3) "row"
}
[1]=>
array(2) {
- [%u|b%"id"]=>
- %unicode|string%(1) "2"
- [%u|b%"label"]=>
- %unicode|string%(3) "row"
+ ["id"]=>
+ string(1) "2"
+ ["label"]=>
+ string(3) "row"
}
}
array(1) {
[0]=>
array(1) {
- [%u|b%"label"]=>
- %unicode|string%(1) "?"
+ ["label"]=>
+ string(1) "?"
}
}
array(1) {
[0]=>
array(1) {
- [%u|b%"label"]=>
- %unicode|string%(1) "?"
+ ["label"]=>
+ string(1) "?"
}
}
array(2) {
[0]=>
array(1) {
- [%u|b%"label"]=>
- %unicode|string%(9) "first row"
+ ["label"]=>
+ string(9) "first row"
}
[1]=>
array(1) {
- [%u|b%"label"]=>
- %unicode|string%(10) "second row"
+ ["label"]=>
+ string(10) "second row"
}
}
array(2) {
[0]=>
array(2) {
- [%u|b%"id"]=>
- %unicode|string%(1) "1"
- [%u|b%"label"]=>
- %unicode|string%(3) "row"
+ ["id"]=>
+ string(1) "1"
+ ["label"]=>
+ string(3) "row"
}
[1]=>
array(2) {
- [%u|b%"id"]=>
- %unicode|string%(1) "2"
- [%u|b%"label"]=>
- %unicode|string%(3) "row"
+ ["id"]=>
+ string(1) "2"
+ ["label"]=>
+ string(3) "row"
}
}
done!
diff --git a/ext/pdo_mysql/tests/pdo_mysql_prepare_emulated_anonymous.phpt b/ext/pdo_mysql/tests/pdo_mysql_prepare_emulated_anonymous.phpt
index c6b299e076..0ac614e4cc 100644
--- a/ext/pdo_mysql/tests/pdo_mysql_prepare_emulated_anonymous.phpt
+++ b/ext/pdo_mysql/tests/pdo_mysql_prepare_emulated_anonymous.phpt
@@ -68,10 +68,10 @@ $db->exec('DROP TABLE IF EXISTS test');
array(1) {
[0]=>
array(2) {
- [%u|b%"id"]=>
- %unicode|string%(1) "1"
- [%u|b%"label"]=>
- %unicode|string%(1) "?"
+ ["id"]=>
+ string(1) "1"
+ ["label"]=>
+ string(1) "?"
}
}
now the same with native PS
diff --git a/ext/pdo_mysql/tests/pdo_mysql_prepare_load_data.phpt b/ext/pdo_mysql/tests/pdo_mysql_prepare_load_data.phpt
index 9b07ac2479..958068f035 100644
--- a/ext/pdo_mysql/tests/pdo_mysql_prepare_load_data.phpt
+++ b/ext/pdo_mysql/tests/pdo_mysql_prepare_load_data.phpt
@@ -79,8 +79,8 @@ if (($row = $stmt->fetch(PDO::FETCH_ASSOC)) && ($row['value'] != '')) {
}
$fp = fopen($filename, "w");
- fwrite($fp, b"1;foo\n");
- fwrite($fp, b"2;bar");
+ fwrite($fp, "1;foo\n");
+ fwrite($fp, "2;bar");
fclose($fp);
// This should fail, the PS protocol should not support it.
diff --git a/ext/pdo_mysql/tests/pdo_mysql_quote.phpt b/ext/pdo_mysql/tests/pdo_mysql_quote.phpt
new file mode 100644
index 0000000000..3d094a4136
--- /dev/null
+++ b/ext/pdo_mysql/tests/pdo_mysql_quote.phpt
@@ -0,0 +1,34 @@
+--TEST--
+MySQL ensure quote function returns expected results
+--SKIPIF--
+<?php
+require_once(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'skipif.inc');
+require_once(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'mysql_pdo_test.inc');
+MySQLPDOTest::skip();
+?>
+--FILE--
+<?php
+require_once(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'mysql_pdo_test.inc');
+$db = MySQLPDOTest::factory();
+
+var_dump($db->quote('foo', PDO::PARAM_STR));
+var_dump($db->quote('foo', PDO::PARAM_STR | PDO::PARAM_STR_CHAR));
+var_dump($db->quote('über', PDO::PARAM_STR | PDO::PARAM_STR_NATL));
+
+var_dump($db->getAttribute(PDO::ATTR_DEFAULT_STR_PARAM) === PDO::PARAM_STR_CHAR);
+$db->setAttribute(PDO::ATTR_DEFAULT_STR_PARAM, PDO::PARAM_STR_NATL);
+var_dump($db->getAttribute(PDO::ATTR_DEFAULT_STR_PARAM) === PDO::PARAM_STR_NATL);
+
+var_dump($db->quote('foo', PDO::PARAM_STR | PDO::PARAM_STR_CHAR));
+var_dump($db->quote('über', PDO::PARAM_STR));
+var_dump($db->quote('über', PDO::PARAM_STR | PDO::PARAM_STR_NATL));
+?>
+--EXPECT--
+string(5) "'foo'"
+string(5) "'foo'"
+string(8) "N'über'"
+bool(true)
+bool(true)
+string(5) "'foo'"
+string(8) "N'über'"
+string(8) "N'über'"
diff --git a/ext/pdo_mysql/tests/pdo_mysql_stmt_errorinfo.phpt b/ext/pdo_mysql/tests/pdo_mysql_stmt_errorinfo.phpt
index 9028f0b49f..9254568db0 100644
--- a/ext/pdo_mysql/tests/pdo_mysql_stmt_errorinfo.phpt
+++ b/ext/pdo_mysql/tests/pdo_mysql_stmt_errorinfo.phpt
@@ -68,7 +68,7 @@ MySQLPDOTest::dropTestTable();
Testing emulated PS...
array(3) {
[0]=>
- %unicode|string%(0) ""
+ string(0) ""
[1]=>
NULL
[2]=>
@@ -78,26 +78,26 @@ array(3) {
Warning: PDOStatement::execute(): SQLSTATE[42S02]: Base table or view not found: 1146 Table '%s.ihopeitdoesnotexist' doesn't exist in %s on line %d
array(3) {
[0]=>
- %unicode|string%(5) "42S02"
+ string(5) "42S02"
[1]=>
int(1146)
[2]=>
- %unicode|string%(%d) "Table '%s.ihopeitdoesnotexist' doesn't exist"
+ string(%d) "Table '%s.ihopeitdoesnotexist' doesn't exist"
}
Warning: PDOStatement::execute(): SQLSTATE[42S02]: Base table or view not found: 1146 Table '%s.test' doesn't exist in %s on line %d
bool(false)
array(3) {
[0]=>
- %unicode|string%(5) "42S02"
+ string(5) "42S02"
[1]=>
int(1146)
[2]=>
- %unicode|string%(%d) "Table '%s.test' doesn't exist"
+ string(%d) "Table '%s.test' doesn't exist"
}
array(3) {
[0]=>
- %unicode|string%(5) "00000"
+ string(5) "00000"
[1]=>
NULL
[2]=>
@@ -109,7 +109,7 @@ Warning: PDO::prepare(): SQLSTATE[42S02]: Base table or view not found: 1146 Tab
bool(false)
array(3) {
[0]=>
- %unicode|string%(0) ""
+ string(0) ""
[1]=>
NULL
[2]=>
@@ -119,15 +119,15 @@ array(3) {
Warning: PDOStatement::execute(): SQLSTATE[42S02]: Base table or view not found: 1146 Table '%s.test' doesn't exist in %s on line %d
array(3) {
[0]=>
- %unicode|string%(5) "42S02"
+ string(5) "42S02"
[1]=>
int(1146)
[2]=>
- %unicode|string%(%d) "Table '%s.test' doesn't exist"
+ string(%d) "Table '%s.test' doesn't exist"
}
array(3) {
[0]=>
- %unicode|string%(5) "00000"
+ string(5) "00000"
[1]=>
NULL
[2]=>
diff --git a/ext/pdo_mysql/tests/pdo_mysql_stmt_fetch_serialize.phpt b/ext/pdo_mysql/tests/pdo_mysql_stmt_fetch_serialize.phpt
index 18ef17b7c2..f23f9572c1 100644
--- a/ext/pdo_mysql/tests/pdo_mysql_stmt_fetch_serialize.phpt
+++ b/ext/pdo_mysql/tests/pdo_mysql_stmt_fetch_serialize.phpt
@@ -5,8 +5,6 @@ MySQL PDOStatement->fetch(), PDO::FETCH_SERIALIZE
require_once(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'skipif.inc');
require_once(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'mysql_pdo_test.inc');
MySQLPDOTest::skip();
-if (version_compare(PHP_VERSION, '5.1.0', '<'))
- die("skip Needs 5.1.0 and Interface Serializable");
?>
--FILE--
<?php
@@ -130,24 +128,24 @@ myclass::serialize()
Unserializing the previously serialized object...
myclass::unserialize('Data from serialize')
object(myclass)#4 (1) {
- [%u|b%"myprotected":protected]=>
- %unicode|string%(19) "a protected propery"
+ ["myprotected":protected]=>
+ string(19) "a protected propery"
}
Using PDO::FETCH_CLASS|PDO::FETCH_SERIALIZE to fetch the object from DB and unserialize it...
myclass::unserialize('C:7:"myclass":19:{Data from serialize}')
object(myclass)#%d (1) {
- [%u|b%"myprotected":protected]=>
- %unicode|string%(19) "a protected propery"
+ ["myprotected":protected]=>
+ string(19) "a protected propery"
}
Using PDO::FETCH_CLASS to fetch the object from DB and unserialize it...
myclass::__set(myobj, 'C:7:"myclass":19:{Data from serialize}')
myclass::__construct(PDO shall call __construct())
object(myclass)#%d (2) {
- [%u|b%"myprotected":protected]=>
- %unicode|string%(19) "a protected propery"
- [%u|b%"myobj"]=>
- %unicode|string%(38) "C:7:"myclass":19:{Data from serialize}"
+ ["myprotected":protected]=>
+ string(19) "a protected propery"
+ ["myobj"]=>
+ string(38) "C:7:"myclass":19:{Data from serialize}"
}
done!
diff --git a/ext/pdo_mysql/tests/pdo_mysql_stmt_fetch_serialize_simple.phpt b/ext/pdo_mysql/tests/pdo_mysql_stmt_fetch_serialize_simple.phpt
index a935e1aca0..890c7b73cb 100644
--- a/ext/pdo_mysql/tests/pdo_mysql_stmt_fetch_serialize_simple.phpt
+++ b/ext/pdo_mysql/tests/pdo_mysql_stmt_fetch_serialize_simple.phpt
@@ -5,8 +5,6 @@ MySQL PDOStatement->fetch(), PDO::FETCH_SERIALIZE
require_once(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'skipif.inc');
require_once(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'mysql_pdo_test.inc');
MySQLPDOTest::skip();
-if (version_compare(PHP_VERSION, '5.1.0', '<'))
- die("skip Needs 5.1.0 and Interface Serializable");
?>
--FILE--
<?php
diff --git a/ext/pdo_mysql/tests/pdo_mysql_stmt_fetchobject.phpt b/ext/pdo_mysql/tests/pdo_mysql_stmt_fetchobject.phpt
index 2e278b1afb..e35f95a86f 100644
--- a/ext/pdo_mysql/tests/pdo_mysql_stmt_fetchobject.phpt
+++ b/ext/pdo_mysql/tests/pdo_mysql_stmt_fetchobject.phpt
@@ -97,13 +97,13 @@ myclass::__set(null, -NULL-) 3
myclass::__set(, -''-) 4
myclass::__construct(2, 3): 12 / 4
object(myclass)#%d (4) {
- [%u|b%"set_calls":"myclass":private]=>
+ ["set_calls":"myclass":private]=>
int(4)
- [%u|b%"grp":protected]=>
+ ["grp":protected]=>
NULL
- [%u|b%"id"]=>
- %unicode|string%(1) "3"
- [%u|b%"null"]=>
+ ["id"]=>
+ string(1) "3"
+ ["null"]=>
NULL
}
done!
diff --git a/ext/pdo_mysql/tests/pdo_mysql_stmt_multiquery.phpt b/ext/pdo_mysql/tests/pdo_mysql_stmt_multiquery.phpt
index db92e40a93..65989898fd 100644
--- a/ext/pdo_mysql/tests/pdo_mysql_stmt_multiquery.phpt
+++ b/ext/pdo_mysql/tests/pdo_mysql_stmt_multiquery.phpt
@@ -60,7 +60,7 @@ MySQLPDOTest::dropTestTable();
Emulated Prepared Statements...
array(3) {
[0]=>
- %unicode|string%(5) "00000"
+ string(5) "00000"
[1]=>
NULL
[2]=>
@@ -69,13 +69,13 @@ array(3) {
array(1) {
[0]=>
array(1) {
- [%u|b%"label"]=>
- %unicode|string%(1) "a"
+ ["label"]=>
+ string(1) "a"
}
}
array(3) {
[0]=>
- %unicode|string%(5) "00000"
+ string(5) "00000"
[1]=>
NULL
[2]=>
@@ -84,15 +84,15 @@ array(3) {
array(1) {
[0]=>
array(1) {
- [%u|b%"label"]=>
- %unicode|string%(1) "a"
+ ["label"]=>
+ string(1) "a"
}
}
array(1) {
[0]=>
array(1) {
- [%u|b%"label"]=>
- %unicode|string%(1) "a"
+ ["label"]=>
+ string(1) "a"
}
}
Native Prepared Statements...
diff --git a/ext/pdo_mysql/tests/pdo_mysql_stmt_nextrowset.phpt b/ext/pdo_mysql/tests/pdo_mysql_stmt_nextrowset.phpt
index 9165e70551..e971ce9513 100644
--- a/ext/pdo_mysql/tests/pdo_mysql_stmt_nextrowset.phpt
+++ b/ext/pdo_mysql/tests/pdo_mysql_stmt_nextrowset.phpt
@@ -118,98 +118,98 @@ Emulated PS...
array(1) {
[0]=>
array(1) {
- [%u|b%"_version"]=>
- %unicode|string%(%d) "%s"
+ ["_version"]=>
+ string(%d) "%s"
}
}
bool(false)
array(3) {
[0]=>
array(1) {
- [%u|b%"id"]=>
- %unicode|string%(1) "1"
+ ["id"]=>
+ string(1) "1"
}
[1]=>
array(1) {
- [%u|b%"id"]=>
- %unicode|string%(1) "2"
+ ["id"]=>
+ string(1) "2"
}
[2]=>
array(1) {
- [%u|b%"id"]=>
- %unicode|string%(1) "3"
+ ["id"]=>
+ string(1) "3"
}
}
array(3) {
[0]=>
array(2) {
- [%u|b%"id"]=>
- %unicode|string%(1) "3"
- [%u|b%"label"]=>
- %unicode|string%(1) "c"
+ ["id"]=>
+ string(1) "3"
+ ["label"]=>
+ string(1) "c"
}
[1]=>
array(2) {
- [%u|b%"id"]=>
- %unicode|string%(1) "2"
- [%u|b%"label"]=>
- %unicode|string%(1) "b"
+ ["id"]=>
+ string(1) "2"
+ ["label"]=>
+ string(1) "b"
}
[2]=>
array(2) {
- [%u|b%"id"]=>
- %unicode|string%(1) "1"
- [%u|b%"label"]=>
- %unicode|string%(1) "a"
+ ["id"]=>
+ string(1) "1"
+ ["label"]=>
+ string(1) "a"
}
}
bool(false)
array(1) {
[0]=>
array(1) {
- [%u|b%"_version"]=>
- %unicode|string%(%d) "%s"
+ ["_version"]=>
+ string(%d) "%s"
}
}
bool(false)
array(3) {
[0]=>
array(1) {
- [%u|b%"id"]=>
- %unicode|string%(1) "1"
+ ["id"]=>
+ string(1) "1"
}
[1]=>
array(1) {
- [%u|b%"id"]=>
- %unicode|string%(1) "2"
+ ["id"]=>
+ string(1) "2"
}
[2]=>
array(1) {
- [%u|b%"id"]=>
- %unicode|string%(1) "3"
+ ["id"]=>
+ string(1) "3"
}
}
array(3) {
[0]=>
array(2) {
- [%u|b%"id"]=>
- %unicode|string%(1) "3"
- [%u|b%"label"]=>
- %unicode|string%(1) "c"
+ ["id"]=>
+ string(1) "3"
+ ["label"]=>
+ string(1) "c"
}
[1]=>
array(2) {
- [%u|b%"id"]=>
- %unicode|string%(1) "2"
- [%u|b%"label"]=>
- %unicode|string%(1) "b"
+ ["id"]=>
+ string(1) "2"
+ ["label"]=>
+ string(1) "b"
}
[2]=>
array(2) {
- [%u|b%"id"]=>
- %unicode|string%(1) "1"
- [%u|b%"label"]=>
- %unicode|string%(1) "a"
+ ["id"]=>
+ string(1) "1"
+ ["label"]=>
+ string(1) "a"
}
}
bool(false)
@@ -217,98 +217,98 @@ Native PS...
array(1) {
[0]=>
array(1) {
- [%u|b%"_version"]=>
- %unicode|string%(%d) "%s"
+ ["_version"]=>
+ string(%d) "%s"
}
}
bool(false)
array(3) {
[0]=>
array(1) {
- [%u|b%"id"]=>
- %unicode|string%(1) "1"
+ ["id"]=>
+ string(1) "1"
}
[1]=>
array(1) {
- [%u|b%"id"]=>
- %unicode|string%(1) "2"
+ ["id"]=>
+ string(1) "2"
}
[2]=>
array(1) {
- [%u|b%"id"]=>
- %unicode|string%(1) "3"
+ ["id"]=>
+ string(1) "3"
}
}
array(3) {
[0]=>
array(2) {
- [%u|b%"id"]=>
- %unicode|string%(1) "3"
- [%u|b%"label"]=>
- %unicode|string%(1) "c"
+ ["id"]=>
+ string(1) "3"
+ ["label"]=>
+ string(1) "c"
}
[1]=>
array(2) {
- [%u|b%"id"]=>
- %unicode|string%(1) "2"
- [%u|b%"label"]=>
- %unicode|string%(1) "b"
+ ["id"]=>
+ string(1) "2"
+ ["label"]=>
+ string(1) "b"
}
[2]=>
array(2) {
- [%u|b%"id"]=>
- %unicode|string%(1) "1"
- [%u|b%"label"]=>
- %unicode|string%(1) "a"
+ ["id"]=>
+ string(1) "1"
+ ["label"]=>
+ string(1) "a"
}
}
bool(false)
array(1) {
[0]=>
array(1) {
- [%u|b%"_version"]=>
- %unicode|string%(%d) "%s"
+ ["_version"]=>
+ string(%d) "%s"
}
}
bool(false)
array(3) {
[0]=>
array(1) {
- [%u|b%"id"]=>
- %unicode|string%(1) "1"
+ ["id"]=>
+ string(1) "1"
}
[1]=>
array(1) {
- [%u|b%"id"]=>
- %unicode|string%(1) "2"
+ ["id"]=>
+ string(1) "2"
}
[2]=>
array(1) {
- [%u|b%"id"]=>
- %unicode|string%(1) "3"
+ ["id"]=>
+ string(1) "3"
}
}
array(3) {
[0]=>
array(2) {
- [%u|b%"id"]=>
- %unicode|string%(1) "3"
- [%u|b%"label"]=>
- %unicode|string%(1) "c"
+ ["id"]=>
+ string(1) "3"
+ ["label"]=>
+ string(1) "c"
}
[1]=>
array(2) {
- [%u|b%"id"]=>
- %unicode|string%(1) "2"
- [%u|b%"label"]=>
- %unicode|string%(1) "b"
+ ["id"]=>
+ string(1) "2"
+ ["label"]=>
+ string(1) "b"
}
[2]=>
array(2) {
- [%u|b%"id"]=>
- %unicode|string%(1) "1"
- [%u|b%"label"]=>
- %unicode|string%(1) "a"
+ ["id"]=>
+ string(1) "1"
+ ["label"]=>
+ string(1) "a"
}
}
bool(false)
diff --git a/ext/pdo_mysql/tests/pdo_mysql_stmt_unbuffered_2050.phpt b/ext/pdo_mysql/tests/pdo_mysql_stmt_unbuffered_2050.phpt
index f051403d82..4c4148d5bb 100644
--- a/ext/pdo_mysql/tests/pdo_mysql_stmt_unbuffered_2050.phpt
+++ b/ext/pdo_mysql/tests/pdo_mysql_stmt_unbuffered_2050.phpt
@@ -121,19 +121,19 @@ Buffered...
array(1) {
[0]=>
array(2) {
- [%u|b%"id"]=>
- %unicode|string%(1) "1"
- [%u|b%"label"]=>
- %unicode|string%(1) "a"
+ ["id"]=>
+ string(1) "1"
+ ["label"]=>
+ string(1) "a"
}
}
array(1) {
[0]=>
array(2) {
- [%u|b%"id"]=>
- %unicode|string%(1) "1"
- [%u|b%"label"]=>
- %unicode|string%(1) "a"
+ ["id"]=>
+ string(1) "1"
+ ["label"]=>
+ string(1) "a"
}
}
Unbuffered...
@@ -148,37 +148,37 @@ array(0) {
array(1) {
[0]=>
array(2) {
- [%u|b%"id"]=>
- %unicode|string%(1) "1"
- [%u|b%"label"]=>
- %unicode|string%(1) "a"
+ ["id"]=>
+ string(1) "1"
+ ["label"]=>
+ string(1) "a"
}
}
array(1) {
[0]=>
array(2) {
- [%u|b%"id"]=>
- %unicode|string%(1) "1"
- [%u|b%"label"]=>
- %unicode|string%(1) "a"
+ ["id"]=>
+ string(1) "1"
+ ["label"]=>
+ string(1) "a"
}
}
array(1) {
[0]=>
array(2) {
- [%u|b%"id"]=>
- %unicode|string%(1) "1"
- [%u|b%"label"]=>
- %unicode|string%(1) "a"
+ ["id"]=>
+ string(1) "1"
+ ["label"]=>
+ string(1) "a"
}
}
array(1) {
[0]=>
array(2) {
- [%u|b%"id"]=>
- %unicode|string%(1) "1"
- [%u|b%"label"]=>
- %unicode|string%(1) "a"
+ ["id"]=>
+ string(1) "1"
+ ["label"]=>
+ string(1) "a"
}
}
done! \ No newline at end of file
diff --git a/ext/pdo_mysql/tests/pdo_mysql_subclass.phpt b/ext/pdo_mysql/tests/pdo_mysql_subclass.phpt
index 3595631f04..773537b12c 100644
--- a/ext/pdo_mysql/tests/pdo_mysql_subclass.phpt
+++ b/ext/pdo_mysql/tests/pdo_mysql_subclass.phpt
@@ -5,8 +5,6 @@ MySQL PDOStatement->execute()/fetch(), Non-SELECT
require_once(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'skipif.inc');
require_once(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'mysql_pdo_test.inc');
MySQLPDOTest::skip();
-if (version_compare(PHP_VERSION, '5.0.0', '<'))
- die("skip Requires PHP 5.0+");
?>
--FILE--
<?php
@@ -89,13 +87,13 @@ query('SELECT * FROM test ORDER BY id ASC')
array(2) {
[0]=>
array(1) {
- [%u|b%"id"]=>
- %unicode|string%(1) "1"
+ ["id"]=>
+ string(1) "1"
}
[1]=>
array(1) {
- [%u|b%"id"]=>
- %unicode|string%(1) "2"
+ ["id"]=>
+ string(1) "2"
}
}
bool(false)
diff --git a/ext/pdo_mysql/tests/pecl_bug_5780.phpt b/ext/pdo_mysql/tests/pecl_bug_5780.phpt
index 59842846d3..3f3bf966b9 100644
--- a/ext/pdo_mysql/tests/pecl_bug_5780.phpt
+++ b/ext/pdo_mysql/tests/pecl_bug_5780.phpt
@@ -36,14 +36,14 @@ $db->exec('DROP TABLE IF EXISTS test2');
--EXPECTF--
array(2) {
[0]=>
- %unicode|string%(7) "testing"
+ string(7) "testing"
[1]=>
- %unicode|string%(7) "testing"
+ string(7) "testing"
}
bool(true)
array(2) {
[0]=>
- %unicode|string%(5) "00000"
+ string(5) "00000"
[1]=>
NULL
}
diff --git a/ext/pdo_mysql/tests/pecl_bug_5802.phpt b/ext/pdo_mysql/tests/pecl_bug_5802.phpt
index 04aa2c9552..088b4ed5e1 100644
--- a/ext/pdo_mysql/tests/pecl_bug_5802.phpt
+++ b/ext/pdo_mysql/tests/pecl_bug_5802.phpt
@@ -44,18 +44,18 @@ $db->exec('DROP TABLE IF EXISTS test');
array(3) {
[0]=>
array(1) {
- [%u|b%"bar"]=>
- %unicode|string%(3) "foo"
+ ["bar"]=>
+ string(3) "foo"
}
[1]=>
array(1) {
- [%u|b%"bar"]=>
+ ["bar"]=>
NULL
}
[2]=>
array(1) {
- [%u|b%"bar"]=>
- %unicode|string%(3) "qaz"
+ ["bar"]=>
+ string(3) "qaz"
}
}
done! \ No newline at end of file
diff --git a/ext/pdo_mysql/tests/skipif.inc b/ext/pdo_mysql/tests/skipif.inc
index d48670aec6..e503f55b3c 100644
--- a/ext/pdo_mysql/tests/skipif.inc
+++ b/ext/pdo_mysql/tests/skipif.inc
@@ -1,7 +1,3 @@
<?php
if (!extension_loaded('pdo') || !extension_loaded('pdo_mysql'))
die('skip PDO_MySQL driver not loaded');
-
-if (version_compare(PHP_VERSION, '5.1.0') < 0)
- die('skip Most tests assume PHP 5.1+');
-?> \ No newline at end of file