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

DOPPELGAENGER process fails to handle spaces between function and the function name #1121

Closed
jefkin opened this issue May 9, 2019 · 1 comment
Assignees
Labels

Comments

@jefkin
Copy link

jefkin commented May 9, 2019

DOPPELGAENGER process fails to handle additional spaces between the 'function' keyword and the function name.

Worse, this is a silent failure at startup, appearing to be a good setup for the app, but leading to 500 errors on access to the app servlets like:
exception 'AppserverIo\Psr\Servlet\ServletException' with message 'Please configure an error page for status code 500' in /opt/appserver/src/AppserverIo/Appserver/ServletEngine/Utils/ErrorUtil.php:291
Stack trace:
#0 /opt/appserver/src/AppserverIo/Appserver/ServletEngine/RequestHandler.php(263): AppserverIo\Appserver\ServletEngine\Utils\ErrorUtil->handleErrors(Object(AppserverIo\Appserver\ServletEngine\RequestHandler),
Object(AppserverIo\Appserver\ServletEngine\Http\Request), Object(AppserverIo\Appserver\ServletEngine\Http\Response))

#1 [internal function]: AppserverIo\Appserver\ServletEngine\RequestHandler->shutdown()

#2 {main}

The PHP error log reports:
[09-May-2019 15:44:53 Europe/Berlin] PHP Fatal error: Cannot redeclare <appname><servlet>::doGet() in /opt/appserver/var/tmp/localhost//cache/<cached_Servlet_name>.php on line 85

Examining the cached file, in comparison to other working class files revealed that there were two entries for doGet, the original one (WITHOUT the DOPPELGAENGEROriginal suffix) and the one created by the Doppelgaenger process.

Probably the issue here is two fold:

  1. The Doppelgaenger process doesn't match the original function name (probably a regex issue, if I were to be assumptive)
  2. The Doppelgaenger process doesn't catch the situation in which the above matching failed, leaving the code in a bad state with duplicate method names.
@wick-ed
Copy link
Member

wick-ed commented May 14, 2019

Hi @jefkin

thanks for reporting the bug!

Your assumption was correct, there are a sub-optimal regex in use within the function substitution logic.
The issue will be fixed with release 1.7.3 of the doppelgaenger library.

Best regards, Bernhard

@wick-ed wick-ed closed this as completed May 14, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants