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

Handling a module twice causes class already exists error #13724

Closed
npfedwards opened this issue Dec 31, 2018 · 0 comments
Closed

Handling a module twice causes class already exists error #13724

npfedwards opened this issue Dec 31, 2018 · 0 comments
Labels
bug A bug report status: medium Medium

Comments

@npfedwards
Copy link
Contributor

Expected and Actual Behavior

This is very much an edge case and may only ever show up in testing, however, it does appear to be a bug.

Consider the following code (assuming we have the appropriate Main tasks set up)

$console = new Cli\Console($di);
$console->registerModules(
            [
                "frontend" => [
                    "className" => "Phalcon\\Test\\Modules\\Frontend\\Module",
                    "path" => __DIR__ . "/../../../_data/modules/frontend/Module.php",
                ]
            ]
        );
$console->handle(["module"=>"frontend"]);
$console = new Cli\Console($di);
$console->registerModules(
            [
                "frontend" => [
                    "className" => "Phalcon\\Test\\Modules\\Frontend\\Module",
                    "path" => __DIR__ . "/../../../_data/modules/frontend/Module.php",
                ]
            ]
        );
$console->handle(["module"=>"frontend"]);

One would expect this to run the main task twice, but on the second handle() we get a class already exists error. Removing the "path" argument fixes this, but we should be using a require_once (or Zephir equivalent).

Details

  • Phalcon version: 4.0.x
  • PHP Version: 7.2.13
  • Operating System: nanobox
npfedwards added a commit to npfedwards/cphalcon that referenced this issue Jan 6, 2019
@npfedwards npfedwards mentioned this issue Jan 6, 2019
3 tasks
niden added a commit that referenced this issue Jan 10, 2019
…into npfedwards-phalcon-4.0.x

* 'phalcon-4.0.x' of https://github.com/npfedwards/cphalcon:
  Add to changelog and split out tests
  Fix for #13724
  Update docblocks
  Fix most of the issues
  PHPCS fixes
  Final Cli Console tests
  __get() test and Set Argument test working. Still to do HandleCest
  Getting there on Cli\Console tests.
niden added a commit that referenced this issue Jan 10, 2019
* npfedwards-phalcon-4.0.x:
  Add to changelog and split out tests
  Fix for #13724
  Update docblocks
  Fix most of the issues
  PHPCS fixes
  Final Cli Console tests
  __get() test and Set Argument test working. Still to do HandleCest
  Getting there on Cli\Console tests.
@niden niden added the 4.0 label Jun 21, 2019
@niden niden added bug A bug report status: medium Medium and removed Bug - Medium labels Dec 23, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug A bug report status: medium Medium
Projects
None yet
Development

No branches or pull requests

2 participants