|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2006-09-30 17:17 UTC] xdb_sharing at hotmail dot com
Description:
------------
When im using the rar_open() function on a Win32 based system, ill dont get a valid resource back. I've used gettype() to get the type of a returned type. but it only gives me null.
Reproduce code:
---------------
<?php
$rar = rar_open('archive.rar');
rar_close($rar);
?>
Expected result:
----------------
No output expected (Error clean)
Actual result:
--------------
Warning: rar_close(): supplied argument is not a valid Rar resource in C:\Webserver\www\rar.php on line 3
Warning: rar_close() [function.rar-close]: cannot find Rar file resource in C:\Webserver\www\rar.php on line 3
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sun Nov 02 03:00:01 2025 UTC |
An update: a) as of revision #291126 you are using a .c, and so I can add a piece of code from "php_src/main/spprintf.c", and I can compile php_rar again :-) b) as of revision # 291221 does not compile:-/ Well, with a small change this is fixable. Regards, Carsten (cwiedmann) (BTW: Sorry, can't upload a file while making a comment) Index: rar.c =================================================================== --- rar.c (Revision 291275) +++ rar.c (Arbeitskopie) @@ -85,6 +85,13 @@ } /* }}} */ +#if !HAVE_STRNLEN +static size_t strnlen(const char *s, size_t maxlen) { + char *r = memchr(s, '\0', maxlen); + return r ? r-s : maxlen; +} +#endif + /* WARNING: It's the caller who must close the archive. * Kind of against the conventions */ int _rar_find_file(struct RAROpenArchiveDataEx *open_data, /* IN */ @@ -345,8 +352,8 @@ const wchar_t * const file, //can be NULL zval *target TSRMLS_DC) /* {{{ */ { - const wchar_t last_name[1024] = {}; - const char strict_last_name[1024] = {}; + const wchar_t last_name[1024]; + const char strict_last_name[1024]; unsigned long packed_size = 0UL; struct RARHeaderDataEx *last_entry; int any_commit = FALSE;That const wchar_t last_name[1024] = {} was dumb... The const must be dropped. I had actually forgotten to compile that revision before commiting. Anyway, I'm doing some refactoring, but I cannot guarantee clean builds in VC6 since I don't own it. I'll try to avoid strnlen. Please continue to report any errors you may find.