magento / magento2

Prior to making any Submission(s), you must sign an Adobe Contributor License Agreement, available here at: https://opensource.adobe.com/cla.html. All Submissions you make to Adobe Inc. and its affiliates, assigns and subsidiaries (collectively “Adobe”) are subject to the terms of the Adobe Contributor License Agreement.
http://www.magento.com
Open Software License 3.0
11.45k stars 9.29k forks source link

Theme compilation breaks when mysql host contains port information #38799

Closed FilipeBicho closed 2 days ago

FilipeBicho commented 3 months ago

Preconditions and environment

Steps to reproduce

  1. Go to env.php
  2. Set the port information to the host in the db connection. e.g. db<'connection']['default']['host'] = 'localhost:3306'
  3. Execute ./magento.sh setup:static-content:deploy

Expected result

The theme is deployed

Actual result

Exception: Port must be configured within host parameter (like localhost:3306 in /var/www/lehner_dev/src/www/vendor/magento/framework/DB/Adapter/Pdo/Mysql.php:464

Additional information

Possible solution: ``{{ diff --git a/DB/Adapter/Pdo/Mysql.php b/DB/Adapter/Pdo/Mysql.php --- a/DB/Adapter/Pdo/Mysql.php (revision 2dc0b58888392ed5304ac6ad02e36a70e6e490a2) b/DB/Adapter/Pdo/Mysql.php (date 1717577596939) @@ -432,6 432,11 @@ $this->parentConnections[] = $this->_connection; $this->_connection = null; $this->pid = getmypid(); if (isset($this->config['port']) && !str_contains($this->config['host'], '/')) { if (!strcontains($this->config['host'], ':')) $this->config['host'] .= ':' . $this->config['port']; unset($this->_config['port']);

Release note

No response

Triage and priority

m2-assistant[bot] commented 3 months ago

Hi @FilipeBicho. Thank you for your report. To speed up processing of this issue, make sure that the issue is reproducible on the vanilla Magento instance following Steps to reproduce. To deploy vanilla Magento instance on our environment, Add a comment to the issue:

m2-assistant[bot] commented 3 months ago

Hi @engcom-Delta. Thank you for working on this issue. In order to make sure that issue has enough information and ready for development, please read and check the following instruction: :point_down:

engcom-Delta commented 3 months ago

Hi @FilipeBicho ,

Thanks for reporting and collaboration.

Verified the issue in magento 2.4-develop and 2.4.7 instance and the issue is not reproducible.

Steps to reproduce:-

1.Go to app-> etc->env.php 2.Set the port information to the host in the db connection. e.g. db['connection']['default']['host'] = 'localhost:3306' 3.Execute php bin/magento setup:static-content:deploy

Please refer the attached screenshots and let us know if we missed anything.

Screenshot 2024-06-07 at 12 46 00 AM

No error

Screenshot 2024-06-07 at 1 40 51 AM
mrodespin commented 2 months ago

I reproduced this error on a Magento Project that we recently updated to 2.4.7-p1. The steps to reproduce the error are:

  1. Flush the Magento cache, e.g. bin/magento c:f
  2. Set the port information to the host in the db connection. e.g. db['connection']['default']['host'] = 'localhost:3306'
  3. Run the compilation command using different jobs, like the following example

bin/magento setup:static-content:deploy --force --strategy standard --jobs 4

While this bug is not fixed there is a workaround to compile statics properly without using --jobs param

engcom-Delta commented 2 months ago

Hi @FilipeBicho ,

Verified the issue on 2.4.7 and it is reproducible.

Hence, Confirming the issue.

Steps to reproduce:-

1.Flush the Magento cache, e.g. bin/magento c:f 2.Go to app-> etc->env.php 3.Set the port information to the host in the db connection. e.g. db['connection']['default']['host'] = 'localhost:3306' 4.bin/magento setup:static-content:deploy --force --strategy standard --jobs 4

Flush the Magento cache

Screenshot 2024-06-18 at 8 04 33 PM

Set the port information to the host in the db connection. e.g. db['connection']['default']['host'] = 'localhost:3306'

Screenshot 2024-06-18 at 8 05 22 PM

Run bin/magento setup:static-content:deploy --force --strategy standard --jobs 4

Screenshot 2024-06-18 at 8 06 26 PM
github-jira-sync-bot commented 2 months ago

:white_check_mark: Jira issue https://jira.corp.adobe.com/browse/AC-12176 is successfully created for this GitHub issue.

m2-assistant[bot] commented 2 months ago

:white_check_mark: Confirmed by @engcom-Delta. Thank you for verifying the issue.
Issue Available: @engcom-Delta, You will be automatically unassigned. Contributors/Maintainers can claim this issue to continue. To reclaim and continue work, reassign the ticket to yourself.

mrodespin commented 2 months ago

I opened a PR to fix this issue -> https://github.com/magento/magento2/pull/38842

falko100 commented 1 month ago

Encountered the same problem. PR works for me.