-
Notifications
You must be signed in to change notification settings - Fork 34
Closed
Labels
Description
The function SimpleCacheTest::invalidKeys() line 58 lists (integer) 2 as invalid key, which leads to a problem:
- PHP will read
['0' => 'value0']as['value0']making it impossible to determine whether 0 was an integer or a string at declaration time. Reference: PHP documentation on arrays, stating A key may be either an integer or a string. If a key is the standard representation of an integer, it will be interpreted as such (i.e. "8" will be interpreted as 8, while "08" will be interpreted as "08"). - Considering point 1, the test case SimpleCacheTest::testSetMultipleWithIntegerArrayKey() line 225 effectively considers 0 a valid key, contradicting
SimpleCacheTest::invalidKeys(). - The problem already seems to have surfaced, because there is a fix in SimpleCacheTest::testSetMultipleInvalidKeys() on line 461. However, this does not solve the problem, because the tests using the
SimpleCacheTest::invalidKeys()function still consider (integer) 2 an invalid key.
To solve the problem, either integers are considered keys, or the the test case SimpleCacheTest::testSetMultipleWithIntegerArrayKey() line 225 uses another key than '0'.