svn: /php/php-src/ branches/PHP_5_3/ext/mysqlnd/mysqlnd_wireprotocol.c trunk/ext/mysqlnd/mysqlnd_wireprotocol.c
| From: | Andrey Hristov | Date: | Thu, 08 Apr 2010 13:20:37 +0000 |
| Subject: | svn: /php/php-src/ branches/PHP_5_3/ext/mysqlnd/mysqlnd_wireprotocol.c trunk/ext/mysqlnd/mysqlnd_wireprotocol.c | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-62224@lists.php.net to get a copy of this message | ||
andrey Thu, 08 Apr 2010 13:20:37 +0000
Revision: http://svn.php.net/viewvc?view=revision&revision=297701
Log:
Fixint INT_AND_FLOAT_AS native. It was working ok on 64bit but
because on 32bit SIZEOF_LONG is 4 and INT64 from MySQL is 8 everything
was converted to string, even if it was able to put it in a long.
This closes Request #50651 Native type cast returns wrong result
Bug: http://bugs.php.net/50651 (Assigned) Native type cast
returns wrong result
Changed paths:
U php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_wireprotocol.c
U php/php-src/trunk/ext/mysqlnd/mysqlnd_wireprotocol.c
Modified: php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_wireprotocol.c
===================================================================
--- php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_wireprotocol.c 2010-04-08 13:18:52 UTC (rev
297700)
+++ php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_wireprotocol.c 2010-04-08 13:20:37 UTC (rev
297701)
@@ -1273,14 +1273,11 @@
}
#ifdef MYSQLND_STRING_TO_INT_CONVERSION
- if (as_int_or_float && perm_bind.php_type == IS_LONG &&
- perm_bind.pack_len <= SIZEOF_LONG)
- {
+ if (as_int_or_float && perm_bind.php_type == IS_LONG) {
zend_uchar save = *(p + len);
/* We have to make it ASCIIZ temporarily */
*(p + len) = '\0';
- if (perm_bind.pack_len < SIZEOF_LONG)
- {
+ if (perm_bind.pack_len < SIZEOF_LONG) {
/* direct conversion */
int64_t v =
#ifndef PHP_WIN32
@@ -1304,6 +1301,8 @@
if ((uns == TRUE && v > L64(2147483647)) ||
(uns == FALSE && (( L64(2147483647) < (int64_t) v) ||
(L64(-2147483648) > (int64_t) v))))
+#else
+#error Need fix for this architecture
#endif /* SIZEOF */
{
ZVAL_STRINGL(*current_field, (char *)p, len, 0);
Modified: php/php-src/trunk/ext/mysqlnd/mysqlnd_wireprotocol.c
===================================================================
--- php/php-src/trunk/ext/mysqlnd/mysqlnd_wireprotocol.c 2010-04-08 13:18:52 UTC (rev 297700)
+++ php/php-src/trunk/ext/mysqlnd/mysqlnd_wireprotocol.c 2010-04-08 13:20:37 UTC (rev 297701)
@@ -1273,14 +1273,11 @@
}
#ifdef MYSQLND_STRING_TO_INT_CONVERSION
- if (as_int_or_float && perm_bind.php_type == IS_LONG &&
- perm_bind.pack_len <= SIZEOF_LONG)
- {
+ if (as_int_or_float && perm_bind.php_type == IS_LONG) {
zend_uchar save = *(p + len);
/* We have to make it ASCIIZ temporarily */
*(p + len) = '\0';
- if (perm_bind.pack_len < SIZEOF_LONG)
- {
+ if (perm_bind.pack_len < SIZEOF_LONG) {
/* direct conversion */
int64_t v =
#ifndef PHP_WIN32
@@ -1304,6 +1301,8 @@
if ((uns == TRUE && v > L64(2147483647)) ||
(uns == FALSE && (( L64(2147483647) < (int64_t) v) ||
(L64(-2147483648) > (int64_t) v))))
+#else
+#error Need fix for this architecture
#endif /* SIZEOF */
{
ZVAL_STRINGL(*current_field, (char *)p, len, 0);