Bug #80197 [Opn]: implicit declaration of function 'magic_stream' is invalid
| From: | cmb@php.net | Date: | Wed, 07 Oct 2020 12:20:15 +0000 |
| Subject: | Bug #80197 [Opn]: implicit declaration of function 'magic_stream' is invalid | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-229445@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=80197&edit=1
ID: 80197
Updated by: cmb@php.net
Reported by: mkoula@php.net
Summary: implicit declaration of function 'magic_stream' is
invalid
Status: Open
Type: Bug
Package: PHP options/info functions
Operating System: macOS Catalina 10.15.7
PHP Version: 8.0.0rc1
Block user comment: N
Private report: N
New Comment:
> /opt/local/include/magic.h
Apparently, the build includes the system header, although
that is undesired. I think we want
ext/fileinfo/fileinfo.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/ext/fileinfo/fileinfo.c b/ext/fileinfo/fileinfo.c
index 0a4ee3c34e..39343f06fc 100644
--- a/ext/fileinfo/fileinfo.c
+++ b/ext/fileinfo/fileinfo.c
@@ -19,7 +19,7 @@
#endif
#include "php.h"
-#include <magic.h>
+#include "magic.h"
/*
* HOWMANY specifies the maximum offset libmagic will look at
* this is currently hardcoded in the libmagic source but not exported
Also for PHP 7.3+.
Previous Comments:
------------------------------------------------------------------------
[2020-10-07 11:54:30] mkoula@php.net
I did a diff of this file between beta and rc and the result is:
⯠diff /Users/mIREK/compile/php8/php-8.0.0rc1/ext/fileinfo/fileinfo.c
/Users/mIREK/compile/php8/php-8.0.0beta3/ext/fileinfo/fileinfo.c
74,75c74,75
< zend_throw_error(NULL, "Invalid finfo object"); \
< RETURN_THROWS(); \
---
> php_error_docref(NULL, E_WARNING, "The invalid fileinfo object."); \
> RETURN_FALSE; \
273c273
< php_error_docref(NULL, E_WARNING, "Failed to load magic database at
\"%s\"", file);
---
> php_error_docref(NULL, E_WARNING, "Failed to load magic database at
> '%s'.", file);
385c385
< php_error_docref(NULL, E_WARNING, "Failed to load magic database");
---
> php_error_docref(NULL, E_WARNING, "Failed to load magic database.");
447c447
< zend_argument_type_error(1, "must not contain any null bytes");
---
> zend_argument_type_error(1, "must not contain null bytes");
So before it was Just warning and now it throws error, but I am not any C developer, I just can see
that this was changed...
------------------------------------------------------------------------
[2020-10-07 11:45:19] mkoula@php.net
Description:
------------
I previously compiled 8.0.0beta3 and worked fine. Today I run the same configuration on 8.0.0rc1 and
configure went through fine and then when I ran make command it died with the message:
/Users/mIREK/compile/php8/php-8.0.0rc1/ext/fileinfo/fileinfo.c:429:24: error: implicit declaration
of function 'magic_stream' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
ret_val = (char *) magic_stream(magic, stream);
^
/Users/mIREK/compile/php8/php-8.0.0rc1/ext/fileinfo/fileinfo.c:429:24: note: did you mean
'magic_setparam'?
/opt/local/include/magic.h:153:5: note: 'magic_setparam' declared here
int magic_setparam(magic_t, int, const void *);
^
/Users/mIREK/compile/php8/php-8.0.0rc1/ext/fileinfo/fileinfo.c:429:15: warning: cast to 'char
*' from smaller integer type 'int' [-Wint-to-pointer-cast]
ret_val = (char *) magic_stream(magic, stream);
^
/Users/mIREK/compile/php8/php-8.0.0rc1/ext/fileinfo/fileinfo.c:477:25: error: implicit declaration
of function 'magic_stream' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
ret_val = (char *)magic_stream(magic, stream);
^
/Users/mIREK/compile/php8/php-8.0.0rc1/ext/fileinfo/fileinfo.c:477:17: warning: cast to 'char
*' from smaller integer type 'int' [-Wint-to-pointer-cast]
ret_val = (char *)magic_stream(magic, stream);
^
2 warnings and 2 errors generated.
make: *** [ext/fileinfo/fileinfo.lo] Error 1
As a configure I used this, which for beta worked fine:
./configure \
--prefix=/opt/local \
--sysconfdir=/opt/local/php80 \
--program-suffix=80 \
--with-config-file-path=/opt/local/etc/php80 \
--with-config-file-scan-dir=/opt/local/etc/php80/conf.d \
--enable-bcmath \
--enable-calendar \
--enable-exif \
--enable-ftp \
--enable-fpm \
--enable-gd \
--enable-intl \
--enable-mbregex \
--enable-mbstring \
--enable-mysqlnd \
--enable-pcntl \
--enable-soap \
--enable-sockets \
--enable-sysvmsg \
--enable-sysvsem \
--enable-sysvshm \
--enable-opcache \
--with-curl \
--with-fpm-user=_www \
--with-fpm-group=_www \
--with-freetype \
--with-iconv=/opt/local \
--with-libxml \
--with-jpeg \
--with-layout=GNU \
--with-mysql-sock=/tmp/mysql.sock \
--with-openssl \
--with-pdo-mysql=mysqlnd \
--with-pdo-pgsql=/opt/local/lib/postgresql12 \
--with-pdo-sqlite \
--with-pgsql=/opt/local/lib/postgresql12 \
--with-pic \
--with-sqlite3 \
--with-webp \
--with-xsl \
--with-zip \
--with-zlib
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=80197&edit=1