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

Cannot use 'Object' as class name as it is reserved #3

Open
mhoffmann75 opened this issue Aug 27, 2018 · 1 comment
Open

Cannot use 'Object' as class name as it is reserved #3

mhoffmann75 opened this issue Aug 27, 2018 · 1 comment

Comments

@mhoffmann75
Copy link

On yii2 Version: 2.0.15.1 with php 7.2.8 it does crash with error:

PHP Compile Error – yii\base\ErrorException
Cannot use 'Object' as class name as it is reserved

To make it work change your BaseObject.php:

namespace lucidprogrammer\simplesamlphp;
use yii\base\BaseObject as Another;


if (class_exists('Another')) {
    class MiddleManClass extends Another { }
} else {
-    class MiddleManClass extends \yii\base\Object{ }
+   class MiddleManClass extends \yii\base\BaseObject{ }
}

Which actually makes me wonder why your class_exists('Another') workaround does not work properly ...

@mhoffmann75
Copy link
Author

Proposed change to your BaseObject.php:

<?php
namespace lucidprogrammer\simplesamlphp;

if (class_exists('yii\base\BaseObject')) {
    class MiddleManClass extends \yii\base\BaseObject { }
} else {
    class MiddleManClass extends \yii\base\Object{ }
}

class BaseObject extends MiddleManClass {

}

Works with php 7.2 out of the box. I cannot test this with older php....

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant