Bug #74149 [NEW]: SAPI application linking to PHP static library can't call zend_signal_startup()
| From: | sathya at laufers dot net | Date: | Wed, 22 Feb 2017 15:13:10 +0000 |
| Subject: | Bug #74149 [NEW]: SAPI application linking to PHP static library can't call zend_signal_startup() | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-207508@lists.php.net to get a copy of this message | ||
From: sathya at laufers dot net
Operating system: GNU/Linux
PHP version: 7.1.2
Package: Compile Failure
Bug Type: Bug
Bug description:SAPI application linking to PHP static library can't call zend_signal_startup()
Description:
------------
A C++ SAPI application linking to PHP 7.1 compiled as static embedded
SAPI library can't compile as the mandatory function
"zend_signal_startup()" is not wrapped in 'extern "C" {' and therefore
not accessible. This is the same issue as in "Bug #71041". I'm creating
a new bug report, because Zend signals are now enabled by default and
even with disabling them using "--disable-zend-signals" it doesn't work
(see "additional remark").
Regarding the comment in the other bug report:
> The only place that this function should be called is in the SAPI
layer, since all usable SAPI's are distributed with PHP, there doesn't
seem to be a legitimate need to export the symbol.
I don't agree. Most people using the static embedded library to
integrate PHP into their programs will stumble upon this problem.
Additional remark:
Using the configure option "--disable-zend-signals" the program compiles
but crashes with signal 6 as "zend_signal_activate()" is still being
called by "php_request_startup()" - but with uninitialized variables:
#0 0x00007f25f672f428 in __GI_raise (sig=sig@entry=6) at
../sysdeps/unix/sysv/linux/raise.c:54
#1 0x00007f25f673102a in __GI_abort () at abort.c:89
#2 0x000000000044cb21 in Debug::safe_abort () at DeathHandler.cpp:387
#3 Debug::DeathHandler::HandleSignal (sig=<optimized out>,
secret=0x7f25ef19c100) at DeathHandler.cpp:573
#4 <signal handler called>
#5 0x000000000069c717 in memcpy (__len=1040, __src=0x12f2720
<global_orig_handlers>, __dest=<optimized out>) at
/usr/include/x86_64-linux-gnu/bits/string3.h:53
#6 zend_signal_activate () at
/usr/src/user/php-7.1.2/Zend/zend_signal.c:313
#7 0x000000000060309f in php_request_startup () at
/usr/src/user/php-7.1.2/main/main.c:1640
Test script:
---------------
<?php
//Not applicable
?>
Expected result:
----------------
Successful linking of PHP 7.1 static embedded library.
Actual result:
--------------
Error during linking:
libscriptengine.a(libscriptengine_a-php_sapi.o): In function
`php_xxx_init()':
xxx/php_sapi.cpp:1787: undefined reference to `zend_signal_startup()'
collect2: error: ld returned 1 exit status
make[2]: *** [xxx] Fehler 1
Makefile:635: die Regel für Ziel âxxxâ scheiterte
make[1]: *** [all-recursive] Fehler 1
make: *** [all] Fehler 2
--
Edit bug report at https://bugs.php.net/bug.php?id=74149&edit=1
--
Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=74149&r=trysnapshot54
Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=74149&r=trysnapshot55
Try a snapshot (trunk): https://bugs.php.net/fix.php?id=74149&r=trysnapshottrunk
Fixed in SVN: https://bugs.php.net/fix.php?id=74149&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=74149&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=74149&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=74149&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=74149&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=74149&r=support
Expected behavior: https://bugs.php.net/fix.php?id=74149&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=74149&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=74149&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=74149&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=74149&r=php4
Daylight Savings: https://bugs.php.net/fix.php?id=74149&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=74149&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=74149&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=74149&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=74149&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=74149&r=mysqlcfg