php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #72384 php_log_err fails with undeclared identifier
Submitted: 2016-06-11 21:08 UTC Modified: 2016-06-15 10:57 UTC
Votes:1
Avg. Score:4.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:1 (100.0%)
Same OS:0 (0.0%)
From: phpdev at ehrhardt dot nl Assigned: derick (profile)
Status: Closed Package: Compile Failure
PHP Version: 7.1.0alpha1 OS: *
Private report: No CVE-ID: None
 [2016-06-11 21:08 UTC] phpdev at ehrhardt dot nl
Description:
------------
If an extension (like xdebug) uses php_log_err() the build on Windows fails with

ext\xdebug\xdebug_stack.c(172): error C2065: 'LOG_NOTICE': undeclared identifier

This is caused by the following:

php_log_err() has been removed from main/main.c and is replaced by php_log_err_with_severity()

php_log_err is now in main/php.h:

#define php_log_err(msg) php_log_err_with_severity(msg, LOG_NOTICE)

However, LOG_NOTICE is undefined on Windows when win32/syslog.h is not included (where is is defined as 6).

Test script:
---------------
Try to compile any extension that uses php_log_err() on Windows. xdebug has some other issues, but the solution is to add these lines in any c-file that calls php_log_err():

#if defined(WIN32) && PHP_VERSION_ID >= 70100
#include "win32/syslog.h"
#endif

This is a workaround. It should be solved in core.

Expected result:
----------------
no build failure on Windows

Actual result:
--------------
Fatal error C2065: 'LOG_NOTICE': undeclared identifier

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2016-06-12 03:50 UTC] pajoye@php.net
-Package: Compile Failure +Package: Xdebug
 [2016-06-14 23:23 UTC] kronecker8 at gmail dot com
I got this bug on Ubuntu 14.04 (x64). Can anybody help me?
 [2016-06-14 23:30 UTC] phpdev at ehrhardt dot nl
@kronecker8: with which PHP version?
 [2016-06-14 23:36 UTC] phpdev at ehrhardt dot nl
@Pierre: the problem is a generic one. Every extension that calls php_log_err() will fail to compile with PHP 7.1 on Windows. I just took xdebug as example, because that is where I encountered it and where I applied the workaround.
 [2016-06-15 10:50 UTC] derick@php.net
-Status: Open +Status: Closed -Package: Xdebug +Package: Compile Failure -Operating System: Windows +Operating System: * -Assigned To: +Assigned To: derick
 [2016-06-15 10:50 UTC] derick@php.net
It is also not only Windows. But it *is* fixed (in PHP) already in https://github.com/php/php-src/commit/d2bc82586b67882fdcdabac8e05cfbb4104bfd47
 [2016-06-15 10:57 UTC] phpdev at ehrhardt dot nl
Aha! Anatol was as quick as always.
 [2016-06-15 22:31 UTC] kronecker8 at gmail dot com
My php version: 7.1.0alpha1
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Apr 19 01:01:28 2024 UTC