-
-
Notifications
You must be signed in to change notification settings - Fork 2k
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
[BUG] Conflict of C code #14426
Comments
After restarting php-fpm, my application successfully handle one request and show me rendered template, but second request is segmentation fault. |
Please follow this guide to understand how to generate the backtrace:
Did you build Phalcon from the source code? Could you please provide:
Would be useful to see views leads to segfault.
We need this line too. |
Thank you, Sergey. |
@TimurFlush If you need some assistance feel free to ping me at Discord. |
@ruudboon Thank you, but i can't speak english. Only write) |
@sergeyklay
Output of the phpize:
Output of the php-config:
Output of the php -v:
Enabled modules:
Web server name / version: nginx version: nginx/1.17.3
The way you install Phalcon:
Core dump: https://imgur.com/a/jbxzEEE |
@sergeyklay Can I tell with you in Discord? |
Yes, just ping me there |
Trace:
|
Without optimization on the php-fpm compiling
|
I'm very close. If i pass the third argument as $_POST:
will be the segfault in time during a call to an unknown problematic method from \Phalcon\Http\Messages\ServerRequest Without $_POST, the segfault is not occur, P.S. the ServerRequest pass to https://github.com/thephpleague/oauth2-server/blob/master/src/Grant/AuthCodeGrant.php#L242 |
@niden Please check |
Sure, I can rewrite the ServerRequestFactory and ServerRequest classes and try to find the problem, but all important methods in ServerRequestFactory is private( P.S: I can try to unlock private methods in the Factory class via Reflection and rewrite him, but it very long( |
I rewrite the ServerRequestFactory class, result of rewriting you can see by link https://imgur.com/a/N4M8ONe I quote @sergeyklay, him told that There are some problems with super global arrays in Zephir, so the $_SERVER php variable differs from the _SERVER zephir variable In the end, instead of the checkNullArray method returning an array, it returns undefined and occur the Segmentation Fault. I support him. |
This has been resolved @TimurFlush thank you for reporting this. Nice catch. The code is in the v4 branch so if you can please build from there and let us know if there are additional issues. |
@niden , i still have the segfault ( |
Maybe Zephir just incorrectly extracts these super global variables? |
If I pass the super global variables from php environment I don't get the segfault |
So to summarize: $factory = new \Phalcon\Http\Messages\ServerRequestFactory();
$req = $factory->load($_SERVER, $_GET, $_POST); No segfault $factory = new \Phalcon\Http\Messages\ServerRequestFactory();
$req = $factory->load($_SERVER, $_GET); Segfault ? |
These are the tests I have added: I am wondering if your superglobals are already defined but are null or something (especially $_POST) |
I got the segfault with the following code: $factory = new \Phalcon\Http\Messages\ServerRequestFactory();
$req = $factory->load($_SERVER, $_GET, $_POST); And i don't get segfault: $factory = new \Phalcon\Http\Messages\ServerRequestFactory();
$req = $factory->load($_SERVER, $_GET); OR $factory = new \Phalcon\Http\Messages\ServerRequestFactory();
$req = $factory->load($_SERVER, $_GET, $_POST, $_COOKIE, $_FILES); |
Until I don't understand the reason by this occur |
@niden, this segfault occur when I pass $_SERVER, $_GET, $_POST to ServerRequestFactory::load() and render a VOLT template via anonimous function in View\Simple::registerEngines(). |
Yet another the interest behavior If i will enable the OPCache extension then first request is successful, other requests give the segfault |
@TimurFlush Do me a favor please. You get the segfault by using this: $factory = new \Phalcon\Http\Messages\ServerRequestFactory();
$req = $factory->load($_SERVER, $_GET, $_POST); Can you |
@niden I have all three examples give a fatal error:
$factory = new \Phalcon\Http\Message\ServerRequestFactory();
$req = $factory->load($_SERVER, $_GET, $_POST);
$factory = new \Phalcon\Http\Message\ServerRequestFactory();
$req = $factory->load($_SERVER, $_GET);
$factory = new \Phalcon\Http\Message\ServerRequestFactory();
$req = $factory->load($_SERVER, $_GET, $_POST, $_COOKIE, $_FILES);
|
@ekmst This is not related to what @TimurFlush is experiencing. Your error comes from the calculation of the protocol when using the I can see that it is
there is a mishap with the logic in the code when we split the protocol to figure out its number. Since the code returns It is weird though because I wrote tests on that and they all passed. I will have a look at it again, maybe simplify the code a bit. This is where the error comes from: https://github.com/phalcon/cphalcon/blob/4.0.x/phalcon/Http/Message/ServerRequestFactory.zep#L486 |
@ekmst I just pushed a rework of the protocol detection. Would you mind checking it, to see if your error still persists? |
@niden |
@TimurFlush Thank you for this report. If this fixes your problem then let's close this issue and open one for further investigation with the code that does produce the segfault. I know Zephir doesn't like method properties in closures so we need to work on that. Perhaps they are related. In the new issue, if you can, can you please attach a sample script that we can work with? |
@niden, Yes. I think that we can close this issue, but a sample script only is my application which I will provide him you. |
Further investigation will be done here zephir-lang/zephir#1934 |
Hello.
I get a segmentation fault in my application, but i don't understand why:
So, I know that fault is happening in Phalcon\View or Phalcon\View\Volt, but I don't know exactly where =(
In xdebug trace i don't found nothing useful
Who can give me advice?
P.S. My phalcon version is 4.0.0-rc.1, php is 7.3.9, mac os.
The text was updated successfully, but these errors were encountered: