Skip to content

ext/mysqli/tests/bug34810.phpt test failing with mariadb-11.4 #13628

Closed

Description

@grooverdan

Description

The following code:

ext/mysqli/tests/bug34810.phpt

Resulted in this output:

TEST 1/1 [/home/dan/repos/php-src/ext/mysqli/tests/bug34810.phpt]
========DIFF========
--
       ["host_info"]=>
       string(%d) "%s"
       ["info"]=>
024+   string(65) "D750C8D0425D5C3268B77DCF5C2A60F50DD8A5B54B1EEC22EDFF2E75502C80A3"
024-   NULL
       ["insert_id"]=>
       int(0)
       ["server_info"]=>
--
========DONE========
FAIL Bug #34810 (mysqli::init() and others use wrong $this pointer without checks) [/home/dan/repos/php-src/ext/mysqli/tests/bug34810.phpt] 

But I expected this output instead:

PASS

The string here is the data from authentication (from different test run, but did validate this as the same data returned by link_info_read:

Hardware watchpoint 3: -location conn->last_message

Old value = {s = 0x7fc3be202870 "\001515D962E3470F0D1667A60762D0BA979C4BFCA9EBB79C1B1A7E2614A3D1A3C65", l = 0}
New value = {s = 0x7fc3be202870 "\001515D962E3470F0D1667A60762D0BA979C4BFCA9EBB79C1B1A7E2614A3D1A3C65", l = 65}
0x00000000008448b6 in mysqlnd_set_string (buf=<optimized out>, string=0x7fc3be202500 "\001515D962E3470F0D1667A60762D0BA979C4BFCA9EBB79C1B1A7E2614A3D1A3C65", len=65)
    at /home/dan/repos/php-src/ext/mysqlnd/mysqlnd_alloc.h:82
82			buf->l = len;
(rr) bt
#0  0x00000000008448b6 in mysqlnd_set_string (buf=<optimized out>, string=0x7fc3be202500 "\001515D962E3470F0D1667A60762D0BA979C4BFCA9EBB79C1B1A7E2614A3D1A3C65", len=65)
    at /home/dan/repos/php-src/ext/mysqlnd/mysqlnd_alloc.h:82
#1  mysqlnd_auth_handshake (conn=conn@entry=0x7fc3be277a00, user=<optimized out>, passwd=0x7fc3be291dd8 "letmein", passwd_len=<optimized out>, db=<optimized out>, db_len=<optimized out>, 
    session_options=<optimized out>, mysql_flags=<optimized out>, server_charset_no=<optimized out>, use_full_blown_auth_packet=<optimized out>, auth_protocol=<optimized out>, 
    auth_plugin=<optimized out>, orig_auth_plugin_data=<optimized out>, orig_auth_plugin_data_len=<optimized out>, auth_plugin_data=<optimized out>, auth_plugin_data_len=<optimized out>, 
    switch_to_auth_protocol=<optimized out>, switch_to_auth_protocol_len=<optimized out>, switch_to_auth_protocol_data=<optimized out>, switch_to_auth_protocol_data_len=<optimized out>)
    at /home/dan/repos/php-src/ext/mysqlnd/mysqlnd_auth.c:353
#2  0x000000000084448f in mysqlnd_run_authentication (conn=conn@entry=0x7fc3be277a00, user=<optimized out>, user@entry=0x7fc3be291eb8 "root", passwd=<optimized out>, 
    passwd@entry=0x7fc3be291dd8 "letmein", passwd_len=<optimized out>, passwd_len@entry=7, db=<optimized out>, db@entry=0x7fc3be291d38 "test", db_len=<optimized out>, db_len@entry=4, 
    auth_plugin_data={s = 0x7fc3be25f090 "42>!(Fi^xbcK+3`jr\"NA", l = 21}, auth_protocol=<optimized out>, charset_no=<optimized out>, session_options=<optimized out>, 
    mysql_flags=<optimized out>, silent=<optimized out>, is_change_user=<optimized out>) at /home/dan/repos/php-src/ext/mysqlnd/mysqlnd_auth.c:121
#3  0x000000000084505b in mysqlnd_connect_run_authentication (conn=conn@entry=0x7fc3be277a00, user=user@entry=0x7fc3be291eb8 "root", passwd=passwd@entry=0x7fc3be291dd8 "letmein", 
    db=db@entry=0x7fc3be291d38 "test", db_len=db_len@entry=4, passwd_len=passwd_len@entry=7, authentication_plugin_data={s = 0x7fc3be25f090 "42>!(Fi^xbcK+3`jr\"NA", l = 21}, 
    authentication_protocol=0x7fc3be25f0c0 "mysql_native_password", charset_no=8, server_capabilities=2181038078, session_options=0x7fc3be277da8, mysql_flags=1745549)
    at /home/dan/repos/php-src/ext/mysqlnd/mysqlnd_auth.c:222
#4  0x0000000000849219 in mysqlnd_mysqlnd_command_handshake_pub (conn=0x7fc3be277a00, username={s = 0x7fc3be291eb8 "root", l = <optimized out>}, 
    password={s = 0x7fc3be291dd8 "letmein", l = 7}, database={s = 0x7fc3be291d38 "test", l = 4}, client_flags=1745549) at /home/dan/repos/php-src/ext/mysqlnd/mysqlnd_commands.c:656
#5  0x000000000083b5e3 in mysqlnd_mysqlnd_conn_data_connect_handshake_pub (conn=0x7fc3be277a00, scheme=<optimized out>, username=0x7ffd9e47dc70, password=0x7ffd9e47dcd0, 
    database=0x7ffd9e47dce0, mysql_flags=1745549) at /home/dan/repos/php-src/ext/mysqlnd/mysqlnd_connection.c:510
#6  0x0000000000839336 in mysqlnd_mysqlnd_conn_data_connect_pub (conn=0x7fc3be277a00, hostname={s = 0x7fc3be201e50 "localhost", l = 9}, username={s = 0x7fc3be291eb8 "root", l = 4}, 
    password={s = 0x7fc3be291dd8 "letmein", l = 7}, database={s = 0x7fc3be291d38 "test", l = 4}, port=3306, socket_or_pipe={s = 0x7fc3be290108 "/tmp/mysql.sock", l = 15}, 
    mysql_flags=1745549) at /home/dan/repos/php-src/ext/mysqlnd/mysqlnd_connection.c:638
#7  0x000000000083c220 in mysqlnd_connection_connect (conn_handle=0x7fc3be204498, host=0x7fc3be201e50 "localhost", user=<optimized out>, passwd=0x7fc3be291dd8 "letmein", 
    passwd_len=<optimized out>, db=<optimized out>, db_len=4, port=3306, sock_or_pipe=0x7fc3be290108 "/tmp/mysql.sock", mysql_flags=131072, client_api_flags=0)
    at /home/dan/repos/php-src/ext/mysqlnd/mysqlnd_connection.c:2327
#8  0x000000000072f8c5 in mysqli_common_connect (execute_data=<optimized out>, return_value=<optimized out>, is_real_connect=<optimized out>, in_ctor=<optimized out>)
    at /home/dan/repos/php-src/ext/mysqli/mysqli_nonapi.c:253
#9  0x000000000090a43f in ZEND_DO_ICALL_SPEC_RETVAL_USED_HANDLER (execute_data=0x7fc3be215390) at /home/dan/repos/php-src/Zend/zend_vm_execute.h:1312
#10 0x00000000008d6748 in execute_ex (ex=<optimized out>) at /home/dan/repos/php-src/Zend/zend_vm_execute.h:55866
#11 0x00000000008d6903 in zend_execute (op_array=0x7fc3be297000, return_value=<optimized out>) at /home/dan/repos/php-src/Zend/zend_vm_execute.h:60439
#12 0x00000000008b57ed in zend_execute_scripts (type=type@entry=8, retval=retval@entry=0x0, file_count=file_count@entry=3) at /home/dan/repos/php-src/Zend/zend.c:1840
#13 0x00000000008506a5 in php_execute_script (primary_file=primary_file@entry=0x7ffd9e480310) at /home/dan/repos/php-src/main/main.c:2557
#14 0x0000000000993f4d in do_cli (argc=71, argv=0x2b94d90) at /home/dan/repos/php-src/sapi/cli/php_cli.c:964
#15 0x0000000000992d1f in main (argc=71, argv=0x2b94d90) at /home/dan/repos/php-src/sapi/cli/php_cli.c:1333

PHP Version

PHP-8.2-e3f0d03452c78121d3b9e7ca82cce186f0b7ca29

Operating System

No response

Activity

  1. SakiTakamachi commented on Mar 9, 2024

    @SakiTakamachi
    Member

    @grooverdan
    I have verified this issue.

    • This does not occur with MariaDB11.3.2, occurs after 11.4
    • This problem occurs even if the php version is not 8.2

    After doing some research, I discovered that the information contained in MariaDB's auth response packet has changed since 11.4.

    OK_packet info did not contain any information until 11.3.2, but after 11.4 it contains a message like the one you wrote.
    https://dev.mysql.com/doc/dev/mysql-server/latest/page_protocol_basic_ok_packet.html

    Therefore, this issue is due to a specification change in MariaDB. However, I'm not sure if this is an intended change or a side effect of something.

    IMHO, OK_Packet info is described as "human readable status information", and the message returned by MariaDB is incomprehensible to humans, so I don't think this is an intended specification change.

  2. SakiTakamachi commented on Mar 9, 2024

    @SakiTakamachi
    Member

    I asked MariaDB team about this.
    https://jira.mariadb.org/browse/MDEV-33639

  3. SakiTakamachi commented on Mar 12, 2024

    @SakiTakamachi
    Member

    I got a response and was able to understand what was going on. This string is the SSL certificate verification signature and is included in the first OK_Packet after connection when enable SSL in MariaDB.
    SSL has been enabled by default since 11.4, so perhaps this is the first time we've seen it and we're confused.

    I think a little about what to do about failed tests. IMHO, we might want to stop checking info messages with EXPECT.

  4. grooverdan commented on Mar 13, 2024

    @grooverdan
    ContributorAuthor

    Yep, given the 34810 test has little to do with info omitting sounds good.
    An 8.2 bug fix would be just to remove the line ext/mysqlnd/mysqlnd_auth.c : 353 (which cleanly fixes the test at the same time).

    How do you feel about the PHP master getting the SSL certificate validation by default?

  5. SakiTakamachi commented on Mar 15, 2024

    @SakiTakamachi
    Member

    IMHO, this problem is simply due to differences in the specifications of MySQL and MariaDB. Therefore, we should not consider this a bug.

    I think just fixing the test will solve the problem.

  6. added a commit that references this issue on Mar 15, 2024
    23eb6a0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions