Problem/Motivation

#2617568: Rename apc_* functions with apcu_* switched all core code to use apcu_* functions instead of apc_*

Unfortunately, Symfony's APC class loader does not support APCu yet - it still uses the old apc_* functions. This results in fatal errors on sites running PHP 7 that have APCu installed, but not the apc bc support, which has been split to a separate project: https://github.com/krakjoe/apcu-bc

An immediate workaround for sites affected is to either disable the apcu extension, or install and enable the APC backwards compatibility extension.

Proposed resolution

Check for apc_* before trying to use the Symfony APC classloader.

A follow-up issue has been created to address the issue with the classloader itself.

Remaining tasks

User interface changes

API changes

Data model changes

RuntimeException: Unable to use ApcClassLoader as APC is not enabled

I've just recently installed a Drupal 8.0.1 instance.

I note today's update to 8.0.2.

On exec of update

	drush up
		Update information last refreshed: Wed, 01/06/2016 - 14:44
		 Name    Installed Version  Proposed version  Message          
		 Drupal  8.0.1              8.0.2             Update available 

		...
		Do you really want to continue? (y/n): y
		Project drupal was updated successfully. Installed version is now 8.0.2.
		...
CommentFileSizeAuthor
#4 2646100-4-drupalkernel-apcclassloader.patch999 bytesgapple

Comments

Anonymous’s picture

bugsonly created an issue. See original summary.

Anonymous’s picture

apcu now needs a separate module for apc backward compatibility

here,

	http://php.net/manual/en/apcu.installation.php

	"Warning  PHP 7 has a separate module (» apc.so) for backwards compatibility with APC.
	In backward compatibility mode, APCu registers the applicable APC functions with backward compatible prototypes."

leads to sources at

	https://pecl.php.net/package/apcu_bc
	https://github.com/krakjoe/apcu-bc

after install

	php -m | grep -i apc
		apc
		apcu

error "RuntimeException: Unable to use ApcClassLoader as APC is not enabled." is now gone

leaving this open so it's noted, perhaps flagged in Drupal installer.

at some point, arguably, the upstream Symfony apcu(current)-vs-apc(deprecated) dependency needs to be addressed

Anonymous’s picture

Issue tags: +Symfony2
gapple’s picture

Title: error "RuntimeException: Unable to use ApcClassLoader as APC is not enabled." on php7 + APCu installed/enabled » Exception on php7 + APCu without backwards compatibilty enabled
Version: 8.0.2 » 8.0.x-dev
Priority: Normal » Major
Issue tags: +PHP 7.0 (duplicate)
Parent issue: » #2454439: [META] Support PHP 7
Related issues: +#2617568: Rename apc_* functions with apcu_*
StatusFileSize
new999 bytes

This was caused by the changes in #2617568: Rename apc_* functions with apcu_*. The ApcClassLoader is (attempted to be) used if apcu_fetch() is available, but ApcClassLoader requires that the apc extension is loaded (or is emulated by a BC option for APCu).

I could not find any Symfony issues for 2.7/2.8. The only issue I found was https://github.com/symfony/symfony/issues/16830, which mentions Symfony 3.

gapple’s picture

Status: Active » Needs review
gapple’s picture

I don't know that adding APCu support would be in scope for Symfony 2.7 / 2.8, so Drupal may need its own class to enable equivalent functionality without backwards compatibility in APCu.

catch’s picture

Priority: Major » Critical
Status: Needs review » Reviewed & tested by the community

That's... disappointing, I think we just completely missed that Symfony isn't properly compatible with APCu in the other issue.

Since this is a fatal error caused by a patch release, bumping to critical.

Patch looks fine for a quick fix, I missed the patch here and wrote almost the same thing.

catch’s picture

Issue summary: View changes
catch’s picture

Added to 8.0.2 release notes: https://www.drupal.org/node/2645600

geerlingguy’s picture

RTBC x2 here (plus critical status); ran into this myself today after hearing about it from a few different people. As it is, I'll just run 8.0.2 + this patch for the site in question, but would like to see this get committed soon!

catch’s picture

Status: Reviewed & tested by the community » Fixed
Issue tags: -exception, -caching, -PHP 7.0 (duplicate) +php7, +8.0.3 release notes

Give the RTBC x 2, I think I can go ahead and commit this.

Committed/pushed to 8.1.x and cherry-picked to 8.0.x. Thanks!

  • catch committed f7b30ad on 8.1.x
    Issue #2646100 by gapple: Exception on php7 + APCu without backwards...

  • catch committed 3b737e9 on
    Issue #2646100 by gapple: Exception on php7 + APCu without backwards...

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.