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

"ZendForm" getting replaced in 3rd party module #93

Closed
patrick-braun opened this issue Apr 14, 2022 · 3 comments
Closed

"ZendForm" getting replaced in 3rd party module #93

patrick-braun opened this issue Apr 14, 2022 · 3 comments
Labels
Bug Something isn't working

Comments

@patrick-braun
Copy link

Bug Report

Q A
Version(s) 1.5.0, current commit (581d11f) as of this report

Summary

We have an internal module called KrumediaZendFormBinder which is getting renamed to KrumediaLaminasFormBinder which leads to a NotFound exception.

Current behavior

The phrase "ZendForm" is getting replaced in 3rd party modules.

How to reproduce

This is a failing test case which could be added to ReplacementsTest.php

yield 'MyZendForm' => [
    'MyZendFormBinder\Controller\Plugin\BinderPlugin',
    'MyZendFormBinder\Controller\Plugin\BinderPlugin',
];

Expected behavior

The ZendframeworkBridge does not touch 3rd party module names.

Potential fix

A potential fix could be adding

    'aZendForm' => 'aZendForm',
    'bZendForm' => 'bZendForm',
    'cZendForm' => 'cZendForm',
    'dZendForm' => 'dZendForm',
    'eZendForm' => 'eZendForm',
    'fZendForm' => 'fZendForm',
    'gZendForm' => 'gZendForm',
    'hZendForm' => 'hZendForm',
    'iZendForm' => 'iZendForm',
    'jZendForm' => 'jZendForm',
    'kZendForm' => 'kZendForm',
    'lZendForm' => 'lZendForm',
    'mZendForm' => 'mZendForm',
    'nZendForm' => 'nZendForm',
    'oZendForm' => 'oZendForm',
    'pZendForm' => 'pZendForm',
    'qZendForm' => 'qZendForm',
    'rZendForm' => 'rZendForm',
    'sZendForm' => 'sZendForm',
    'tZendForm' => 'tZendForm',
    'uZendForm' => 'uZendForm',
    'vZendForm' => 'vZendForm',
    'wZendForm' => 'wZendForm',
    'xZendForm' => 'xZendForm',
    'yZendForm' => 'yZendForm',
    'zZendForm' => 'zZendForm',

to the replacements.php rules. A similar batch is already in there for 'aZend' => 'aZend' etc.

Though I don't know if there is a case where SomethingZendForm actually needs to be replaced with SomethingLaminasForm.

I'd gladly send a PR with this fix (and test) if it results in the intended behavior.

@patrick-braun patrick-braun added the Bug Something isn't working label Apr 14, 2022
@Ocramius
Copy link
Member

Unclear to me what the problem is: a patch with a failing test case + potential fix would be very welcome, in order to better explain what is going on 👍

@patrick-braun
Copy link
Author

I have created a minimal project structure that errors out, the laminas-project is just the laminas-skeleton-application with the minimal controller plugin in custom-zend-form-binder.
composer install in both folders and the crash happens on opening the /application/test route.

If I add the
"CustomZendFormBinder" => "CustomZendFormBinder"
line to
laminas-project\vendor\laminas\laminas-zendframework-bridge\config\replacements.php
to block that replacement explicitely it does not crash anymore.

example-project.zip

@Ocramius
Copy link
Member

What's the observed crash?

Note: no, I can't check your example project - needs to be part of the test suite here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants