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

[WIP] Added a build for PHP 7.4 #18190

Closed
wants to merge 3 commits into from
Closed

[WIP] Added a build for PHP 7.4 #18190

wants to merge 3 commits into from

Conversation

mickaelandrieu
Copy link
Contributor

@mickaelandrieu mickaelandrieu commented Mar 17, 2020

Questions Answers
Branch? develop
Description? PHP 7.4 is already "mainstream", at least this version should be tested
Type? improvement
Category? CO
BC breaks? no
Deprecations? no
Fixed ticket? Address part of #16477.
How to test? Nothing to do: I'm pretty sure the build will fail, but it's the first step to provide support of this PHP version

This change is Reviewable

Got this result on my computer:

(base) ➜ PrestaShop git:(feature/php-74) composer install --no-suggest --ansi --prefer-dist
Loading composer repositories with package information
Installing dependencies (including require-dev) from lock file
Warning: The lock file is not up to date with the latest changes in composer.json. You may be getting outdated dependencies. Run update to update them.
Package operations: 195 installs, 0 updates, 0 removals

  • Installing composer/installers (v1.7.0): Downloading (100%)
  • Installing symfony/polyfill-ctype (v1.13.1): Downloading (100%)
  • Installing twig/twig (v1.42.4): Downloading (100%)
  • Installing paragonie/random_compat (v2.0.18): Downloading (100%)
  • Installing symfony/polyfill-php70 (v1.13.1): Downloading (100%)
  • Installing symfony/polyfill-util (v1.13.1): Downloading (100%)
  • Installing symfony/polyfill-php56 (v1.13.1): Downloading (100%)
  • Installing symfony/polyfill-mbstring (v1.13.1): Downloading (100%)
  • Installing symfony/symfony (v3.4.37): Downloading (100%)
  • Installing symfony/polyfill-intl-icu (v1.13.1): Downloading (100%)
  • Installing symfony/polyfill-apcu (v1.13.1): Downloading (100%)
  • Installing psr/simple-cache (1.0.1): Downloading (100%)
  • Installing psr/log (1.1.2): Loading from cache
  • Installing psr/link (1.0.0): Downloading (100%)
  • Installing psr/container (1.0.0): Loading from cache
  • Installing psr/cache (1.0.1): Loading from cache
  • Installing fig/link-util (1.1.0): Downloading (100%)
  • Installing doctrine/lexer (1.0.2): Loading from cache
  • Installing doctrine/annotations (v1.8.0): Loading from cache
  • Installing doctrine/reflection (v1.1.0): Downloading (100%)
  • Installing doctrine/event-manager (1.1.0): Downloading (100%)
  • Installing doctrine/collections (1.6.4): Downloading (100%)
  • Installing doctrine/cache (1.10.0): Downloading (100%)
  • Installing doctrine/persistence (1.3.5): Downloading (100%)
  • Installing doctrine/inflector (1.3.1): Downloading (100%)
  • Installing doctrine/common (2.12.0): Downloading (100%)
  • Installing doctrine/instantiator (1.3.0): Loading from cache
  • Installing doctrine/dbal (v2.9.3): Downloading (100%)
  • Installing doctrine/orm (v2.7.0): Downloading (100%)
  • Installing beberlei/doctrineextensions (v1.2.6): Downloading (100%)
  • Installing react/promise (v2.7.1): Downloading (100%)
  • Installing guzzlehttp/streams (3.0.0): Downloading (100%)
  • Installing guzzlehttp/ringphp (1.1.1): Downloading (100%)
  • Installing guzzlehttp/guzzle (5.3.4): Downloading (100%)
  • Installing guzzlehttp/log-subscriber (1.0.1): Downloading (100%)
  • Installing csa/guzzle-bundle (v1.3.0): Downloading (100%)
  • Installing cssjanus/cssjanus (dev-patch-1 7866b8a): Downloading (100%)
  • Installing curl/curl (1.9.3): Downloading (100%)
  • Installing defuse/php-encryption (2.0.3): Downloading (100%)
  • Installing symfony/service-contracts (v1.1.8): Loading from cache
  • Installing jdorn/sql-formatter (v1.2.17): Downloading (100%)
  • Installing doctrine/doctrine-cache-bundle (1.4.0): Downloading (100%)
  • Installing doctrine/doctrine-bundle (1.12.6): Downloading (100%)
  • Installing egulias/email-validator (2.1.14): Downloading (100%)
  • Installing ezyang/htmlpurifier (v4.12.0): Downloading (100%)
  • Installing willdurand/jsonp-callback-validator (v1.1.0): Downloading (100%)
  • Installing friendsofsymfony/jsrouting-bundle (2.5.3): Downloading (100%)
  • Installing composer/ca-bundle (1.2.6): Downloading (100%)
  • Installing maxmind/web-service-common (v0.6.0): Downloading (100%)
  • Installing maxmind-db/reader (v1.6.0): Downloading (100%)
  • Installing geoip2/geoip2 (v2.4.5): Downloading (100%)
  • Installing greenlion/php-sql-parser (4.3.0): Downloading (100%)
  • Installing incenteev/composer-parameter-handler (v2.1.3): Downloading (100%)
  • Installing ircmaxell/password-compat (v1.0.4): Downloading (100%)
  • Installing ircmaxell/security-lib (v1.1.0): Downloading (100%)
  • Installing ircmaxell/random-lib (v1.2.0): Downloading (100%)
  • Installing jakeasmith/http_build_url (1.0.1): Downloading (100%)
  • Installing league/tactician (v1.0.3): Downloading (100%)
  • Installing league/tactician-logger (v0.10.0): Downloading (100%)
  • Installing league/tactician-container (2.0.0): Downloading (100%)
  • Installing league/tactician-bundle (v1.2.0): Downloading (100%)
  • Installing martinlindhe/php-mb-helpers (0.1.6): Downloading (100%)
  • Installing matthiasmullie/path-converter (1.1.2): Downloading (100%)
  • Installing matthiasmullie/minify (1.3.62): Downloading (100%)
  • Installing mobiledetect/mobiledetectlib (2.8.34): Downloading (100%)
  • Installing mrclay/minify (2.3.3): Downloading (100%)
  • Installing pear/pear_exception (v1.0.1): Downloading (100%)
  • Installing pear/console_getopt (v1.4.3): Downloading (100%)
  • Installing pear/pear-core-minimal (v1.10.10): Downloading (100%)
  • Installing pear/archive_tar (1.4.9): Downloading (100%)
  • Installing pelago/emogrifier (v2.2.0): Downloading (100%)
  • Installing markbaker/matrix (1.2.0): Downloading (100%)
  • Installing markbaker/complex (1.4.7): Downloading (100%)
  • Installing phpoffice/phpspreadsheet (1.10.1): Downloading (100%)
  • Installing prestashop/circuit-breaker (v3.0.0): Downloading (100%)
  • Installing guzzlehttp/cache-subscriber (0.2.0): Downloading (100%)
  • Installing prestashop/blockreassurance (v4.1.1): Downloading (100%)
  • Installing prestashop/contactform (v4.1.1): Downloading (100%)
  • Installing prestashop/dashactivity (v2.0.2): Downloading (100%)
  • Installing prestashop/dashgoals (v2.0.2): Downloading (100%)
  • Installing prestashop/dashproducts (v2.0.4): Downloading (100%)
  • Installing prestashop/dashtrends (v2.0.2): Downloading (100%)
  • Installing prestashop/decimal (1.2.0): Downloading (100%)
  • Installing prestashop/graphnvd3 (v2.0.1): Downloading (100%)
  • Installing prestashop/gridhtml (v2.0.0): Downloading (100%)
  • Installing prestashop/gsitemap (v4.1.0): Downloading (100%)
  • Installing prestashop/pagesnotfound (v2.0.0): Downloading (100%)
  • Installing prestashop/productcomments (v4.0.1): Downloading (100%)
  • Installing prestashop/ps_banner (v2.1.0): Downloading (100%)
  • Installing prestashop/ps_categorytree (v2.0.0): Downloading (100%)
  • Installing prestashop/ps_checkpayment (v2.0.4): Downloading (100%)
  • Installing prestashop/ps_contactinfo (v3.2.0): Downloading (100%)
  • Installing prestashop/ps_crossselling (v2.0.0): Downloading (100%)
  • Installing prestashop/ps_currencyselector (v2.0.1): Downloading (100%)
  • Installing prestashop/ps_customeraccountlinks (v3.1.0): Downloading (100%)
  • Installing prestashop/ps_customersignin (v2.0.2): Downloading (100%)
  • Installing prestashop/ps_customtext (v4.1.0): Downloading (100%)
  • Installing prestashop/ps_dataprivacy (v2.0.0): Downloading (100%)
  • Installing prestashop/ps_emailsubscription (v2.5.0): Downloading (100%)
  • Installing prestashop/ps_facetedsearch (v3.4.1): Downloading (100%)
  • Installing prestashop/ps_faviconnotificationbo (v2.0.0): Downloading (100%)
  • Installing prestashop/ps_featuredproducts (v2.0.0): Downloading (100%)
  • Installing prestashop/ps_imageslider (v3.0.0): Downloading (100%)
  • Installing prestashop/ps_languageselector (v2.0.2): Downloading (100%)
  • Installing prestashop/ps_linklist (3.0.4): Downloading (100%)
  • Installing prestashop/ps_mainmenu (v2.1.1): Downloading (100%)
  • Installing prestashop/ps_searchbar (v2.0.1): Downloading (100%)
  • Installing prestashop/ps_sharebuttons (v2.0.1): Downloading (100%)
  • Installing prestashop/ps_shoppingcart (v2.0.3): Downloading (100%)
  • Installing prestashop/ps_socialfollow (v2.0.0): Downloading (100%)
  • Installing prestashop/ps_themecusto (v1.1.0): Downloading (100%)
  • Installing prestashop/ps_wirepayment (v2.0.4): Downloading (100%)
  • Installing prestashop/sekeywords (v2.0.0): Downloading (100%)
  • Installing prestashop/statsbestcategories (v2.0.0): Downloading (100%)
  • Installing prestashop/statsbestcustomers (v2.0.2): Downloading (100%)
  • Installing prestashop/statsbestmanufacturers (v2.0.0): Downloading (100%)
  • Installing prestashop/statsbestproducts (v2.0.0): Downloading (100%)
  • Installing prestashop/statsbestsuppliers (v2.0.0): Downloading (100%)
  • Installing prestashop/statsbestvouchers (v2.0.0): Downloading (100%)
  • Installing prestashop/statscarrier (v2.0.0): Downloading (100%)
  • Installing prestashop/statscatalog (v2.0.1): Downloading (100%)
  • Installing prestashop/statscheckup (v2.0.1): Downloading (100%)
  • Installing prestashop/statsdata (v2.0.0): Downloading (100%)
  • Installing prestashop/statsequipment (v2.0.0): Downloading (100%)
  • Installing prestashop/statsforecast (v2.0.3): Downloading (100%)
  • Installing prestashop/statslive (v2.0.2): Downloading (100%)
  • Installing prestashop/statsnewsletter (v2.0.2): Downloading (100%)
  • Installing prestashop/statsorigin (v2.0.2): Downloading (100%)
  • Installing prestashop/statspersonalinfos (v2.0.2): Downloading (100%)
  • Installing prestashop/statsproduct (v2.0.3): Downloading (100%)
  • Installing prestashop/statsregistrations (v2.0.0): Downloading (100%)
  • Installing prestashop/statssales (v2.0.0): Downloading (100%)
  • Installing prestashop/statssearch (v2.0.1): Downloading (100%)
  • Installing prestashop/statsstock (v2.0.0): Downloading (100%)
  • Installing prestashop/statsvisits (v2.0.2): Downloading (100%)
  • Installing smarty/smarty (v3.1.34): Downloading (100%)
  • Installing nikic/php-parser (v4.3.0): Downloading (100%)
  • Installing prestashop/translationtools-bundle (v4.0.3): Downloading (100%)
  • Installing prestashop/welcome (v6.0.0): Downloading (100%)
  • Installing symfony/polyfill-php72 (v1.13.1): Downloading (100%)
  • Installing symfony/polyfill-intl-idn (v1.13.1): Downloading (100%)
  • Installing symfony/mime (v4.4.2): Downloading (100%)
  • Installing symfony/polyfill-php73 (v1.13.1): Downloading (100%)
  • Installing symfony/http-client-contracts (v1.1.8): Loading from cache
  • Installing symfony/http-client (v4.4.2): Downloading (100%)
  • Installing sensiolabs/security-checker (v6.0.3): Loading from cache
  • Installing sensio/distribution-bundle (v5.0.25): Downloading (100%)
  • Installing sensio/framework-extra-bundle (v5.4.1): Loading from cache
  • Installing shudrum/array-finder (v1.1.0): Downloading (100%)
  • Installing soundasleep/html2text (0.5.0): Downloading (100%)
  • Installing monolog/monolog (1.25.3): Downloading (100%)
  • Installing symfony/monolog-bundle (v3.5.0): Downloading (100%)
  • Installing symfony/polyfill-iconv (v1.13.1): Downloading (100%)
  • Installing swiftmailer/swiftmailer (v6.2.3): Downloading (100%)
  • Installing symfony/swiftmailer-bundle (v3.2.6): Downloading (100%)
  • Installing tecnickcom/tcpdf (6.3.2): Downloading (100%)
  • Installing tijsverkoyen/css-to-inline-styles (2.2.2): Downloading (100%)
  • Installing container-interop/container-interop (1.2.0): Downloading (100%)
  • Installing behat/transliterator (v1.3.0): Downloading (100%)
  • Installing behat/gherkin (v4.6.0): Downloading (100%)
  • Installing behat/behat (v3.5.0): Downloading (100%)
  • Installing php-cs-fixer/diff (v1.3.0): Downloading (100%)
  • Installing composer/xdebug-handler (1.4.0): Loading from cache
  • Installing composer/semver (1.5.1): Downloading (100%)
  • Installing friendsofphp/php-cs-fixer (v2.16.1): Downloading (100%)
  • Installing sebastian/version (2.0.1): Downloading (100%)
  • Installing sebastian/resource-operations (2.0.1): Downloading (100%)
  • Installing sebastian/recursion-context (3.0.0): Downloading (100%)
  • Installing sebastian/object-reflector (1.1.1): Downloading (100%)
  • Installing sebastian/object-enumerator (3.0.3): Downloading (100%)
  • Installing sebastian/global-state (2.0.0): Downloading (100%)
  • Installing sebastian/exporter (3.1.2): Loading from cache
  • Installing sebastian/environment (4.2.3): Downloading (100%)
  • Installing sebastian/diff (3.0.2): Downloading (100%)
  • Installing sebastian/comparator (3.0.2): Downloading (100%)
  • Installing phpunit/php-timer (2.1.2): Loading from cache
  • Installing phpunit/php-text-template (1.2.1): Downloading (100%)
  • Installing phpunit/php-file-iterator (2.0.2): Downloading (100%)
  • Installing theseer/tokenizer (1.1.3): Loading from cache
  • Installing sebastian/code-unit-reverse-lookup (1.0.1): Downloading (100%)
  • Installing phpunit/php-token-stream (3.1.1): Loading from cache
  • Installing phpunit/php-code-coverage (6.1.4): Downloading (100%)
  • Installing webmozart/assert (1.6.0): Downloading (100%)
  • Installing phpdocumentor/reflection-common (2.0.0): Loading from cache
  • Installing phpdocumentor/type-resolver (1.0.1): Loading from cache
  • Installing phpdocumentor/reflection-docblock (4.3.4): Downloading (100%)
  • Installing phpspec/prophecy (1.10.1): Downloading (100%)
  • Installing phar-io/version (2.0.1): Downloading (100%)
  • Installing phar-io/manifest (1.0.3): Downloading (100%)
  • Installing myclabs/deep-copy (1.9.4): Downloading (100%)
  • Installing phpunit/phpunit (7.5.20): Downloading (100%)
  • Installing johnkary/phpunit-speedtrap (v3.1.0): Downloading (100%)
  • Installing mikey179/vfsstream (v1.6.8): Downloading (100%)
  • Installing phake/phake (v3.1.7): Downloading (100%)
  • Installing symfony/phpunit-bridge (v3.4.36): Downloading (100%)
    Package container-interop/container-interop is abandoned, you should avoid using it. Use psr/container instead.
    Generating autoload files

Sensio\Bundle\DistributionBundle\Composer\ScriptHandler::buildBootstrap
Sensio\Bundle\DistributionBundle\Composer\ScriptHandler::prepareDeploymentTarget

(base) ➜ PrestaShop git:(feature/php-74) php -v
PHP 7.4.3 (cli) (built: Feb 23 2020 07:24:28) ( NTS )
Copyright (c) The PHP Group
Zend Engine v3.4.0, Copyright (c) Zend Technologies
with Zend OPcache v7.4.3, Copyright (c), by Zend Technologies

@mickaelandrieu mickaelandrieu requested a review from a team as a code owner March 17, 2020 22:45
@prestonBot prestonBot added develop Branch Improvement Type: Improvement labels Mar 17, 2020
Copy link
Contributor

@mvorisek mvorisek left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This PR does not fix/close issue #16477, but otherwise good job!

@mickaelandrieu
Copy link
Contributor Author

mickaelandrieu commented Mar 17, 2020

True, I've updated the PR description.

Sadly, for some reason Composer fails to install the dependencies on the build.

Progi1984
Progi1984 previously approved these changes Mar 18, 2020
@PierreRambaud
Copy link
Contributor

I think this pull request is useless right now.
We can't do anything on PHP7.4 because of

PHP Deprecated:  array_key_exists(): Using array_key_exists() on objects is deprecated. Use isset() or property_exists() instead in /home/got/projects/prestashop/source/develop/src/Adapter/EntityMapper.php on line 99
PHP Stack trace:
PHP   1. {main}() /home/got/projects/prestashop/source/develop/bin/console:0
PHP   2. require_once() /home/got/projects/prestashop/source/develop/bin/console:15
PHP   3. ShopCore::initialize() /home/got/projects/prestashop/source/develop/config/config.inc.php:118
PHP   4. Shop->__construct() /home/got/projects/prestashop/source/develop/classes/shop/Shop.php:391
PHP   5. Shop->__construct() /home/got/projects/prestashop/source/develop/classes/shop/Shop.php:128
PHP   6. PrestaShop\PrestaShop\Adapter\EntityMapper->load() /home/got/projects/prestashop/source/develop/classes/ObjectModel.php:264
PHP   7. array_key_exists() /home/got/projects/prestashop/source/develop/src/Adapter/EntityMapper.php:99

Deprecated: array_key_exists(): Using array_key_exists() on objects is deprecated. Use isset() or property_exists() instead in /home/got/projects/prestashop/source/develop/src/Adapter/EntityMapper.php on line 99

Copy link
Contributor

@PierreRambaud PierreRambaud left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not a good idea to stack job on something we already know on failure

@mvorisek
Copy link
Contributor

@mickaelandrieu Please modify the Travis to install the required extensions for PHP 7.4 - see why the install is failing: https://travis-ci.com/github/PrestaShop/PrestaShop/jobs/299332277

@PierreRambaud Yes, very few basic/core issues need to be fixed. But failing is otherwise ok to me as it adds value for anyone who is contributing by letting them know if changes improved the code for future PHP version or not.

@mickaelandrieu
Copy link
Contributor Author

Hi, I can improve the pull request but I need to know if there is a chance to be merged.

Everyone's time is precious, I don't want to waste mine on something that will stay stalled for months and closed in the end.

I'm able to fix the "PHP extensions" part of the issue, I'm less easy spending my time fighting with my old mates on what should be done for a first pull request to support PHP 7.4.

So ... let me know when your decision is done ^o^

@eternoendless
Copy link
Member

Hi @mickaelandrieu and thank you for your contribution.

I think this would make more sense to do at the same time as the modifications needed for that test to pass. Just adding a failing test (that we already know won't pass) doesn't add much value IMO, and will eat up Travis resources for nothing. If you feel motivated to start working on the PHP 7.4 compatibility, please by all means do so. If you don't feel like it or if you don't have the time, then I think it's better to close this one. Up to you mate 🙂

@mvorisek
Copy link
Contributor

mvorisek commented Mar 19, 2020

@mickaelandrieu The extensions are not available as very old Ubuntu dist was used - my PR #18214 fixes it, please rebase this PR on it.

I would say the right time to merge this PR once the PrestaShop installation will be passing and the unit tests can be evaluated.

@mvorisek
Copy link
Contributor

How can I obtain a write/maintainer access to PrestaShop so I can participate on PRs like this?

@matks
Copy link
Contributor

matks commented Mar 21, 2020

How can I obtain a write/maintainer access to PrestaShop so I can participate on PRs like this?

In order to be able to add commits to any contribution branch you must become a maintainer. So far in history it never happened someone that was not an employee of PrestaShop company could become maintainer but we aim to change this in 2020.

However an easier way is to make a Pull Request from your fork to the contributor fork. Last week, @PululuK contributed to one of my PRs by opening a Pull Request that targeted my own fork instead of PrestaShop repository. Then you become contributor of the author fork and the author can review and merge your contribution to his own branch.

@PululuK
Copy link
Member

PululuK commented Mar 21, 2020

In order to be able to add commits to any contribution branch you must become a maintainer. So far in history it never happened someone that was not an employee of PrestaShop company could become maintainer but we aim to change this in 2020.

🧐

@@ -82,7 +82,7 @@ public function load($id, $id_lang, $entity, $entity_defs, $id_shop, $should_cac
if ($object_datas_lang = Db::getInstance()->executeS($sql)) {
foreach ($object_datas_lang as $row) {
foreach ($row as $key => $value) {
if ($key != $entity_defs['primary'] && array_key_exists($key, $entity)) {
if ($key != $entity_defs['primary'] && isset($entity, $key)) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Won't work. isset will disable null value, and we sometimes want null values

Copy link
Contributor

@mvorisek mvorisek Mar 24, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What you want is probably property_exists()

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

property_exists function bugs with protected properties sadly.

@@ -95,8 +95,7 @@ public function load($id, $id_lang, $entity, $entity_defs, $id_shop, $should_cac
}
$entity->id = (int) $id;
foreach ($object_datas as $key => $value) {
if (array_key_exists($key, $entity_defs['fields'])
|| array_key_exists($key, $entity)) {
if (isset($entity_defs['fields'][$key]) || isset($entity, $key)) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same here, we want null values

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah yeah, I introduce back my uses of property_exists and ... time to go.

WIP label added.

@mickaelandrieu mickaelandrieu added the WIP Status: Work In Progress label Mar 24, 2020
@mickaelandrieu mickaelandrieu changed the title Added a build for PHP 7.4 (Allowed to fail) [WIP] Added a build for PHP 7.4 Mar 24, 2020
@mickaelandrieu
Copy link
Contributor Author

I will never have enough time to focus on such big contributions sadly :/

Closed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
develop Branch Improvement Type: Improvement WIP Status: Work In Progress
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

8 participants