magento / magento2-functional-testing-framework

Magento2 Functional Testing Framework
Other
155 stars 133 forks source link

Magento fails with xdebug 3 due to mftf #808

Closed kandy closed 3 years ago

kandy commented 3 years ago

Preconditions

  1. Install xdebug 3 (RC1+) and enable it

Steps to reproduce

  1. Run bin/magento

Expected result

  1. List of available command is printed

Actual result

PHP Fatal error:  Uncaught Error: Call to undefined function xdebug_disable() in /magento/vendor/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/_bootstrap.php:81
Stack trace:
#0 /magento/vendor/composer/autoload_real.php(73): require()
#1 /magento/vendor/composer/autoload_real.php(63): composerRequire4012c480a3949eb57e5b1ec1b7b5c42b('eda65932675b68b...', '/magento/vendor...')
#2 /magento/vendor/autoload.php(7): ComposerAutoloaderInit4012c480a3949eb57e5b1ec1b7b5c42b::getLoader()
#3 /magento/app/autoload.php(51): include('/magento/vendor...')
#4 /magento/app/bootstrap.php(33): require_once('/magento/app/au...')
#5 /magento/bin/magento(14): require('/magento/app/bo...')
#6 {main}
  thrown in /magento/vendor/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/_bootstrap.php on line 81

see for details https://3.xdebug.org/docs/upgrade_guide

m2-assistant[bot] commented 3 years ago

Hi @kandy. Thank you for your report. To help us process this issue please make sure that you provided sufficient information.

Please, add a comment to assign the issue: @magento I am working on this


jilu1 commented 3 years ago

@kandy Thank you for your report! https://jira.corp.magento.com/browse/MQE-2391 has been created. Please check comments in MQE-2391 and let us know if this needs immediate attention.

convenient commented 3 years ago

A bunch of our test suites started failing in travis because of this error.

I think travis has likely started bundling xdebug 3 or something like that.

before_install:
  - phpenv config-rm xdebug.ini || true

I have slipped this into our .travis.yml and the suites are running again.

jilu1 commented 3 years ago

@convenient It's good to know you have a solution! If your problem is the same as this xdebug_disable() in _bootstrap.php, it's been fixed and available in develop branch. No planned release date yet.

densen45 commented 3 years ago

@tuyennn I think these are the two commits you asked for:

e95fb10d3a55d72af5d60e07703d09201812599e 6d6a7c59fc789625345c0b7b071fe08ea68b487b

Please, correct me, if I'm wrong.

tuyennn commented 3 years ago

@densen45 @jilu1 hopefully the release could start soon

khanhnhat1660407 commented 3 years ago

https://xdebug.org/docs/upgrade_guide image

Ddcdom commented 3 years ago

xdebug_disable is only called if both MFTF debugging is disabled and the Xdebug module is loaded. Its possible to enable MFTF debugging by adding/editing the file dev/tests/acceptance/.env and adding the line MFTF_DEBUG = 1 I've done this in my dev environment, but as I don't understand the consequences of enabling MFTF debugging I have not enabled it in my production environment. However, as I don't have Xdebug installed in my production environment, this is not an issue.

larsroettig commented 3 years ago

@jilu1 @kandy Pls Realse ASAP most Partners use Integration,Static, Mftf Tests on CI-System and Local all our tests are RED beausce of this issue. Build Patch for us and need to apply them now to all our customers

azambon commented 3 years ago

Not only bin/magento fails, also web requests crash with xdebug 3. Which means that it's impossibile to debug web requests with xdebug 3

larsroettig commented 3 years ago

@azambon Yea because most thinks runs over this _bootstrap.php in dev mode :sweat_smile:

We created a Patch for our vendor folder fixed all problems for us: https://github.com/magento/magento2-functional-testing-framework/commit/e95fb10d3a55d72af5d60e07703d09201812599e

From e95fb10d3a55d72af5d60e07703d09201812599e Mon Sep 17 00:00:00 2001
From: Ji Lu <jilu1@adobe.com>
Date: Wed, 18 Nov 2020 12:18:26 -0600
Subject: [PATCH] MQE-2391: [GitHub Issue] Magento fails with xdebug 3
---
--- vendor/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/_bootstrap.php
+++ vendor/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/_bootstrap.php
@@ -77,6 +77,3 @@

 // add the debug flag here
 $debugMode = $_ENV['MFTF_DEBUG'] ?? false;
-if (!(bool)$debugMode && extension_loaded('xdebug')) {
-    xdebug_disable();
-}
lfluvisotto commented 3 years ago

vendor/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/_bootstrap.php

Replace:

if (!(bool)$debugMode && extension_loaded('xdebug')) {
    xdebug_disable();
}

By:

if (!(bool)$debugMode && extension_loaded('xdebug')) {
    if (function_exists('xdebug_disable')) {
        xdebug_disable();
    }
}
jilu1 commented 3 years ago

@larsroettig @tuyennn @lfluvisotto Thanks for the information! We will try to release a patch soon.

larsroettig commented 3 years ago

Would be so nice thanks in advance :+1:

larsroettig commented 3 years ago

@lfluvisotto you dont need open a PR is already fixed but not released

jilu1 commented 3 years ago

Here is the fix, please let us know if you see any other issue. https://github.com/magento/magento2-functional-testing-framework/commit/f99fbbcf19a11822ff16a493dd30fbaf2edeb296

larsroettig commented 3 years ago

Here is the fix, please let us know if you see any other issue. f99fbbc

This fix works fine for us

Lmarcho commented 3 years ago

Here is the fix, please let us know if you see any other issue. f99fbbc

after this fix xdebug is not working on that project :disappointed:

jilu1 commented 3 years ago

@Lmarcho Could you provide more details?

The fix is not to disable xdebug and I don't think it will affect how xdebug works.

jilu1 commented 3 years ago

This is now available in 3.2.1

TheRealHunzik commented 3 years ago

Working Solution :

Open xdebug.ini in your favorite Editor

Add These Lines

xdebug.mode=debug
xdebug.client_port=9000

Your Debugger will start Working