Bug #71129 [Com]: Segmentation fault on ZTS Embed SAPI

From: Date: Mon, 16 Jan 2017 16:43:57 +0000
Subject: Bug #71129 [Com]: Segmentation fault on ZTS Embed SAPI
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-206687@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=71129&edit=1

 ID:                 71129
 Comment by:         ejrx7753 at gmail dot com
 Reported by:        maroszek at gmx dot net
 Summary:            Segmentation fault on ZTS Embed SAPI
 Status:             Re-Opened
 Type:               Bug
 Package:            Reproducible crash
 Operating System:   OS X 10.11
 PHP Version:        7.0.0
 Block user comment: N
 Private report:     N

 New Comment:

Confirmed that using the code

    int argc2 = 1;
    char* text = "embed4";
    char *argv2[2] = { text, NULL };
    php_embed_init(argc2, argv2);

to replace sapi_startup and php_embed_module.startup and deleting the "php_embed_module"
struct (duplicate symbol error) allows the code to work.

I have created a sample file which can test both versions (http://pastebin.com/8sHjP9Jy).

When run with

#define TEST1 0

the test fails, but when run with

#define TEST1 1

it passses. In my case, the script was "echo 1" and proceeded to give an infinite loop of
1s to the std out. The question also needs addressing whether or not we can set the embed module
elements and use embed init. I think so, but it is another difference between the code peices.


Previous Comments:
------------------------------------------------------------------------
[2017-01-16 16:27:53] ejrx7753 at gmail dot com

I forgot to write the result -> "I tested the code sample" and found that it still
segfaults.

------------------------------------------------------------------------
[2017-01-16 16:26:03] ejrx7753 at gmail dot com

I have tested the code sample (https://gist.github.com/paresy/b4babb919a86e9764bc4) with OS X 10.12
and PHP 7.1.0, built with embed as a static library.

I posted previously another bug report (https://bugs.php.net/bug.php?id=73826) which might contain
some useful information because I was able to get ZTS working by a number of somewhat random steps.
To give a short summary, "php_embed_init" function works, but
"php_embed_module.startup" doesn't. It appears therefore to be some kind of
initialization process problem.

I tried "php_embed_module.ini_entries = "max_execution_time=0\n\0";" as
mentioned in this thread, but with a seg fault.

------------------------------------------------------------------------
[2016-07-21 07:24:48] davey@php.net

Closed accidentally. Reopening.

------------------------------------------------------------------------
[2016-07-20 11:34:36] davey@php.net

Automatic comment on behalf of ab
Revision: http://git.php.net/?p=php-src.git;a=commit;h=4c55669caa96f6202c2047a7baf6c5d5894d5fa7
Log: Partially fix bug #71129

------------------------------------------------------------------------
[2016-07-20 11:34:34] davey@php.net

Automatic comment on behalf of ab
Revision: http://git.php.net/?p=php-src.git;a=commit;h=53bfb6618d13083b769014cbdcb845f787a7cf28
Log: Revert "Partially fix bug #71129"

------------------------------------------------------------------------


The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at

    https://bugs.php.net/bug.php?id=71129


--
Edit this bug report at https://bugs.php.net/bug.php?id=71129&edit=1


Thread (32 messages)

« previous php.bugs (#206687) next »