Unfortunately, we can't simply use session_id() to regenerate the
session id in unit tests. Starting from PHP 7.2, it would trigger
"session_id(): Cannot change session id when headers already sent",
refer to MDL-60978 and PHP bug #75628 for more details.
As a workaround, we use a static property allowing us to inject the
value that we then use as a session identifier. This is reasonably
enough to make sure that the identifier is used as a part of the key
prefix.
The current logic in the cache_session::check_tracked_user() is not
right. We must always set the current session id. A typical use case is
when the cache instance is instantiated for a not logged in user. We
can't let the sessionid property null in that case as it forms an
important part of the parsed key.
Similarly, even if we have the same user currently loaded, we must still
set the sessionid to make sure the data will be associated with the
current PHP session. Same user (including visitors or guest users) can
access the site from different browsers and each must end up with its
own key prefix.
Significant string changes:
* withselectedusers_help, core - removing mention of 'Add a common note'
as the option no longer exists
* considereddigitalminor and digitalminor_desc, core - more
child-friendly wording
* configmessagingallusers, core_admin - clearer explanation
* auth_dbtype, auth_db - fixed broken link
- count() can only be called on arrays or Countable, it can not be called on null
- recordset is neither so iterator_count() should be used
- instanceof or get_class() can not be applied to non-objects
- class methods must have the same arguments as methods in parent class
If the store is shared and the getAllKeys function is broken due to an
incompatability between libmemcached and memcached >= 1.4.23, then it is
not possible to purge the cache, and we cannot support the plugin.
This patch adjusts the isready check to additionally check if the
combination of libmemcached and memcached is affected by this issue.
In unit test, we write cache file often and
opcache might fail to detect changes. It will
be nice to invalidate opcode cache to ensure
we have the correct file_exists status
It is now safe to cache a reference to a cache and expect consistent results.
Changing identifiers altered cache results where a reference was
held to the cache. Identifiers have been set to be cached with
identifiers included so the caches are separate.
As a consequence of this it was identified that invalidation events
and identifiers don't easily work together as an event can't determine
which identifiers should be used for cache invalidation. So invalidation
events have been made incompatible with identifiers being set. No core
code used this combination as it's not possible to understand any expected
behaviour.
Event invalidation for application and session caches was centralised to the same
location. The only difference was the name of the lastinvalidation variable. This
improves support and consistency of invalidation code.
This unit test is not really verifying that internally igbinary
in being used but just igbinary availability and, by double
serializing, that it works for a semi-complex object.
The test will be skipped if igbinary is not available.
Previously a purge_store was only purging caches but it was leaving a
reference to the store instance for the cache definition.
As a result, the cache was never cleared away correctly and, in cases
where the cache store makes a TCP connection to a backend system, the
number of open sockets was increasing for each store instance.
After a complete purge, as found in the unit test reset, the cache
definitions should be both purged and removed.
This change should also lead to a drop in memory consumption for unit
tests as there will no longer be references to unused definition stores.