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

String class name issue for php7 #1367

Closed
sidealice opened this issue Jun 14, 2015 · 19 comments
Closed

String class name issue for php7 #1367

sidealice opened this issue Jun 14, 2015 · 19 comments
Labels
Issue: Ready for Work Gate 4. Acknowledged. Issue is added to backlog and ready for development Progress: needs update

Comments

@sidealice
Copy link

Fatal error: Cannot use 'String' as class name as it is reserved in lib/internal/Magento/Framework/Data/Argument/Interpreter/String.php on line 14

@alankent
Copy link

Yes, there are a few similar class named we hit when we tried php 7 as well. Good news was there were not many that needed to be renamed to get php to work. (I don't recall where that got to on the backlog.)

@orlangur
Copy link
Contributor

PHP7 is not supported yet: https://github.com/magento/magento2/blob/develop/composer.json#L11

There are more reserved words which needs to be considered: http://php.net/manual/en/reserved.other-reserved-words.php The most frequently used in code base is object I believe.

@vpelipenko vpelipenko added TECH Issue: Ready for Work Gate 4. Acknowledged. Issue is added to backlog and ready for development labels Jun 16, 2015
@vpelipenko
Copy link
Contributor

Internal ticket: MAGETWO-37817

@vpelipenko vpelipenko added the PS label Jul 7, 2015
@dccampbell
Copy link

Just for reference, a quick scan for classes w/ newly reserved words as names:

app\code\Magento\Backend\Model\Resource\Translate\String.php
app\code\Magento\CatalogImportExport\Model\Import\Proxy\Product\Resource.php
app\code\Magento\Eav\Model\Entity\Increment\Numeric.php
app\code\Magento\Translation\Model\Resource\String.php
app\code\Magento\Translation\Model\String.php
dev\tests\functional\lib\Magento\Mtf\Util\Generate\Repository\Resource.php
lib\internal\Magento\Framework\Acl\Loader\Resource.php
lib\internal\Magento\Framework\Acl\Resource.php
lib\internal\Magento\Framework\Data\Argument\Interpreter\Object.php
lib\internal\Magento\Framework\Data\Argument\Interpreter\String.php
lib\internal\Magento\Framework\DB\Logger\Null.php
lib\internal\Magento\Framework\Filter\Object.php
lib\internal\Magento\Framework\Flag\Resource.php
lib\internal\Magento\Framework\Module\Resource.php
lib\internal\Magento\Framework\Object.php
lib\internal\Magento\Framework\Search\Request\Filter\Bool.php
lib\internal\Magento\Framework\Search\Request\Query\Bool.php
lib\internal\Magento\Framework\Validator\Float.php
lib\internal\Magento\Framework\Validator\Int.php
lib\internal\Magento\Framework\Validator\Object.php
lib\internal\Magento\Framework\Validator\Test\Unit\Test\Int.php
lib\internal\Magento\Framework\Validator\Test\Unit\Test\True.php
lib\internal\Magento\Framework\View\Layout\Argument\Interpreter\Object.php

@csdougliss
Copy link
Contributor

@vpelipenko Any chance you will also be fixing Magento 1.9?

A minor incompatibility has to be fixed before using Magento with PHP 7.

You have to modify the file app/code/core/Mage/Core/Model/Layout.php on line 555:

Modify the line so it looks like this:

$this->getBlock($callback[0])->{$callback[1]}();

Source - http://afilina.com/magento-1-9-on-php7/

Also I am unable to login to /admin

@vpelipenko
Copy link
Contributor

@craigcarnell, probably yes, but I don't know when.

@vpelipenko
Copy link
Contributor

Adaptation of code to PHP7 was done and all changes are available in develop branch. Please, try this. If you have any question or face with new issues, please, let us know.

@dccampbell
Copy link

I just tried the latest develop code on the rasmus/php7dev Vagrant box and still got the same error as in the OP of this issue. Also, composer.json currently only allows PHP 5.5.x and 5.6.x.

Had an interesting folder conflict that loaded the old version. New one seems to be running so far, will test more once I get a nice environment scripted.

@orlangur
Copy link
Contributor

orlangur commented Aug 5, 2015

@dccampbell, there is no String class in develop anymore, it was renamed to StringUtils: https://github.com/magento/magento2/tree/develop/lib/internal/Magento/Framework/Data/Argument/Interpreter

@dccampbell
Copy link

Finally got a box setup. Install went fine but when I hit any page I get:
==> default: Fatal error: Uncaught ErrorException: session_write_close(): Failed to write session data (user). Not sure if my environment (Debian8 guest on Win7 host), or PHP7-related. Session folder permissions are 777. Using --session-save=db seems to clear it up.

Fixed a nginx/php-fpm permissions conflict. Running all green now.

@dccampbell
Copy link

In case this helps anybody w/ testing, I've made my Vagrant setup available:
https://github.com/dccampbell/php7dev-magento2

Tested smooth on Ubuntu14 and Win7 hosts. So far no issues to report, though I'm holding out for a new sample data version that's usable with the current develop branch to really test it hard.

@csdougliss
Copy link
Contributor

@vpelipenko

I created an issue on Magento 1 bug tracker..

http://www.magentocommerce.com/bug-tracking/issue/index/id/994

Since the search feature does not work.. I'm not sure if anyone else appeared to report it.

Also the whole system is susceptible for XSS by placing javascript in the comments section.. just so you know.

@dccampbell
Copy link

No issues so far on the new PHP7 RC, although still waiting on sample data support to make a more thorough pass.

@piotrekkaminski
Copy link
Contributor

@dccampbell it works for us now. Please reopen the ticket if you still have this problem.

@marvincaspar
Copy link

When is this available for the merchant beta?

@markshust
Copy link
Contributor

I'm assuming this is all ready in https://github.com/magento/magento2/releases/tag/1.0.0-beta4

@dccampbell
Copy link

Of note, as of 1.0.0-beta4 the composer.json is still restricted to PHP ~5.5.0|~5.6.0.

@marvincaspar
Copy link

I'm using the merchant beta and PHP 7 is not working

@markshust
Copy link
Contributor

the merchant beta tag is an older snapshot -- you'll need to use the 1.0.0-beta4 branch/tag.

magento-team pushed a commit that referenced this issue Jul 28, 2017
MAGETWO-70790: Cannot remove custom option
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Issue: Ready for Work Gate 4. Acknowledged. Issue is added to backlog and ready for development Progress: needs update
Projects
None yet
Development

No branches or pull requests

9 participants