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

[ticket/12314] Workaround HHVM SPL autoloader sometimes using leading ba... #2192

Merged
merged 1 commit into from Mar 29, 2014
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
8 changes: 7 additions & 1 deletion phpBB/phpbb/class_loader.php
Expand Up @@ -142,7 +142,13 @@ public function resolve_path($class)
*/
public function load_class($class)
{
$class = '\\' . $class;
// In general $class is not supposed to contain a leading backslash,
// but sometimes it does. See tickets PHP-50731 and HHVM-1840.
if ($class[0] !== '\\')
Copy link

Choose a reason for hiding this comment

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

should be correct: $class[0].$class[1]
or only $class[1] seems enough.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

no

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

It is only a single character. The first backslash is an escape character in PHP.

Copy link

Choose a reason for hiding this comment

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

whoops, yes true, everything is correct then.

{
$class = '\\' . $class;
}

if (substr($class, 0, strlen($this->namespace)) === $this->namespace)
{
$path = $this->resolve_path($class);
Expand Down