Project

General

Profile

Actions

Task #57993

closed

Make package HHVM compatible - failing getPackageReturnsTheSpecifiedPackage test

Added by Tymoteusz Motylewski over 10 years ago. Updated about 6 years ago.

Status:
Closed
Priority:
Should have
Category:
-
Target version:
-
Start date:
2014-04-16
Due date:
% Done:

100%

Estimated time:
TYPO3 Version:
6.2
PHP Version:
Tags:
Complexity:
Sprint Focus:

Description

the PackageManagerTest::getPackageReturnsTheSpecifiedPackage is failing on hhvm, because it HHVM doesn't support calling key() on objects.
So it is failing now with "Fatal error: Cannot access empty property in..."
Responsible code is in Package->getNamespace()

$namespaces = $manifest->autoload->{'psr-0'};
if (count($namespaces) === 1) {
    $namespace = key($namespaces);
}

it can be solved by first cast object to an array

$namespaces = (array)$manifest->autoload->{'psr-0'};
if (count($namespaces) === 1) {
    $namespace = key($namespaces);
}

quote from
https://github.com/facebook/hhvm/blob/master/hphp/doc/inconsistencies#L90-95
about this inconsistency:

(5) Object internal cursors

Under Zend PHP, objects have an internal cursor (similar to the array internal
cursor) that can be used to iterate over the object's properties. Under HipHop
VM, objects do not have internal cursors, and the next(), prev(), current(),
key(), reset(), end(), and each() builtin functions do not support objects.

Actions

Also available in: Atom PDF