@@ -2178,20 +2178,25 @@ php_mysqlnd_cached_sha2_result_read(MYSQLND_CONN_DATA * conn, void * _packet)
2178
2178
zend_uchar buf [SHA256_PK_REQUEST_RESP_BUFFER_SIZE ];
2179
2179
zend_uchar * p = buf ;
2180
2180
const zend_uchar * const begin = buf ;
2181
- uint8_t main_response_code ;
2182
2181
2183
2182
DBG_ENTER ("php_mysqlnd_cached_sha2_result_read" );
2184
2183
if (FAIL == mysqlnd_read_packet_header_and_body (& (packet -> header ), pfc , vio , stats , error_info , connection_state , buf , sizeof (buf ), "PROT_CACHED_SHA2_RESULT_PACKET" , PROT_CACHED_SHA2_RESULT_PACKET )) {
2185
2184
DBG_RETURN (FAIL );
2186
2185
}
2187
2186
BAIL_IF_NO_MORE_DATA ;
2188
2187
2189
- main_response_code = uint1korr (p );
2188
+ packet -> response_code = uint1korr (p );
2190
2189
p ++ ;
2191
2190
BAIL_IF_NO_MORE_DATA ;
2192
2191
2193
- if (0xFE == main_response_code ) {
2194
- packet -> response_code = main_response_code ;
2192
+ if (ERROR_MARKER == packet -> response_code ) {
2193
+ php_mysqlnd_read_error_from_line (p , packet -> header .size - 1 ,
2194
+ packet -> error , sizeof (packet -> error ),
2195
+ & packet -> error_no , packet -> sqlstate
2196
+ );
2197
+ DBG_RETURN (PASS );
2198
+ }
2199
+ if (0xFE == packet -> response_code ) {
2195
2200
/* Authentication Switch Response */
2196
2201
if (packet -> header .size > (size_t ) (p - buf )) {
2197
2202
packet -> new_auth_protocol = mnd_pestrdup ((char * )p , FALSE);
@@ -2209,10 +2214,11 @@ php_mysqlnd_cached_sha2_result_read(MYSQLND_CONN_DATA * conn, void * _packet)
2209
2214
DBG_RETURN (PASS );
2210
2215
}
2211
2216
2212
- if (0x1 != main_response_code ) {
2213
- DBG_ERR_FMT ("Unexpected response code %d" , main_response_code );
2217
+ if (0x1 != packet -> response_code ) {
2218
+ DBG_ERR_FMT ("Unexpected response code %d" , packet -> response_code );
2214
2219
}
2215
2220
2221
+ /* This is not really the response code, but we reuse the field. */
2216
2222
packet -> response_code = uint1korr (p );
2217
2223
p ++ ;
2218
2224
BAIL_IF_NO_MORE_DATA ;
0 commit comments