Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions src/Symfony/Component/ClassLoader/ApcClassLoader.php
Original file line number Diff line number Diff line change
Expand Up @@ -122,8 +122,10 @@ public function loadClass($class)
*/
public function findFile($class)
{
if (false === $file = apcu_fetch($this->prefix.$class)) {
apcu_store($this->prefix.$class, $file = $this->decorated->findFile($class));
$file = apcu_fetch($this->prefix.$class, $success);

if (!$success) {
apcu_store($this->prefix.$class, $file = $this->decorated->findFile($class) ?: null);
Copy link
Contributor

Choose a reason for hiding this comment

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

what is the point of the null condition?

Copy link
Member Author

Choose a reason for hiding this comment

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

Composer's ClassLoader returns false here.

Copy link
Contributor

Choose a reason for hiding this comment

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

then WinCache and Xcache class loaders should do the same normalization

}

return $file;
Expand Down
6 changes: 4 additions & 2 deletions src/Symfony/Component/ClassLoader/ApcUniversalClassLoader.php
Original file line number Diff line number Diff line change
Expand Up @@ -87,8 +87,10 @@ public function __construct($prefix)
*/
public function findFile($class)
{
if (false === $file = apcu_fetch($this->prefix.$class)) {
apcu_store($this->prefix.$class, $file = parent::findFile($class));
$file = apcu_fetch($this->prefix.$class, $success);

if (!$success) {
apcu_store($this->prefix.$class, $file = parent::findFile($class) ?: null);
}

return $file;
Expand Down
2 changes: 1 addition & 1 deletion src/Symfony/Component/ClassLoader/DebugClassLoader.php
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ public function unregister()
*/
public function findFile($class)
{
return $this->classFinder->findFile($class);
return $this->classFinder->findFile($class) ?: null;
}

/**
Expand Down
6 changes: 4 additions & 2 deletions src/Symfony/Component/ClassLoader/WinCacheClassLoader.php
Original file line number Diff line number Diff line change
Expand Up @@ -123,8 +123,10 @@ public function loadClass($class)
*/
public function findFile($class)
{
if (false === $file = wincache_ucache_get($this->prefix.$class)) {
wincache_ucache_set($this->prefix.$class, $file = $this->decorated->findFile($class), 0);
$file = wincache_ucache_get($this->prefix.$class, $success);

if (!$success) {
wincache_ucache_set($this->prefix.$class, $file = $this->decorated->findFile($class) ?: null, 0);
}

return $file;
Expand Down
2 changes: 1 addition & 1 deletion src/Symfony/Component/ClassLoader/XcacheClassLoader.php
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ public function findFile($class)
if (xcache_isset($this->prefix.$class)) {
$file = xcache_get($this->prefix.$class);
} else {
$file = $this->decorated->findFile($class);
$file = $this->decorated->findFile($class) ?: null;
xcache_set($this->prefix.$class, $file);
}

Expand Down