1--TEST-- 2Constants exported by ext/mysqli 3--EXTENSIONS-- 4mysqli 5--INI-- 6mysqli.allow_local_infile=1 7--FILE-- 8<?php 9 10$constants = get_defined_constants(true); 11sort($constants); 12 13$expected_constants = array( 14 'MYSQLI_READ_DEFAULT_GROUP' => true, 15 'MYSQLI_READ_DEFAULT_FILE' => true, 16 'MYSQLI_OPT_CONNECT_TIMEOUT' => true, 17 'MYSQLI_OPT_LOCAL_INFILE' => true, 18 'MYSQLI_OPT_READ_TIMEOUT' => true, 19 'MYSQLI_INIT_COMMAND' => true, 20 'MYSQLI_CLIENT_SSL' => true, 21 "MYSQLI_CLIENT_COMPRESS" => true, 22 "MYSQLI_CLIENT_INTERACTIVE" => true, 23 "MYSQLI_CLIENT_IGNORE_SPACE" => true, 24 "MYSQLI_CLIENT_NO_SCHEMA" => true, 25 "MYSQLI_CLIENT_FOUND_ROWS" => true, 26 "MYSQLI_STORE_RESULT" => true, 27 "MYSQLI_USE_RESULT" => true, 28 "MYSQLI_ASSOC" => true, 29 "MYSQLI_NUM" => true, 30 "MYSQLI_BOTH" => true, 31 "MYSQLI_STMT_ATTR_UPDATE_MAX_LENGTH"=> true, 32 "MYSQLI_NOT_NULL_FLAG" => true, 33 "MYSQLI_PRI_KEY_FLAG" => true, 34 "MYSQLI_UNIQUE_KEY_FLAG" => true, 35 "MYSQLI_MULTIPLE_KEY_FLAG" => true, 36 "MYSQLI_BLOB_FLAG" => true, 37 "MYSQLI_UNSIGNED_FLAG" => true, 38 "MYSQLI_ZEROFILL_FLAG" => true, 39 "MYSQLI_AUTO_INCREMENT_FLAG" => true, 40 "MYSQLI_TIMESTAMP_FLAG" => true, 41 "MYSQLI_SET_FLAG" => true, 42 "MYSQLI_NUM_FLAG" => true, 43 "MYSQLI_ENUM_FLAG" => true, 44 "MYSQLI_BINARY_FLAG" => true, 45 "MYSQLI_PART_KEY_FLAG" => true, 46 "MYSQLI_GROUP_FLAG" => true, 47 "MYSQLI_SERVER_QUERY_NO_GOOD_INDEX_USED"=> true, 48 "MYSQLI_SERVER_QUERY_NO_INDEX_USED" => true, 49 "MYSQLI_OPT_LOAD_DATA_LOCAL_DIR" => true, 50 "MYSQLI_IS_MARIADB" => true, 51 52 "MYSQLI_TYPE_DECIMAL" => true, 53 "MYSQLI_TYPE_TINY" => true, 54 "MYSQLI_TYPE_SHORT" => true, 55 "MYSQLI_TYPE_LONG" => true, 56 "MYSQLI_TYPE_FLOAT" => true, 57 "MYSQLI_TYPE_DOUBLE" => true, 58 "MYSQLI_TYPE_NULL" => true, 59 "MYSQLI_TYPE_TIMESTAMP" => true, 60 "MYSQLI_TYPE_LONGLONG" => true, 61 "MYSQLI_TYPE_INT24" => true, 62 "MYSQLI_TYPE_DATE" => true, 63 "MYSQLI_TYPE_TIME" => true, 64 "MYSQLI_TYPE_DATETIME" => true, 65 "MYSQLI_TYPE_YEAR" => true, 66 "MYSQLI_TYPE_NEWDATE" => true, 67 "MYSQLI_TYPE_ENUM" => true, 68 "MYSQLI_TYPE_SET" => true, 69 "MYSQLI_TYPE_VECTOR" => true, 70 "MYSQLI_TYPE_JSON" => true, 71 "MYSQLI_TYPE_TINY_BLOB" => true, 72 "MYSQLI_TYPE_MEDIUM_BLOB" => true, 73 "MYSQLI_TYPE_LONG_BLOB" => true, 74 "MYSQLI_TYPE_BLOB" => true, 75 "MYSQLI_TYPE_VAR_STRING" => true, 76 "MYSQLI_TYPE_STRING" => true, 77 "MYSQLI_TYPE_CHAR" => true, 78 "MYSQLI_TYPE_GEOMETRY" => true, 79 "MYSQLI_NO_DATA" => true, 80 "MYSQLI_REPORT_INDEX" => true, 81 "MYSQLI_REPORT_STRICT" => true, 82 "MYSQLI_REPORT_ALL" => true, 83 "MYSQLI_REPORT_ERROR" => true, 84 "MYSQLI_REPORT_OFF" => true, 85 "MYSQLI_SET_CHARSET_NAME" => true, 86 "MYSQLI_REFRESH_GRANT" => true, 87 "MYSQLI_REFRESH_LOG" => true, 88 "MYSQLI_REFRESH_TABLES" => true, 89 "MYSQLI_REFRESH_HOSTS" => true, 90 "MYSQLI_REFRESH_STATUS" => true, 91 "MYSQLI_REFRESH_THREADS" => true, 92 "MYSQLI_REFRESH_REPLICA" => true, 93 "MYSQLI_REFRESH_SLAVE" => true, 94 "MYSQLI_REFRESH_MASTER" => true, 95 "MYSQLI_DEBUG_TRACE_ENABLED" => true, 96 "MYSQLI_TRANS_START_WITH_CONSISTENT_SNAPSHOT" => true, 97 "MYSQLI_TRANS_START_READ_WRITE" => true, 98 "MYSQLI_TRANS_START_READ_ONLY" => true, 99 "MYSQLI_TRANS_COR_AND_CHAIN" => true, 100 "MYSQLI_TRANS_COR_AND_NO_CHAIN" => true, 101 "MYSQLI_TRANS_COR_RELEASE" => true, 102 "MYSQLI_TRANS_COR_NO_RELEASE" => true, 103); 104 105$expected_constants['MYSQLI_OPT_INT_AND_FLOAT_NATIVE'] = true; 106 107$expected_constants['MYSQLI_STORE_RESULT_COPY_DATA'] = true; 108 109$expected_constants['MYSQLI_REFRESH_BACKUP_LOG'] = true; 110 111$expected_constants['MYSQLI_OPT_NET_CMD_BUFFER_SIZE'] = true; 112$expected_constants['MYSQLI_OPT_NET_READ_BUFFER_SIZE'] = true; 113$expected_constants['MYSQLI_ASYNC'] = true; 114 115$expected_constants['MYSQLI_SERVER_PS_OUT_PARAMS'] = true; 116 117$expected_constants['MYSQLI_ON_UPDATE_NOW_FLAG'] = true; 118 119$expected_constants['MYSQLI_SERVER_QUERY_WAS_SLOW'] = true; 120 121$expected_constants['MYSQLI_CLIENT_SSL_VERIFY_SERVER_CERT'] = true; 122$expected_constants['MYSQLI_CLIENT_SSL_DONT_VERIFY_SERVER_CERT'] = true; 123 124$expected_constants['MYSQLI_SERVER_PUBLIC_KEY'] = true; 125 126$expected_constants = array_merge($expected_constants, array( 127 "MYSQLI_TYPE_NEWDECIMAL" => true, 128 "MYSQLI_TYPE_BIT" => true, 129)); 130 131$expected_constants['MYSQLI_NO_DEFAULT_VALUE_FLAG'] = true; 132 133$expected_constants = array_merge($expected_constants, array( 134 "MYSQLI_STMT_ATTR_CURSOR_TYPE" => true, 135 "MYSQLI_CURSOR_TYPE_NO_CURSOR" => true, 136 "MYSQLI_CURSOR_TYPE_READ_ONLY" => true, 137)); 138 139$expected_constants['MYSQLI_OPT_SSL_VERIFY_SERVER_CERT'] = true; 140 141/* pretty dump test, but that is the best way to mimic mysql.c */ 142$expected_constants["MYSQLI_DATA_TRUNCATED"] = true; 143 144$expected_constants["MYSQLI_OPT_CAN_HANDLE_EXPIRED_PASSWORDS"] = true; 145$expected_constants["MYSQLI_CLIENT_CAN_HANDLE_EXPIRED_PASSWORDS"] = true; 146 147$unexpected_constants = array(); 148 149foreach ($constants as $consts) { 150 foreach ($consts as $name => $value) { 151 if (stristr($name, 'mysqli')) { 152 $name = strtoupper($name); 153 if (isset($expected_constants[$name])) { 154 unset($expected_constants[$name]); 155 } else { 156 $unexpected_constants[$name] = $name; 157 } 158 } 159 } 160} 161 162if (!empty($unexpected_constants)) { 163 printf("Dumping list of unexpected constants\n"); 164 var_dump($unexpected_constants); 165} 166 167if (!empty($expected_constants)) { 168 printf("Dumping list of missing constants\n"); 169 var_dump($expected_constants); 170} 171?> 172--EXPECT-- 173