-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Bug PHP Late Static Binding on 5.3.2 #13
Comments
Could you submit a pull request and any relevant unit tests for this? |
Instead of
That was the intention of using |
public static function values()
{
$class = get_called_class();
if (!isset(Enum::$cache[$class])) {
$reflected = new \ReflectionClass($class);
Enum::$cache[$class] = $reflected->getConstants();
}
return static::$cache[$class];
} Do not work. I think this bug report https://bugs.php.net/bug.php?id=53915 (fixed in 5.3.6) should characterize the error. The bug should occur up to php version 5.3.6, too. Since \Aws\Common\Enum.php is an abstract class and every of the listed subclasses (http://docs.amazonwebservices.com/aws-sdk-php-2/latest/class-Aws.Common.Enum.html) inherid from this class the error should effect every where self::[constant] is used. Like in namespace Aws\DynamoDb\Enum;
use Aws\Common\Enum;
class Type extends Enum
{
const S = 'S';
const N = 'N';
const B = 'B';
const SS = 'SS';
const NS = 'NS';
const BS = 'BS';
const STRING = self::S;
const NUMBER = self::N;
const BINARY = self::B;
const STRING_SET = self::SS;
const NUMBER_SET = self::NS;
const BINARY_SET = self::BS;
} I use this call to cause the error Zend_Debug::dump(\Aws\DynamoDb\Enum\Type::values());
$test = array(
'Id' => '10101',
'test' => 10101,
);
Zend_Debug::dump(\Aws\DynamoDb\Model\Item::fromArray($test)); |
Hey,
I always get an PHP Fatal error on my cloudhoster (php 5.3.2) environment (@see https://phpinfo.cloudcontrolled.com/)
PHP Fatal error: Cannot access self:: when no class scope is active in /srv/www/library/vendor/aws/aws-sdk-php/src/Aws/Common/Enum.php on line 50.
After changing code in \Aws\Common\Enum.php from
to (Bugfix)
it also works on PHP 5.3.2
More information at http://php.net/manual/en/language.oop5.late-static-bindings.php
The text was updated successfully, but these errors were encountered: