Bug #80197 [Fbk->Opn]: implicit declaration of function 'magic_stream' is invalid

From: Date: Fri, 16 Oct 2020 08:53:32 +0000
Subject: Bug #80197 [Fbk->Opn]: implicit declaration of function 'magic_stream' is invalid
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-229655@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: Feedback +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: Not sure what exactly might be wrong with GD, but that libmagic include line looks wrong to me. Isn't that a bug that should be fixed for PHP-7.3[1] upwards? [1] <https://github.com/php/php-src/blob/php-7.3.23/ext/fileinfo/fileinfo.c#L24> Previous Comments: ------------------------------------------------------------------------ [2020-10-15 13:07:46] mkoula@php.net I tried this #include "libmagic/magic.h", and seemed to be working but then I had similar issues in GD library in multiple files. I also used the local links and I was able to finally compiled it, but just calling PHP in cli produces segmentation faut. Strage is that beta worked fine for me without issues an RC not. So I wait for another release... ------------------------------------------------------------------------ [2020-10-09 14:28:05] nikic@php.net Maybe #include "libmagic/magic.h"? ------------------------------------------------------------------------ [2020-10-07 13:49:59] mkoula@php.net I applied the diff change in ext/fileinfo/fileinfo.c, rerun configure and compile, but it still uses the /opt/local/include/magic.h Is there any way of setup/configuration to force it use this the internal libmagic and this file? ------------------------------------------------------------------------ [2020-10-07 12:20:15] cmb@php.net > /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+. ------------------------------------------------------------------------ [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... ------------------------------------------------------------------------ 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=80197 -- Edit this bug report at https://bugs.php.net/bug.php?id=80197&edit=1

« previous php.bugs (#229655) next »