php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #44351 PHP 5.2.6RC1 mysqli fails to build with mysql 5.1.23, gcc 4.3.0
Submitted: 2008-03-06 16:59 UTC Modified: 2008-03-07 13:09 UTC
Votes:2
Avg. Score:4.0 ± 1.0
Reproduced:2 of 2 (100.0%)
Same Version:2 (100.0%)
Same OS:1 (50.0%)
From: bero at arklinux dot org Assigned:
Status: Wont fix Package: Compile Failure
PHP Version: 5.2.6RC1 OS: Ark Linux
Private report: No CVE-ID: None
Have you experienced this issue?
Rate the importance of this bug to you:

 [2008-03-06 16:59 UTC] bero at arklinux dot org
Description:
------------
/usr/src/ark/BUILD/php-5.2.6RC1/ext/mysqli/mysqli_api.c: In function
'zif_mysqli_change_user':
/usr/src/ark/BUILD/php-5.2.6RC1/ext/mysqli/mysqli_api.c:420: error:
'NET' has no member named 'last_errno'
/usr/src/ark/BUILD/php-5.2.6RC1/ext/mysqli/mysqli_api.c:420: error:
'NET' has no member named 'last_errno'
/usr/src/ark/BUILD/php-5.2.6RC1/ext/mysqli/mysqli_api.c:420: error:
'NET' has no member named 'last_error'
/usr/src/ark/BUILD/php-5.2.6RC1/ext/mysqli/mysqli_api.c: In function
'zif_mysqli_kill':
/usr/src/ark/BUILD/php-5.2.6RC1/ext/mysqli/mysqli_api.c:1152: error:
'NET' has no member named 'last_errno'
/usr/src/ark/BUILD/php-5.2.6RC1/ext/mysqli/mysqli_api.c:1152: error:
'NET' has no member named 'last_errno'
/usr/src/ark/BUILD/php-5.2.6RC1/ext/mysqli/mysqli_api.c:1152: error:
'NET' has no member named 'last_error'
/usr/src/ark/BUILD/php-5.2.6RC1/ext/mysqli/mysqli_api.c: In function
'zif_mysqli_ping':
/usr/src/ark/BUILD/php-5.2.6RC1/ext/mysqli/mysqli_api.c:1333: error:
'NET' has no member named 'last_errno'
/usr/src/ark/BUILD/php-5.2.6RC1/ext/mysqli/mysqli_api.c:1333: error:
'NET' has no member named 'last_errno'
/usr/src/ark/BUILD/php-5.2.6RC1/ext/mysqli/mysqli_api.c:1333: error:
'NET' has no member named 'last_error'
/usr/src/ark/BUILD/php-5.2.6RC1/ext/mysqli/mysqli_api.c: In function
'zif_mysqli_prepare':
/usr/src/ark/BUILD/php-5.2.6RC1/ext/mysqli/mysqli_api.c:1376: error:
'NET' has no member named 'last_errno'
/usr/src/ark/BUILD/php-5.2.6RC1/ext/mysqli/mysqli_api.c:1377: error:
'NET' has no member named 'last_error'
/usr/src/ark/BUILD/php-5.2.6RC1/ext/mysqli/mysqli_api.c:1383: error:
'NET' has no member named 'last_errno'
/usr/src/ark/BUILD/php-5.2.6RC1/ext/mysqli/mysqli_api.c:1383: error:
'NET' has no member named 'last_errno'
/usr/src/ark/BUILD/php-5.2.6RC1/ext/mysqli/mysqli_api.c:1383: error:
'NET' has no member named 'last_error'
/usr/src/ark/BUILD/php-5.2.6RC1/ext/mysqli/mysqli_api.c: In function
'zif_mysqli_real_connect':
/usr/src/ark/BUILD/php-5.2.6RC1/ext/mysqli/mysqli_api.c:1456: error:
'NET' has no member named 'last_errno'
/usr/src/ark/BUILD/php-5.2.6RC1/ext/mysqli/mysqli_api.c:1457: error:
'NET' has no member named 'last_error'
/usr/src/ark/BUILD/php-5.2.6RC1/ext/mysqli/mysqli_api.c: In function
'zif_mysqli_real_query':
/usr/src/ark/BUILD/php-5.2.6RC1/ext/mysqli/mysqli_api.c:1495: error:
'NET' has no member named 'last_errno'
/usr/src/ark/BUILD/php-5.2.6RC1/ext/mysqli/mysqli_api.c:1495: error:
'NET' has no member named 'last_errno'
/usr/src/ark/BUILD/php-5.2.6RC1/ext/mysqli/mysqli_api.c:1495: error:
'NET' has no member named 'last_error'
/usr/src/ark/BUILD/php-5.2.6RC1/ext/mysqli/mysqli_api.c: In function
'zif_mysqli_select_db':
/usr/src/ark/BUILD/php-5.2.6RC1/ext/mysqli/mysqli_api.c:1764: error:
'NET' has no member named 'last_errno'
/usr/src/ark/BUILD/php-5.2.6RC1/ext/mysqli/mysqli_api.c:1764: error:
'NET' has no member named 'last_errno'
/usr/src/ark/BUILD/php-5.2.6RC1/ext/mysqli/mysqli_api.c:1764: error:
'NET' has no member named 'last_error'
/usr/src/ark/BUILD/php-5.2.6RC1/ext/mysqli/mysqli_api.c: In function
'zif_mysqli_store_result':
/usr/src/ark/BUILD/php-5.2.6RC1/ext/mysqli/mysqli_api.c:2061: error:
'NET' has no member named 'last_errno'
/usr/src/ark/BUILD/php-5.2.6RC1/ext/mysqli/mysqli_api.c:2061: error:
'NET' has no member named 'last_errno'
/usr/src/ark/BUILD/php-5.2.6RC1/ext/mysqli/mysqli_api.c:2061: error:
'NET' has no member named 'last_error'
/usr/src/ark/BUILD/php-5.2.6RC1/ext/mysqli/mysqli_api.c: In function
'zif_mysqli_use_result':
/usr/src/ark/BUILD/php-5.2.6RC1/ext/mysqli/mysqli_api.c:2115: error:
'NET' has no member named 'last_errno'
/usr/src/ark/BUILD/php-5.2.6RC1/ext/mysqli/mysqli_api.c:2115: error:
'NET' has no member named 'last_errno'
/usr/src/ark/BUILD/php-5.2.6RC1/ext/mysqli/mysqli_api.c:2115: error:
'NET' has no member named 'last_error'



Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2008-03-06 17:22 UTC] bero at arklinux dot org
last_error and last_errno have been renamed to client_last_error and client_last_errno respectively in current mysql 5.1.x builds, causing this.

Here's a fix:

--- php-5.2.6RC1/ext/mysqli/mysqli_api.c.ark    2008-03-06 17:47:10.000000000 +0000
+++ php-5.2.6RC1/ext/mysqli/mysqli_api.c        2008-03-06 17:57:43.000000000 +0000
@@ -1373,8 +1373,13 @@
                        stmt->stmt = NULL;

                        /* restore error messages */
+#if MYSQL_VERSION_ID >= 50123
+                       mysql->mysql->net.client_last_errno = last_errno;
+                       memcpy(mysql->mysql->net.client_last_error, last_error, MYSQL_ERRMSG_SIZE);
+#else
                        mysql->mysql->net.last_errno = last_errno;
                        memcpy(mysql->mysql->net.last_error, last_error, MYSQL_ERRMSG_SIZE);
+#endif
                        memcpy(mysql->mysql->net.sqlstate, sqlstate, SQLSTATE_LENGTH+1);
                }
        }
@@ -1453,8 +1458,13 @@

        if (mysql_real_connect(mysql->mysql,hostname,username,passwd,dbname,port,socket,flags) == NULL) {
                php_mysqli_set_error(mysql_errno(mysql->mysql), (char *) mysql_error(mysql->mysql) TSRMLS_CC);
+#if MYSQL_VERSION_ID >= 50123
+               php_mysqli_throw_sql_exception( mysql->mysql->net.sqlstate, mysql->mysql->net.client_last_errno TSRMLS_CC,
+                                                                               "%s", mysql->mysql->net.client_last_error);
+#else
                php_mysqli_throw_sql_exception( mysql->mysql->net.sqlstate, mysql->mysql->net.last_errno TSRMLS_CC,
                                                                                "%s", mysql->mysql->net.last_error);
+#endif

                /* change status */
                MYSQLI_SET_STATUS(&mysql_link, MYSQLI_STATUS_INITIALIZED);
--- php-5.2.6RC1/ext/mysqli/mysqli_nonapi.c.ark 2008-03-06 17:58:00.000000000 +0000
+++ php-5.2.6RC1/ext/mysqli/mysqli_nonapi.c     2008-03-06 17:59:37.000000000 +0000
@@ -106,8 +106,13 @@
        if (mysql_real_connect(mysql->mysql,hostname,username,passwd,dbname,port,socket,CLIENT_MULTI_RESULTS) == NULL) {
                /* Save error messages */

+#if MYSQL_VERSION_ID >= 50123
+               php_mysqli_throw_sql_exception( mysql->mysql->net.sqlstate, mysql->mysql->net.client_last_errno TSRMLS_CC,
+                                                                               "%s", mysql->mysql->net.client_last_error);
+#else
                php_mysqli_throw_sql_exception( mysql->mysql->net.sqlstate, mysql->mysql->net.last_errno TSRMLS_CC,
                                                                                "%s", mysql->mysql->net.last_error);
+#endif

                php_mysqli_set_error(mysql_errno(mysql->mysql), (char *) mysql_error(mysql->mysql) TSRMLS_CC);

@@ -212,9 +217,14 @@
                MYSQLI_DISABLE_MQ;

                /* restore error information */
+#if MYSQL_VERSION_ID >= 50123
+               strcpy(mysql->mysql->net.client_last_error, s_error);
+               mysql->mysql->net.client_last_errno = s_errno;
+#else
                strcpy(mysql->mysql->net.last_error, s_error);
-               strcpy(mysql->mysql->net.sqlstate, s_sqlstate);
                mysql->mysql->net.last_errno = s_errno;
+#endif
+               strcpy(mysql->mysql->net.sqlstate, s_sqlstate);

                RETURN_FALSE;
        }
@@ -266,8 +276,13 @@
        result = (resultmode == MYSQLI_USE_RESULT) ? mysql_use_result(mysql->mysql) : mysql_store_result(mysql->mysql);

        if (!result) {
+#if MYSQL_VERSION_ID >= 50123
+               php_mysqli_throw_sql_exception(mysql->mysql->net.sqlstate, mysql->mysql->net.client_last_errno TSRMLS_CC,
+                                                                               "%s", mysql->mysql->net.client_last_error);
+#else
                php_mysqli_throw_sql_exception(mysql->mysql->net.sqlstate, mysql->mysql->net.last_errno TSRMLS_CC,
                                                                                "%s", mysql->mysql->net.last_error);
+#endif
                RETURN_FALSE;
        }

--- php-5.2.6RC1/ext/mysqli/php_mysqli.h.ark    2008-03-06 17:53:55.000000000 +0000
+++ php-5.2.6RC1/ext/mysqli/php_mysqli.h        2008-03-06 17:55:42.000000000 +0000
@@ -291,10 +291,17 @@
 #define MYSQLI_REPORT_CLOSE                    8
 #define MYSQLI_REPORT_ALL                255

+#if MYSQL_VERSION_ID >= 50123
+#define MYSQLI_REPORT_MYSQL_ERROR(mysql) \
+if ((MyG(report_mode) & MYSQLI_REPORT_ERROR) && mysql->net.client_last_errno) { \
+       php_mysqli_report_error(mysql->net.sqlstate, mysql->net.client_last_errno, mysql->net.client_last_error TSRMLS_CC); \
+}
+#else
 #define MYSQLI_REPORT_MYSQL_ERROR(mysql) \
 if ((MyG(report_mode) & MYSQLI_REPORT_ERROR) && mysql->net.last_errno) { \
        php_mysqli_report_error(mysql->net.sqlstate, mysql->net.last_errno, mysql->net.last_error TSRMLS_CC); \
 }
+#endif

 #define MYSQLI_REPORT_STMT_ERROR(stmt) \
 if ((MyG(report_mode) & MYSQLI_REPORT_ERROR) && stmt->last_errno) { \
 [2008-03-07 13:07 UTC] uw@php.net
Don't patch PHP, http://bugs.mysql.com/bug.php?id=34655 . The change on MySQL side has been reverted.
 [2008-03-07 13:09 UTC] uw@php.net
Forgot to say: please try again with the very latest version of MySQL - thanks!

Ulf
 
PHP Copyright © 2001-2020 The PHP Group
All rights reserved.
Last updated: Mon Feb 24 12:01:25 2020 UTC