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

Comments

Projects
None yet
9 participants
@sidealice

sidealice commented Jun 14, 2015

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

This comment has been minimized.

Show comment
Hide comment
@alankent

alankent Jun 14, 2015

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.)

alankent commented Jun 14, 2015

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

This comment has been minimized.

Show comment
Hide comment
@orlangur

orlangur Jun 15, 2015

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.

Contributor

orlangur commented Jun 15, 2015

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

This comment has been minimized.

Show comment
Hide comment
@vpelipenko

vpelipenko Jun 17, 2015

Contributor

Internal ticket: MAGETWO-37817

Contributor

vpelipenko commented Jun 17, 2015

Internal ticket: MAGETWO-37817

@vpelipenko vpelipenko added the PS label Jul 7, 2015

@dccampbell

This comment has been minimized.

Show comment
Hide comment
@dccampbell

dccampbell Jul 24, 2015

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

dccampbell commented Jul 24, 2015

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
@craigcarnell

This comment has been minimized.

Show comment
Hide comment
@craigcarnell

craigcarnell Jul 27, 2015

@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

craigcarnell commented Jul 27, 2015

@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

This comment has been minimized.

Show comment
Hide comment
@vpelipenko

vpelipenko Aug 4, 2015

Contributor

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

Contributor

vpelipenko commented Aug 4, 2015

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

@vpelipenko

This comment has been minimized.

Show comment
Hide comment
@vpelipenko

vpelipenko Aug 4, 2015

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.

Contributor

vpelipenko commented Aug 4, 2015

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

This comment has been minimized.

Show comment
Hide comment
@dccampbell

dccampbell Aug 4, 2015

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.

dccampbell commented Aug 4, 2015

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

This comment has been minimized.

Show comment
Hide comment
@orlangur

orlangur Aug 5, 2015

Contributor

@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

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

This comment has been minimized.

Show comment
Hide comment
@dccampbell

dccampbell Aug 8, 2015

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 commented Aug 8, 2015

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

This comment has been minimized.

Show comment
Hide comment
@dccampbell

dccampbell Aug 11, 2015

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.

dccampbell commented Aug 11, 2015

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.

@craigcarnell

This comment has been minimized.

Show comment
Hide comment
@craigcarnell

craigcarnell Aug 18, 2015

@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.

craigcarnell commented Aug 18, 2015

@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

This comment has been minimized.

Show comment
Hide comment
@dccampbell

dccampbell Aug 19, 2015

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

dccampbell commented Aug 19, 2015

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

@piotrekkaminski

This comment has been minimized.

Show comment
Hide comment
@piotrekkaminski

piotrekkaminski Oct 3, 2015

Contributor

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

Contributor

piotrekkaminski commented Oct 3, 2015

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

@mc388

This comment has been minimized.

Show comment
Hide comment
@mc388

mc388 Oct 29, 2015

Contributor

When is this available for the merchant beta?

Contributor

mc388 commented Oct 29, 2015

When is this available for the merchant beta?

@markoshust

This comment has been minimized.

Show comment
Hide comment
@markoshust
Contributor

markoshust commented Oct 29, 2015

@dccampbell

This comment has been minimized.

Show comment
Hide comment
@dccampbell

dccampbell Oct 29, 2015

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

dccampbell commented Oct 29, 2015

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

@mc388

This comment has been minimized.

Show comment
Hide comment
@mc388

mc388 Oct 30, 2015

Contributor

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

Contributor

mc388 commented Oct 30, 2015

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

@markoshust

This comment has been minimized.

Show comment
Hide comment
@markoshust

markoshust Oct 30, 2015

Contributor

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

Contributor

markoshust commented Oct 30, 2015

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

okorshenko pushed a commit to magento/magento2-community-edition that referenced this issue Nov 5, 2015

Oleksii Korshenko
2.0.0-rc
=============
* Performance improvements:
    * Refactored observer classes to satisfy the single-responsibility requirement in order to minimize the time on observer object loading
    * Improved performance of catalog advanced search
    * Improved performance of catalog quick search
    * Various micro-optimizations of the Magento framework
    * Optimized stores initialization and data loading
    * Improved the CSS and JavaScript minification mechanism
    * Sales rules (cart promotions) performance optimization
    * Improved performance of table rendering
    * Improved sample data performance
* Payment methods improvements:
    * Implemented the eWay online payment gateway using both Client side encryption and Responsive shared page APIs.
    * Implemented PayPal best practices for PayPal Express Checkout
    * Improved the UI for the Braintree payment method
* Checkout improvements:
    * Implemented persistence of entered customer’s data on Checkout flow
    * Implemented persistence of customer Shopping Cart
    * Improved Terms and Conditions settings
    * Improved error handling mechanism on Checkout flow
    * Improved the collect totals mechanism
    * Improved the checkout credit card form design
* Product improvements:
    * Added the ability to manage the list of variations/configurations using the wizard or manually
    * Added the ability to manage the list of variations based on removing or adding a new attribute
    * Added the ability to notify the user during product information update or management
    * Added the ability to notify the user during the change of the product template set when saving a product
    * Added the ability to update product data during mass action update
    * Added the "remove attribute" button to each attribute on the second step of the configurable product attributes creation
    * Removed grouped price from product creation functionality
    * Discounts logic is based on the selected option of a configurable product
* CMS improvements:
   * Added a sticky header and controls to data grids
   * Added the support for multiple select in data grid filters
   * Added the ability to change column width in data grids
   * Added the ability of inline and bulk inline editing in data grids
* WebApi Framework improvements:
    * Added the support for store codes in API calls
    * Added the ability to update the Magento system to a particular version of Magento
    * Added the ability to enable/disable modules for Magento application
    * Added the ability to use maintenance mode
    * Introduced the common interface for Webapi payload processors
    * Moved the Search API from the Search module to the Search Framework library
* Framework improvements:
    * Refactored observer classes to implement the same interface
    * Added HHVM compatibility with the `intl` extension
    * Added the support for  PHP 7
    * Improved catalog image generation
    * Added the ability to store Magento code in the `vendor` directory
    * Added support for the URN  schema in configuration files
    * Implemented a new component for Model Windows to simplify input/modification data in pop-us
    * Implemented the gallery widget with MVP functionality in Global JS Widgets Library
    * Included the migration tool to Magento CLI
    * Added inline editing in data grids
    * Updated data grids mass actions
    * Added  the export  to data grids
    * Implemented the full text search in data grids in Admin
    * Applied finalized new data grid to Customer List
    * Removed the DesignEditor module and related code
    * Added Swagger REST API schema generation for automatic API documentation creation
    * Added the ability to generate a page that reports all REST APIs in the system
    * Added the Webapidoc module to generate on-the-fly API documentation for a particular Magento instance
    * Added the support for inline translation in Magento UI components
    * New data grid component applied on Sales data grid
    * Unified database resource connections interface
    * Implemented a mechanism for rendering escaped string
    * Added the ability to extend any Magento JS Component after it is loaded on the page and before it is executed
    * Added the @remove and @display attributes to handle block and container appearance
    * Added the ability to send the purge requests for multiple servers
    * Removed deprecated code from modules and Magento/Framework
    * Implemented the independent template hints for the storefront and the Admin panel
* Setup
    * Improved the wording in the Web Installation Wizard UI
    * Updated the extensions styles in the Web Installation Wizard
    * Added the ability to control access to the setup tool
    * Added the Install Components functionality for Web Installation Wizard
    * Updated styles
* Sample Data:
    * Improved sample data installation UX
    * Updated sample data with Product Heros, color swatches, MAP and rule based product relations
    * Improved sample data upgrade flow
    * Added the ability to log errors and set the error flag during sample data installation
* Various improvements:
    * Added integration with NewRelic
    * Added dashboard for Platinum integration partners
    * Improved downloadable products UI in the Admin panel in order to provide the same experience with all other product types
    * Implemented email templates responsiveness and localization
    * Implemented WebApi to retrieve store information, country list and currency information
    * Implemented discount coupon generation, search, and multi-actions APIs
    * Added the ability to declare filter components inside the data grid column definition
    * Added the console command `catalog:image:resize`
    * Consolidated the algorithms for populating system packages for upgrade and other tasks
    * Implemented various accessibility improvements
    * Improved UX for Tax Rule Management
    * The Luma theme became default storefront theme
    * Refactored grid store selectors for their unification
    * Refactored Magento UI Library to use the 'lib-' prefix in all library mixins
    * Refactored styles to eliminate log file errors after static files deployment is executed
    * Improved user experience on the backup pages of Component Manager
    * Increased JS and PHP code coverage with unit tests
    * Implemented the product attribute swatches functionality
* GitHub issues and requests:
    * [#1397](magento/magento2#1397) -- Allow multiple caplitalized words (like typical vendor names) in ACL resource IDs
    * [#1231](magento/magento2#1231) -- Update Cm_Cache_Backend_Redis to v1.8 and Credis_Client to v1.5
    * [#1375](magento/magento2#1375) -- Allow phrases to contain more than nine numeric placeholders
    * [#1454](magento/magento2#1454) -- Permissions not set correctly #1453
    * [#1410](magento/magento2#1410) -- Allow custom config files with virtual types only by adding generic schema locator
    * [#1416](magento/magento2#1416) -- Add abstract method execute() to \Magento\Framework\App\Action\Action
    * [#1406](magento/magento2#1406) -- Fixes issue with reading store config for store with code of 'default'
    * [#1447](magento/magento2#1447) -- Missing strings for Javascript Translations
    * [#1465](magento/magento2#1465) -- Fix typo: itno => into
    * [#1476](magento/magento2#1476) -- fix typo in dispatched event
    * [#1516](magento/magento2#1516) -- Typo in addAction function: _.findIdnex should be .findIndex
    * [#1533](magento/magento2#1533) -- Updated the broken dev doc links in the README.md
    * [#1469](magento/magento2#1469) -- Remove dependency of date renderer on global state locale
    * [#1462](magento/magento2#1462) -- Product collection - Add url rewrite from different website
    * [#1422](magento/magento2#1422) -- Improve \Magento\Framework\Api\SortOrder
    * [#1528](magento/magento2#1528) -- Really hide Pdf totals with zero amounts
    * [#1641](magento/magento2#1641) -- Update create-admin-account.phtml
    * [#1440](magento/magento2#1440) -- Update Console Tool Usage for Cache and Index Operations
    * [#1523](magento/magento2#1523) -- Permissions not set correctly
    * [#1517](magento/magento2#1517) -- add router.php for php Built-in webserver
    * [#1654](magento/magento2#1654) -- Update filter.phtml
    * [#1602](magento/magento2#1602) -- Improve product export performance
    * [#1062](magento/magento2#1062) -- Add check to see if PHP > 5.6 and always_populate_raw_post_data = -1
    * [#1496](magento/magento2#1496) -- Add "Not Specified" as a gender option when customer does not specify gender
    * [#1664](magento/magento2#1664) -- AbstractPdf::_getTotalsList - fix return comment
    * [#1502](magento/magento2#1502) -- Loosened Regex on GB postcodes
    * [#1801](magento/magento2#1801) -- Enable translation for gender
    * [#1835](magento/magento2#1835) -- Added exception to event data
    * [#1854](magento/magento2#1854) -- Added missing @method annotation for setWebsiteIds
    * [#1818](magento/magento2#1818) -- use return value instead of reference parameter
    * [#1206](magento/magento2#1206) -- Allow modules to live outside of app/code directory
    * [#1869](magento/magento2#1869) -- Typo in function name fixed (stove->store)
    * [#1792](magento/magento2#1792) -- Fix invalid @method phpdoc to prevent prophecy mocking error
    * [#1483](magento/magento2#1483) -- admin external extjs.com requests acknowledged bug CS needs update
    * [#1489](magento/magento2#1489) -- Russia is eligible PayPal merchant country but absent in Magento 2.0 "Merchant Country" dropdown
    * [#1461](magento/magento2#1461) -- Cart Items are not deleted after success checkout
    * [#1452](magento/magento2#1452) -- First two orders with sample data fail
    * [#1458](magento/magento2#1458) -- window.checkout is undefined if minicart is removed
    * [#1443](magento/magento2#1443) -- GET /V1/carts/mine/items is returning "cartId is a required field"
    * [#1442](magento/magento2#1442) -- Running 'log:clean' through cli results in an error: 'Area code not set'
    * [#1435](magento/magento2#1435) -- Fatal error: Class 'Magento\Framework\HTTP\Client_Curl' not found
    * [#1432](magento/magento2#1432) -- Doesn't work sorting in the search list.
    * [#460](magento/magento2#460) -- Optimization on Weee tax calculation
    * [#647](magento/magento2#647) -- Template path hints behavior
    * [#771](magento/magento2#771) -- Fatal error when calling execute()
    * [#896](magento/magento2#896) -- i18n generator generates dictionary with duplicated phrases
    * [#930](magento/magento2#930) -- Flushing cache fails to wipe view_preprocessed dir
    * [#933](magento/magento2#933) -- Admin fields that use WYSIWYG don't pass the js validation
    * [#939](magento/magento2#939) -- Inline Translation adds <span> within <head>
    * [#941](magento/magento2#941) -- [Question] How to get the currency code and symbol of an AbstractPrice?
    * [#1159](magento/magento2#1159) -- Warning: The email and password is visible in front-end
    * [#1167](magento/magento2#1167) -- Magento_Log: creating new record with wrong store_id every each refresh page for Adminhtml
    * [#1192](magento/magento2#1192) -- Error in monetary value Brazil
    * [#1367](magento/magento2#1367) -- String class name issue for php7
    * [#1242](magento/magento2#1242) -- eclipse pdt validator error
    * [#1279](magento/magento2#1279) -- related products not able to add to cart
    * [#1423](https://github.com/magento/magento2/issue/1423) -- Magento\Email\Model\Template\Filter Comment vs Code
    * [#1418](https://github.com/magento/magento2/issue/1418) -- Items in minicart are not cleared after successful placing an order
    * [#1408](https://github.com/magento/magento2/issue/1408) -- Error command cli setup:static-content:deploy
    * [#1396](https://github.com/magento/magento2/issue/1396) -- Products are not shown in category right after import

magento-team pushed a commit that referenced this issue Jul 28, 2017

Volodymyr Klymenko
Merge pull request #1367 from magento-troll/MAGETWO-70790
MAGETWO-70790: Cannot remove custom option
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment