Bug #59516 [Opn->Nab]: Call to undefined method finfo::__destruct
| From: | stas@php.net | Date: | Sat, 25 Feb 2012 00:44:20 +0000 |
| Subject: | Bug #59516 [Opn->Nab]: Call to undefined method finfo::__destruct | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-167810@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=59516&edit=1
ID: 59516
Updated by: stas@php.net
Reported by: arimbourg at ariworld dot eu
Summary: Call to undefined method finfo::__destruct
-Status: Open
+Status: Not a bug
Type: Bug
-Package: Fileinfo
+Package: *General Issues
Operating System: Mandriva 2010 linux free
PHP Version: 5.3.3.04
Block user comment: N
Private report: N
New Comment:
Sorry, but your problem does not imply a bug in PHP itself. For a
list of more appropriate places to ask for help using PHP, please
visit http://www.php.net/support.php as this bug system
is not the
appropriate forum for asking support questions. Due to the volume
of reports we can not explain in detail here why your report is not
a bug. The support channels will be able to provide an explanation
for you.
Thank you for your interest in PHP.
You do not call __destruct directly. Just unset the variable or assign null to
it.
Previous Comments:
------------------------------------------------------------------------
[2010-11-22 17:28:25] arimbourg at ariworld dot eu
fileinfo functions are back.
Mandriva stores now that extension in a separate package (php-fileinfo-5.3.3-0.4mdv2010.1)... I
didn't noticed it... sorry.
Now the package is installed and all is well again.
One problem is remaining : no finfo::__destruct method. We can't free the resource when using
object style fileinfo.
I implemented a class acting like finfo (should).
It's storing the resource and flags in private static variables and using the finfo function in
the methods :
__CLASS__::__construct => finfo_open
__CLASS__::buffer => finfo_buffer
__CLASS__::file => finfo_file
__CLASS__::set_flags => finfo_set_flags
__CLASS__::__destruct => finfo_close
It's working well but I hope I'll be able to use the "native" finfo Class in the
future...
I notice one more problem : all the FILEINFO constants aren't defined :
PHP Notice: Use of undefined constant FILEINFO_COMPRESS - assumed 'FILEINFO_COMPRESS' in
/path/to/file.php on line 57
------------------------------------------------------------------------
[2010-11-19 15:01:48] arimbourg at ariworld dot eu
if this can help...
the output for 'pecl version' and 'pear version' commands:
$ pecl version
Warning: Invalid argument supplied for foreach() in Command.php on line 259
Warning: Invalid argument supplied for foreach() in /usr/share/pear/PEAR/Command.php on line 259
(repeated 11)
Notice: Undefined index: honorsbaseinstall in Role.php on line 180
(repeated 9)
Notice: Undefined index: installable in Role.php on line 145
(repeated 9)
Notice: Undefined index: phpfile in Role.php on line 212
(repeated 9)
Notice: Undefined index: config_vars in Role.php on line 49
(repeated 9)
Warning: Invalid argument supplied for foreach() in PEAR/Command.php on line 259
Warning: Invalid argument supplied for foreach() in /usr/share/pear/PEAR/Command.php on line 259
(repeated 11)
PEAR Version: 1.9.1
PHP Version: 5.3.3
Zend Engine Version: 2.3.0
Running on: Linux HOST 2.6.33.7-desktop586-2mnb #1 SMP Mon Sep 20 18:19:58 UTC 2010 i686
$ pear version
PEAR Version: 1.9.1
PHP Version: 5.3.3
Zend Engine Version: 2.3.0
Running on: Linux HOST 2.6.33.7-desktop586-2mnb #1 SMP Mon Sep 20 18:19:58 UTC 2010 i686
Each command I try with PECL give me almost the same output...
------------------------------------------------------------------------
[2010-11-19 14:38:51] arimbourg at ariworld dot eu
I tried using the function finfo_open too... PHP Fatal error: Call to undefined function
finfo_open() in /path/to/file.php on line #, referer: http://referer/url
------------------------------------------------------------------------
[2010-11-19 14:29:35] arimbourg at ariworld dot eu
Yesterday (18 nov) it was the destruct method that didn't exist. Today, PHP was updated to
version 5.3.3.04 and it's the whole finfo class that have disappeared.
I wanted to check if the previous bug was fixed and then I noticed a new error : PHP Fatal error:
Class 'finfo' not found in /path/to/file.php on line #, referer: http://referer/url
------------------------------------------------------------------------
[2010-11-18 13:16:42] arimbourg at ariworld dot eu
Description:
------------
PHP 5.3.3 with Suhosin-Patch (cli) (built: Nov 9 2010 14:49:46)
Copyright (c) 1997-2009 The PHP Group
Zend Engine v2.3.0, Copyright (c) 1998-2010 Zend Technologies
with Suhosin v0.9.32.1, Copyright (c) 2007-2010, by SektionEins GmbH
Apache mpm prefork
Loaded modules :
core
prefork
http_core
mod_so mod_authn_file
mod_authn_anon
mod_authn_default
mod_authn_alias
mod_authz_host
mod_authz_groupfile
mod_authz_user
mod_authz_dbm
mod_authz_owner
mod_authz_default
mod_auth_basic
mod_auth_digest
mod_include
mod_filter
mod_substitute
mod_log_config
mod_env
mod_mime_magic
mod_expires
mod_headers
mod_usertrack
mod_unique_id
mod_setenvif
mod_version
mod_mime
mod_status
mod_autoindex
mod_info
mod_cgi
mod_vhost_alias
mod_negotiation
mod_dir
mod_imagemap
mod_actions
mod_alias
mod_rewrite
mod_ssl
mod_userdir
mod_php5
Is it really a destructor for PECL Object Oriented usage?
Currently, I can only unset the variable that contain the resource.
Calling __destruct method give a fatal error.
Reproduce code:
---------------
<?php
putenv ('MAGIC=/usr/share/misc/magic.mgc'); //Magic didn't work... other bug...
ini_set ('display_errors', 1);
$finfo = new finfo ();
echo ($finfo->file ('index.php', FILEINFO_MIME) . "\n");
print_r (get_class_methods ('finfo')); // no __destruct method
$finfo->__destruct (); // Error !!
// finfo::__destruct () : Error too... as expected
?>
Expected result:
----------------
text/x-php; charset=utf-8
Array (
[0] => finfo
[1] => set_flags
[2] => file
[3] => buffer
[4] => __destruct
)
Actual result:
--------------
text/x-php; charset=utf-8
Array (
[0] => finfo
[1] => set_flags
[2] => file
[3] => buffer
)
Fatal error: Call to undefined method finfo::__destruct() in /path/to/file.php on line 12
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=59516&edit=1