@@ -3317,19 +3317,30 @@ public function testObject() {
33173317 $ this ->redis ->del ('key ' );
33183318 $ this ->redis ->lpush ('key ' , 'value ' );
33193319
3320- /* Newer versions of redis are going to encode lists as 'quicklists',
3321- * redis >= 7.2 as 'listpack'
3322- * so 'quicklist' or 'ziplist' or 'listpack' are valid here */
33233320 $ str_encoding = $ this ->redis ->object ('encoding ' , 'key ' );
3324- $ this ->assertTrue ($ str_encoding === "ziplist " || $ str_encoding === 'quicklist ' || $ str_encoding === 'listpack ' , $ str_encoding );
3321+ if (version_compare ($ this ->version , '7.1.240 ' ) >= 0 ) {
3322+ /* Since redis 7.2-rc1 */
3323+ $ valid = ['listpack ' ];
3324+ } else {
3325+ /* Newer versions of redis are going to encode lists as 'quicklists',
3326+ * so 'quicklist' or 'ziplist' or 'listpack' are valid here */
3327+ $ valid = ['ziplist ' , 'quicklist ' ];
3328+ }
3329+ $ this ->assertTrue (in_array ($ str_encoding , $ valid ), $ str_encoding );
33253330
33263331 $ this ->assertTrue ($ this ->redis ->object ('refcount ' , 'key ' ) === 1 );
33273332 $ this ->assertTrue (is_numeric ($ this ->redis ->object ('idletime ' , 'key ' )));
33283333
33293334 $ this ->redis ->del ('key ' );
33303335 $ this ->redis ->sadd ('key ' , 'value ' );
33313336 $ str_encoding = $ this ->redis ->object ('encoding ' , 'key ' );
3332- $ this ->assertTrue ($ str_encoding === "hashtable " || $ str_encoding === 'listpack ' , $ str_encoding );
3337+ if (version_compare ($ this ->version , '7.1.240 ' ) >= 0 ) {
3338+ /* Since redis 7.2-rc1 */
3339+ $ valid = ['listpack ' ];
3340+ } else {
3341+ $ valid = ['hashtable ' ];
3342+ }
3343+ $ this ->assertTrue (in_array ($ str_encoding , $ valid ), $ str_encoding );
33333344 $ this ->assertTrue ($ this ->redis ->object ('refcount ' , 'key ' ) === 1 );
33343345 $ this ->assertTrue (is_numeric ($ this ->redis ->object ('idletime ' , 'key ' )));
33353346
0 commit comments