install php 7.2.x
composer create-project --prefer-dist yiisoft/yii-app-advanced adv
open browser and see welcome yii2 page.
Fatal error: Cannot use 'Object' as class name as it is reserved in /usr/local/var/www/adv/vendor/yiisoft/yii2/base/Object.php on line 77
| Q | A
| ---------------- | ---
| Yii version | 2.0.12
| PHP version | 7.2.0beta3
| Operating system | Darwin macOS 10.12.6
already fixed by commit https://github.com/yiisoft/yii2/commit/69673c0c94679ba3f38829cf44cb001d9186621d.
see issue https://github.com/yiisoft/yii2/pull/7936
Got the same issue, does this mean 2.0.12 dev will now have the object renamed to base object and all we have to do is upgrade to yii 2.0.12 dev?
Yes. That's the case when we can't do it in any other way.
noted. will wait for the release. in the meantime, I am asking the server
admin to down grade to 7.0.23. I prefer not to mess with the core
On Sat, Sep 30, 2017 at 6:19 PM, Alexander Makarov <[email protected]
wrote:
Yes. That's the case when we can't do it in any other way.
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
https://github.com/yiisoft/yii2/issues/14823#issuecomment-333299125, or mute
the thread
https://github.com/notifications/unsubscribe-auth/AQYmd_0drh3lWxSQbNBK5tAgmuvLd_njks5snhW_gaJpZM4PYUly
.
--
--
Lionel Yeo
Chartered Alternative Investment Analyst SM
Partner And Developer
Wesvault
PaperlessCloud
Website: www.wesvault.com
paperlesscloud.wesvault.com
Main-SG: +65 6521 2851
HP : +65 9667 4603
Bronze Sponsor
Seapex 2014
www.seapex.org
How to solve this problem
use 7.0.24
Are there any other solutions?
not that I know of
On Wed, Jan 10, 2018 at 10:44 AM, 97811223 notifications@github.com wrote:
Are there any other solutions?
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
https://github.com/yiisoft/yii2/issues/14823#issuecomment-356483119, or mute
the thread
https://github.com/notifications/unsubscribe-auth/AQYmdz3ALuyaJmlYWaCzG0nDOTYJBccLks5tJCP-gaJpZM4PYUly
.
--
--
Lionel Yeo
Chartered Alternative Investment Analyst SM
Partner And Developer
Wesvault
PaperlessCloud
Website: www.wesvault.com
paperlesscloud.wesvault.com
Main-SG: +65 6521 2851
HP : +65 9667 4603
Bronze Sponsor
Seapex 2014
www.seapex.org
Oh, thank you.
Still a bug in 2.0.13.1 as the file vendor/yiisoft/yii2/base/Object.php contains:
class Object extends BaseObject {
}
And PHP 7.2 erros out with Cannot use 'Object' as class name as it is reserved
.
@shemgp just don't use Object
class in your app.
As I stated above. 2.0.13 has not debugged this issue, as PHP 7.2 Object is a restricted word.
They need to rename all the objects in the code.
@dmirogin it is automatically call constructor so there's no way around it. My suggest is downgrade to php 7.0.24
@auzadventure since 2.0.13 Yii itself does not use Object class anymore, if some extension code uses it, please report this to the Extension author. If your application uses it, replace usage with BaseObject
.
See also https://github.com/yiisoft/yii2/blob/2.0.13/framework/UPGRADE.md#upgrade-from-yii-2012
The default User model in appmodels uses also yiibaseObject instead of yiibaseBaseObject, making the default login page not functioning out of the box.
Thanks, that explains it why it's still an Object in my code, the latest stable Yii 2 version is the Nov 3 one, and that change was made on Nov 6.
I have this error with yii2 version 2.0.13.1 and php 7.2.1
Cannot use 'Object' as class name as it is reserved
in vendoryiisoftyii2baseObject.php at line 28
when i try to open gii
sudo composer create-project --prefer-dist yiisoft/yii2-app-basic html
cd html
grep -ri 'yii\\base\\Object' *
models/User.php:class User extends \yii\base\Object implements \yii\web\IdentityInterface
...
I edited models/User.php
and renamed Object
to BaseObject
and it worked.
safer is to downgrade to 7.0.23, other things may break . not sure
I've upgraded to PHP 7.2.2 and also get error in my app when try to login:
yii\base\ErrorException: Cannot use 'Object' as class name as it is reserved in \vendor\yiisoft\yii2\base\Object.php:28
Stack trace:
#0 [internal function]: yii\base\ErrorHandler->handleFatalError()
#1 {main}
Yii version is 2.0.13.1
You have somewhere code, that uses class Object
@alexander-ronin
If your application is based on yii2-app-basic change the requirement in your composer.json to "yiisoft/yii2": "~2.0.14". Read https://github.com/yiisoft/yii2/blob/master/framework/UPGRADE.md.
Change Object to BaseObject everywhere in your application.
Probably this will fix the issue.
@schmasterz no, I have Advanced version.
Change Object to BaseObject everywhere in your application.
I didn't found any declared or used Object in my app except vendor/yiisoft/yii2/base/Object.php.
The only help is downgrade PHP version to 7.0.27
I think Yii2 needs to push an update where rename object to base object. This issue has been outstanding since Last Jan.
@auzadventure Can you link the issue?
Actually the rename took part from 2.0.12 to 2.0.13 - https://github.com/yiisoft/yii2/blob/master/framework/UPGRADE.md#upgrade-from-yii-2012
@SilverFire Sorry, you was right. I've found usage of Object in mdmsoft/yii2-admin extension.
It's strange situation: As I see, @mdmunir replaced Object usage in his extension, but it doesn't want to update.
I've tried to clear composer cache, removed vendor folder, reinstall mdmsoft/yii2-admin, but useless. Anyway I get version of this extension without last commit.
@alexander-ronin Try require
ing it as dev-master#e9cc1d8adc as 2.8-p1
in composer.json
...
@schmunk42 yes, you're saved me!
All errors are gone, thanks a lot =)
Fatal error: Cannot use 'Object' as class name as it is reserved in G:xampphtdocshumhub-1.2.4humhub-1.2.4protectedvendoryiisoftyii2baseObject.php on line 77
Please respond to this issue ??
@kahoul See https://github.com/yiisoft/yii2/issues/14823#issuecomment-369930685 or don't use PHP 7.2
php 5.3
php 7.0
You should configure your PHP installation so that it meets the minimum requirements of Yii. Most importantly, you should have PHP 5.4 or above.
https://www.yiiframework.com/doc/guide/2.0/en/start-installation
For PHP 7.0, it seems like an error in your index.php
on or before line 21. Please review your file.
I was having this problem in the yii2-admin module. I solved this, editing the files that was calling Object instead of BaseObject.
The files are:
Rename folder from Object.php to BaseObject.php
and on vile also change class Object to class BaseObject
@alievinfo
Good to know. Thanks!
What is the expected result?
open browser and see welcome yii2 page.
What do you get instead?
Fatal error: Cannot use 'Object' as class name as it is reserved in yiiipaddressprojectvendoryiisoftyii2baseObject.php on line 77
can any one help me, solve for this error.
@meddev001 Please read through this issue, especially my comment from 26 Mar.
@schmunk42 hi, i cannot handle with this bug. I'm a newby so can you explain how to do this?
Try requireing it as dev-master#e9cc1d8adc as 2.8-p1 in composer.json...
@laurent7878, just replace entry about mdmsoft/yii2-admin in composer.json file with this:
"require": {
"mdmsoft/yii2-admin": "dev-master#e9cc1d8adc as 2.8-p1",
// ...
},
and then run in terminal command composer update
Thanks but I use humhub 1.2.7. mdmsoft folder does not exist at all...
Any way to solve it for humhub?
Why can't we have a patch merge update to Yii2 so that we can use PHP 7.1+ the issue is not complicated, Object is now a protected word in 7.1+ so it can be renamed to BaseObject, but the community needs an official patch to this. I've posted when it was 7.0.29 and decided to just stay at 7.0.
We would like this as well.
Why can't we have a patch merge update to Yii2 so that we can use PHP 7.1+
Yii 2 is compatible with PHP 7.2 and above since 2.0.13 (see https://github.com/yiisoft/yii2/blob/master/framework/UPGRADE.md#upgrade-from-yii-2012)
This issue should be locked. Compatibility with PHP 7.2 was fixed almost a year ago. If someone still experiences this bug, this means that:
Object
class - this is extension fault and it should be upgraded or fixed to use BaseObject
instead of Object
.Object
directly in application code - this is application fault and it should be fixed to use BaseObject
instead of Object
.None of this can be fixed in Yii itself.
Most helpful comment
Still a bug in 2.0.13.1 as the file vendor/yiisoft/yii2/base/Object.php contains:
And PHP 7.2 erros out with
Cannot use 'Object' as class name as it is reserved
.