Bug #78303 [Opn->Fbk]: repeating crashes in php_basename with event-mpm+mod_php

From: Date: Tue, 23 Feb 2021 11:25:21 +0000
Subject: Bug #78303 [Opn->Fbk]: repeating crashes in php_basename with event-mpm+mod_php
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-232341@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=78303&edit=1

 ID:                 78303
 Updated by:         cmb@php.net
 Reported by:        theultramage at gmail dot com
 Summary:            repeating crashes in php_basename with
                     event-mpm+mod_php
-Status:             Open
+Status:             Feedback
 Type:               Bug
 Package:            *General Issues
 Operating System:   FreeBSD 12.0
 PHP Version:        7.3.7
-Assigned To:        
+Assigned To:        nikita
 Block user comment: N
 Private report:     N

 New Comment:

Any update here?  Has this been fixed in the FreeBSD ports?  Do we
still want to apply an improvement to php-src?


Previous Comments:
------------------------------------------------------------------------
[2019-07-17 15:24:40] nikic@php.net

If it's possible to restore that code in the FreeBSD port, that would be good. We should
probably also change the check on our side from defined(_REENTRANT) to defined(ZTS), as we perform
the availability check without _REENTRANT and I don't believe this symbol has a dependence on
it. The absence of _REENTRANT might affect other things as well though...

------------------------------------------------------------------------
[2019-07-17 11:46:31] theultramage at gmail dot com

The usage of the routines in the autoconf module you referenced, PTHREADS_FLAGS and PTHREADS_CHECK,
has been deliberately patched out in the freebsd ports tree. This is why the flag isn't being
applied.

I traced the port's svn history and it goes back all the way to 2004 and php 4.3.9. It says
"Fix compilation of thread-safe PHP after the PTHREAD_LIBS change" which might be
referring to some sort of systems code restructuring effort.

Originally, they just removed the freebsd piece of code in PTHREADS_FLAGS:
https://svnweb.freebsd.org/ports/head/lang/php4/files/patch-configure?revision=118610&view=markup&pathrev=160333

It was then changed to remove the invocation of the autoconf macros:
https://svnweb.freebsd.org/ports/head/lang/php4/files/patch-configure.in?revision=161492&view=markup&pathrev=170333

------------------------------------------------------------------------
[2019-07-17 11:03:34] nikic@php.net

I got confused here and mixed up CPPFLAGS and CXXFLAGS... adding to CPPFLAGS is right and should
work, so I'm not sure why it isn't happening.

------------------------------------------------------------------------
[2019-07-17 10:52:23] theultramage at gmail dot com

Good catch. On my end, I found a stackoverflow post, stating "Use g++ -pthread, it is
equivalent to g++ -lpthread -D_REENTRANT". So gcc (and it seems clang as well) have this fancy
helper parameter. The freebsd ports makefile only does "LIBS += -lpthread" and thus
apparently does not invoke this mechanism. I'll correct it from this end and see if it changes
anything.

------------------------------------------------------------------------
[2019-07-17 10:45:48] nikic@php.net

-D_REENTRANT should be added by configure in https://github.com/php/php-src/blob/master/TSRM/threads.m4#L44
... but looks like it's only added to CPPFLAGS, not CFLAGS in https://github.com/php/php-src/blob/master/TSRM/threads.m4#L58.

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


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=78303


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


Thread (11 messages)

« previous php.bugs (#232341) next »