Skip to content

Conversation

@eriklundin
Copy link
Contributor

@eriklundin eriklundin commented Aug 3, 2021

Description:

When loggning to the syslog from php-fpm. Forked children will inherit the value indicating that openlog already has been run even though closelog() has been called.

Test script:

<?php
brokensyntax
phpinfo();

Expected result:

Aug 2 15:49:22 testserver journal: php[4209]: PHP Parse error: syntax error, unexpected identifier "phpinfo" in /var/www/html/test.php on line 3

Actual result:

Aug 2 15:49:22 testserver journal: ool www[4209]: PHP Parse error: syntax error, unexpected identifier "phpinfo" in /var/www/html/test.php on line 3

@nikic nikic requested a review from bukka August 3, 2021 10:57
@eriklundin
Copy link
Contributor Author

How's it going?

@bukka
Copy link
Member

bukka commented Sep 19, 2021

I think it would be nicer to introduce a wrapper for closelog (e.g. php_closelog) and call it from fpm instead. It should be defined in main/php_syslog.h (PHPAPI function) and implemented in main/php_syslog.c possibly as well but see that php_openlog is actually implemented in ext/standard/syslog.c which is a bit weird. Might be better to move it to php_syslog.c as well. Would be all a bit cleaner then...

@eriklundin
Copy link
Contributor Author

Ok. This fix was meant as a minimal impact fix. As little changes as possible to fix the bug.

@bukka
Copy link
Member

bukka commented Sep 19, 2021

Yeah I can see that and the logic looks right. It's just that I would prefer to have it a bit more structured so it's clearer what's going on (especially when looking into that code after few years...)

@bukka
Copy link
Member

bukka commented Jun 14, 2022

I added the suggested changes in #8780 so closing this one.

@bukka bukka closed this Jun 14, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants