Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

(dev/core#174) APCcache - Updates to comply with PSR-16 #12381

Merged
merged 1 commit into from
Jul 1, 2018

Conversation

totten
Copy link
Member

@totten totten commented Jun 30, 2018

Overview

#12342 provides nominal compliance with PSR-16; however, some drivers raise exceptions or warnings for new options.

(This is a cherry-pick from #12360.)

Before

  • $cache->set(...$ttl) would throw an error with any custom TTL.
  • $cache->get(...$default) would throw an error for any not-NULL default.
  • Cache-keys are not validated.
  • Some variants of $cache->set() / $cache->get() handle objects in ways that are unsafe.

After

  • APCcache has been fixed to comply (per SimpleCacheTest), and a unit-test ensures compliance.

Technical Details

One notable quirk is that APC retains expired records until the following page-request. To comply with the TTL semantics of the test suite, we have to double-store/double-check the expiration time.

One noteable quirk is that APC retains expired (per TTL) records until the
following page-request. To comply with the test suite, we have to double-check
the expiration time.
@civibot
Copy link

civibot bot commented Jun 30, 2018

(Standard links)

if ($default !== NULL) {
throw new \RuntimeException("FIXME: " . __CLASS__ . "::get() only supports NULL default");
CRM_Utils_Cache::assertValidKey($key);
$result = apc_fetch($this->_prefix . $key, $success);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So I'm still under the impression that we will get e-notices sometimes if $success is not predefined - perhaps php versions are different on that?

@eileenmcnaughton
Copy link
Contributor

I enabled APC cache & stepped through this & getting & setting looks to be working well. Changes make sense per related changes

@eileenmcnaughton eileenmcnaughton merged commit 6dd26cc into civicrm:master Jul 1, 2018
@totten totten deleted the master-psr16-apc branch July 2, 2018 03:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants