summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIlia Alshanetsky <iliaa@php.net>2008-03-04 19:39:08 +0000
committerIlia Alshanetsky <iliaa@php.net>2008-03-04 19:39:08 +0000
commitc36af9e2b5e2d9a41f35902d1a71cd2626943904 (patch)
tree9990b4dd15b78f8acbcdae198a403fdcac342a46
parent6d48ddaf8f46cc9a90f47753400cbe7fdde78f62 (diff)
downloadphp-git-c36af9e2b5e2d9a41f35902d1a71cd2626943904.tar.gz
MFB: Fixed bug #44325 (mssql_bind not correctly bind empty strings as
parameter value)
-rw-r--r--NEWS2
-rw-r--r--ext/mssql/php_mssql.c15
2 files changed, 12 insertions, 5 deletions
diff --git a/NEWS b/NEWS
index e8f50f2703..a2590d7718 100644
--- a/NEWS
+++ b/NEWS
@@ -1,6 +1,8 @@
PHP NEWS
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
?? Mar 2008, PHP 5.2.6
+- Fixed bug #44325 (mssql_bind not correctly bind empty strings as parameter
+ value). (Ilia)
- Fixed bug #44306 (Better detection of MIPS processors on Windows). (Ilia)
- Fixed bug #44166 (Parameter handling flaw in PDO::getAvailableDrivers()).
(Ilia)
diff --git a/ext/mssql/php_mssql.c b/ext/mssql/php_mssql.c
index c91b98d7dd..7ad75912f2 100644
--- a/ext/mssql/php_mssql.c
+++ b/ext/mssql/php_mssql.c
@@ -2063,14 +2063,19 @@ PHP_FUNCTION(mssql_bind)
/* modify datalen and maxlen according to dbrpcparam documentation */
if ( (type==SQLVARCHAR) || (type==SQLCHAR) || (type==SQLTEXT) ) { /* variable-length type */
- if (is_null) {
+ if (is_null || Z_TYPE_PP(var) == IS_NULL) {
maxlen=0;
datalen=0;
- }
- else {
+ } else {
convert_to_string_ex(var);
- datalen=Z_STRLEN_PP(var);
- value=(LPBYTE)Z_STRVAL_PP(var);
+ datalen = Z_STRLEN_PP(var);
+ value = (LPBYTE)Z_STRVAL_PP(var);
+ if (!datalen) {
+ datalen = 1;
+ if (maxlen == -1) {
+ maxlen = 1;
+ }
+ }
}
}
else { /* fixed-length type */