Package Details: php-rar 4.0.0-2

Git Clone URL: https://aur.archlinux.org/php-rar.git (read-only, click to copy)
Package Base: php-rar
Description: PHP PECL extension for reading RAR archives using bundled unRAR library
Upstream URL: https://pecl.php.net/package/rar
Licenses: PHP
Submitter: None
Maintainer: tjbp
Last Packager: tjbp
Votes: 2
Popularity: 0.000000
First Submitted: 2010-12-27 17:54
Last Updated: 2018-01-30 12:59

Dependencies (1)

Required by (1)

  • cam (optional)

Sources (1)

Latest Comments

k0ste commented on 2020-10-06 05:17

Currentry build failed, over release tarball, this is diff on github, now build was complete for me.

diff -Naupr rar-4.0.0_orig/rararch.c rar-4.0.0/rararch.c
--- rar-4.0.0_orig/rararch.c    2017-07-22 09:59:59.000000000 +0700
+++ rar-4.0.0/rararch.c 2020-10-06 12:09:51.164108019 +0700
@@ -932,55 +932,6 @@ static void rararch_it_move_forward(zend
 static void rararch_it_rewind(zend_object_iterator *iter TSRMLS_DC);
 /* }}} */

-/* {{{ rararch_it_get_iterator */
-static zend_object_iterator *rararch_it_get_iterator(zend_class_entry *ce,
-                                                    zval *object,
-                                                    int by_ref TSRMLS_DC)
-{
-   rararch_iterator    *it;
-   rar_file_t          *rar;
-   int                 res;
-
-   if (by_ref) {
-       php_error_docref(NULL TSRMLS_CC, E_ERROR,
-           "An iterator cannot be used with foreach by reference");
-   }
-
-   it = emalloc(sizeof *it);
-
-#if PHP_MAJOR_VERSION < 7
-   zval_add_ref(&object);
-   it->parent.data = object;
-   it->value = NULL;
-#else
-   zend_iterator_init((zend_object_iterator *) it);
-   ZVAL_COPY(&it->parent.data, object);
-   ZVAL_UNDEF(&it->value);
-#endif
-
-   it->parent.funcs = ce->iterator_funcs.funcs;
-   it->state = NULL;
-
-   res = _rar_get_file_resource_ex(object, &rar, 1 TSRMLS_CC);
-   if (res == FAILURE)
-       php_error_docref(NULL TSRMLS_CC, E_ERROR,
-           "Cannot fetch RarArchive object");
-   if (rar->arch_handle == NULL)
-       php_error_docref(NULL TSRMLS_CC, E_ERROR,
-           "The archive is already closed, cannot give an iterator");
-   res = _rar_list_files(rar TSRMLS_CC);
-   if (_rar_handle_error(res TSRMLS_CC) == FAILURE) {
-       /* if it failed, do not expose the possibly incomplete entry list */
-       it->empty_iterator = 1;
-   }
-   else
-       it->empty_iterator = 0;
-
-   _rar_entry_search_start(rar, RAR_SEARCH_TRAVERSE, &it->state TSRMLS_CC);
-   return (zend_object_iterator*) it;
-}
-/* }}} */
-
 /* {{{ rararch_it_invalidate_current */
 static void rararch_it_invalidate_current(zend_object_iterator *iter TSRMLS_DC)
 {
@@ -1147,6 +1098,59 @@ static zend_object_iterator_funcs rararc
 };
 /* }}} */

+/* {{{ rararch_it_get_iterator */
+static zend_object_iterator *rararch_it_get_iterator(zend_class_entry *ce,
+                                                    zval *object,
+                                                    int by_ref TSRMLS_DC)
+{
+   rararch_iterator    *it;
+   rar_file_t          *rar;
+   int                 res;
+
+   if (by_ref) {
+       php_error_docref(NULL TSRMLS_CC, E_ERROR,
+           "An iterator cannot be used with foreach by reference");
+   }
+
+   it = emalloc(sizeof *it);
+
+#if PHP_MAJOR_VERSION < 7
+   zval_add_ref(&object);
+   it->parent.data = object;
+   it->value = NULL;
+#else
+   zend_iterator_init((zend_object_iterator *) it);
+   ZVAL_COPY(&it->parent.data, object);
+   ZVAL_UNDEF(&it->value);
+#endif
+
+#if PHP_VERSION_ID < 70300
+   it->parent.funcs = ce->iterator_funcs.funcs;
+#else
+   it->parent.funcs = &rararch_it_funcs;
+#endif
+   it->state = NULL;
+
+   res = _rar_get_file_resource_ex(object, &rar, 1 TSRMLS_CC);
+   if (res == FAILURE)
+       php_error_docref(NULL TSRMLS_CC, E_ERROR,
+           "Cannot fetch RarArchive object");
+   if (rar->arch_handle == NULL)
+       php_error_docref(NULL TSRMLS_CC, E_ERROR,
+           "The archive is already closed, cannot give an iterator");
+   res = _rar_list_files(rar TSRMLS_CC);
+   if (_rar_handle_error(res TSRMLS_CC) == FAILURE) {
+       /* if it failed, do not expose the possibly incomplete entry list */
+       it->empty_iterator = 1;
+   }
+   else
+       it->empty_iterator = 0;
+
+   _rar_entry_search_start(rar, RAR_SEARCH_TRAVERSE, &it->state TSRMLS_CC);
+   return (zend_object_iterator*) it;
+}
+/* }}} */
+
 void minit_rararch(TSRMLS_D)
 {
    zend_class_entry ce;
@@ -1170,7 +1174,9 @@ void minit_rararch(TSRMLS_D)
    rararch_ce_ptr->clone = NULL;
    rararch_ce_ptr->create_object = &rararch_ce_create_object;
    rararch_ce_ptr->get_iterator = rararch_it_get_iterator;
+#if PHP_VERSION_ID < 70300
    rararch_ce_ptr->iterator_funcs.funcs = &rararch_it_funcs;
+#endif
    zend_class_implements(rararch_ce_ptr TSRMLS_CC, 1, zend_ce_traversable);
 }

diff -Naupr rar-4.0.0_orig/rar_error.c rar-4.0.0/rar_error.c
--- rar-4.0.0_orig/rar_error.c  2017-07-22 09:59:59.000000000 +0700
+++ rar-4.0.0/rar_error.c   2020-10-06 12:09:51.164108019 +0700
@@ -252,7 +252,7 @@ void minit_rarerror(TSRMLS_D) /* {{{ */
    rarexception_ce_ptr->ce_flags |= ZEND_ACC_FINAL;
    zend_declare_property_bool(rarexception_ce_ptr, "usingExceptions",
        sizeof("usingExceptions") -1, 0L /* FALSE */,
-       ZEND_ACC_PRIVATE | ZEND_ACC_STATIC TSRMLS_CC);
+       ZEND_ACC_STATIC TSRMLS_CC);
 }
 /* }}} */

diff -Naupr rar-4.0.0_orig/rar_stream.c rar-4.0.0/rar_stream.c
--- rar-4.0.0_orig/rar_stream.c 2017-07-22 09:59:59.000000000 +0700
+++ rar-4.0.0/rar_stream.c  2020-10-06 12:09:51.164108019 +0700
@@ -293,7 +293,7 @@ static int _rar_stat_from_header(struct
     * SUBHEAD_TYPE_UOWNER), but it is not exposed in unRAR */
    ssb->sb.st_uid = 0;
    ssb->sb.st_gid = 0;
-#ifdef HAVE_ST_RDEV
+#if defined(HAVE_ST_RDEV) || defined(HAVE_STRUCT_STAT_ST_RDEV)
    ssb->sb.st_rdev = 0;
 #endif
    /* never mind signedness, we'll never get sizes big enough for that to
@@ -324,10 +324,10 @@ static int _rar_stat_from_header(struct
            &ssb->sb.st_mtime);
    }

-#ifdef HAVE_ST_BLKSIZE
+#if defined(HAVE_ST_BLKSIZE) || defined(HAVE_STRUCT_STAT_ST_BLKSIZE)
    ssb->sb.st_blksize = 0;
 #endif
-#ifdef HAVE_ST_BLOCKS
+#if defined(HAVE_ST_BLOCKS) || defined (HAVE_STRUCT_STAT_ST_BLOCKS)
    ssb->sb.st_blocks = 0;
 #endif
    /* php_stat in filestat.c doesn't check this one, so don't touch it */
diff -Naupr rar-4.0.0_orig/tests/002.phpt rar-4.0.0/tests/002.phpt
--- rar-4.0.0_orig/tests/002.phpt   2017-07-22 09:59:59.000000000 +0700
+++ rar-4.0.0/tests/002.phpt    2020-10-06 12:09:51.164108019 +0700
@@ -163,6 +163,6 @@ array(2) {

 Warning: rar_open(): Failed to open %s: ERAR_EOPEN (file open error) in %s on line %d

-Warning: rar_list() expects parameter 1 to be RarArchive, boolean given in %s on line %d
+Warning: rar_list() expects parameter 1 to be RarArchive, boo%s given in %s on line %d
 NULL
 Done
diff -Naupr rar-4.0.0_orig/tests/003.phpt rar-4.0.0/tests/003.phpt
--- rar-4.0.0_orig/tests/003.phpt   2017-07-22 09:59:59.000000000 +0700
+++ rar-4.0.0/tests/003.phpt    2020-10-06 12:09:51.164108019 +0700
@@ -89,6 +89,6 @@ object(RarEntry)#%d (%d) {

 Warning: rar_open(): Failed to open %s: ERAR_EOPEN (file open error) in %s on line %d

-Warning: rar_entry_get() expects parameter 1 to be RarArchive, boolean given in %s on line %d
+Warning: rar_entry_get() expects parameter 1 to be RarArchive, boo%s given in %s on line %d
 NULL
 Done
diff -Naupr rar-4.0.0_orig/tests/008.phpt rar-4.0.0/tests/008.phpt
--- rar-4.0.0_orig/tests/008.phpt   2017-07-22 09:59:59.000000000 +0700
+++ rar-4.0.0/tests/008.phpt    2020-10-06 12:09:51.167441369 +0700
@@ -28,7 +28,7 @@ bool(false)

 Warning: rar_open(): Failed to open %s: ERAR_EOPEN (file open error) in %s on line %d

-Warning: rar_entry_get() expects parameter 1 to be RarArchive, boolean given in %s on line %d
+Warning: rar_entry_get() expects parameter 1 to be RarArchive, boo%s given in %s on line %d
 NULL

 Done
diff -Naupr rar-4.0.0_orig/tests/079.phpt rar-4.0.0/tests/079.phpt
--- rar-4.0.0_orig/tests/079.phpt   2017-07-22 09:59:59.000000000 +0700
+++ rar-4.0.0/tests/079.phpt    2020-10-06 12:09:51.167441369 +0700
@@ -48,12 +48,12 @@ Count: 13

 * Closed file test (1):

-Warning: count(): The archive is already closed in %s on line %d
+Warning: %s(): The archive is already closed in %s on line %d
 int(0)

 * Closed file test (2):

-Warning: count(): The archive is already closed in %s on line %d
+Warning: %s(): The archive is already closed in %s on line %d
 int(0)

 * Closed file test (3, exceptions):
diff -Naupr rar-4.0.0_orig/tests/092.phpt rar-4.0.0/tests/092.phpt
--- rar-4.0.0_orig/tests/092.phpt   2017-07-22 09:59:59.000000000 +0700
+++ rar-4.0.0/tests/092.phpt    2020-10-06 12:09:51.167441369 +0700
@@ -54,7 +54,7 @@ Warning: rar_allow_broken_set() expects
 Warning: RarArchive::getEntries(): ERAR_EOPEN (file open error) in %s on line %d
 bool(false)

-Warning: count(): ERAR_EOPEN (file open error) in %s on line %d
+Warning: %s(): ERAR_EOPEN (file open error) in %s on line %d
 int(0)

 * broken file; do not allow broken (explicit)
@@ -62,7 +62,7 @@ int(0)
 Warning: RarArchive::getEntries(): ERAR_EOPEN (file open error) in %s on line %d
 bool(false)

-Warning: count(): ERAR_EOPEN (file open error) in %s on line %d
+Warning: %s(): ERAR_EOPEN (file open error) in %s on line %d
 int(0)

 * broken file; allow broken
diff -Naupr rar-4.0.0_orig/unrar/crypt2.loT rar-4.0.0/unrar/crypt2.loT
--- rar-4.0.0_orig/unrar/crypt2.loT 1970-01-01 07:00:00.000000000 +0700
+++ rar-4.0.0/unrar/crypt2.loT  2020-10-06 12:09:51.167441369 +0700
@@ -0,0 +1,7 @@
+# unrar/crypt2.lo - a libtool object file
+# Generated by ltmain.sh - GNU libtool 1.5.26 (1.1220.2.492 2008/01/30 06:40:56)
+#
+# Please DO NOT delete this file!
+# It is necessary for linking the library.
+
+# Name of the PIC object.
diff -Naupr rar-4.0.0_orig/unrar/dll.rc rar-4.0.0/unrar/dll.rc
--- rar-4.0.0_orig/unrar/dll.rc 1970-01-01 07:00:00.000000000 +0700
+++ rar-4.0.0/unrar/dll.rc  2020-10-06 12:09:51.167441369 +0700
@@ -0,0 +1,28 @@
+#include <windows.h>
+#include <commctrl.h>
+
+VS_VERSION_INFO VERSIONINFO
+FILEVERSION 5, 50, 5, 2378
+PRODUCTVERSION 5, 50, 5, 2378
+FILEOS VOS__WINDOWS32
+FILETYPE VFT_APP
+{
+  BLOCK "StringFileInfo"
+  {
+    BLOCK "040904E4"
+    {
+      VALUE "CompanyName", "Alexander Roshal\0"
+      VALUE "ProductName", "RAR decompression library\0"
+      VALUE "FileDescription", "RAR decompression library\0"
+      VALUE "FileVersion", "5.50.5\0"
+      VALUE "ProductVersion", "5.50.5\0"
+      VALUE "LegalCopyright", "Copyright � Alexander Roshal 1993-2017\0"
+      VALUE "OriginalFilename", "Unrar.dll\0"
+    }
+  }
+  BLOCK "VarFileInfo"
+  {
+    VALUE "Translation", 0x0409, 0x04E4
+  }
+}
+
diff -Naupr rar-4.0.0_orig/unrar/makefile rar-4.0.0/unrar/makefile
--- rar-4.0.0_orig/unrar/makefile   1970-01-01 07:00:00.000000000 +0700
+++ rar-4.0.0/unrar/makefile    2020-10-06 12:09:51.170774720 +0700
@@ -0,0 +1,173 @@
+#
+# Makefile for UNIX - unrar
+
+# Linux using GCC
+CXX=c++
+CXXFLAGS=-O2
+LIBFLAGS=-fPIC
+DEFINES=-D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -DRAR_SMP
+STRIP=strip
+AR=ar
+LDFLAGS=-pthread
+DESTDIR=/usr
+
+# Linux using LCC
+#CXX=lcc
+#CXXFLAGS=-O2
+#DEFINES=-D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE
+#STRIP=strip
+#AR=ar
+#DESTDIR=/usr
+
+# CYGWIN using GCC
+#CXX=c++
+#CXXFLAGS=-O2
+#LIBFLAGS=
+#DEFINES=-D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -DRAR_SMP
+#STRIP=strip
+#AR=ar
+#LDFLAGS=-pthread
+#DESTDIR=/usr
+
+# HP UX using aCC
+#CXX=aCC
+#CXXFLAGS=-AA +O2 +Onolimit
+#DEFINES=-D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE
+#STRIP=strip
+#AR=ar
+#DESTDIR=/usr
+
+# IRIX using GCC
+#CXX=g++
+#CXXFLAGS=-O2 
+#DEFINES=-DBIG_ENDIAN -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_BSD_COMPAT -D_XOPEN_SOURCE -D_XOPEN_SOURCE_EXTENDED=1
+#STRIP=strip
+#AR=ar
+#DESTDIR=/usr
+
+# IRIX using MIPSPro (experimental)
+#CXX=CC
+#CXXFLAGS=-O2 -mips3 -woff 1234,1156,3284 -LANG:std
+#DEFINES=-DBIG_ENDIAN -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_BSD_COMPAT -Dint64=int64_t
+#STRIP=strip
+#AR=ar
+#DESTDIR=/usr
+
+# AIX using xlC (IBM VisualAge C++ 5.0)
+#CXX=xlC
+#CXXFLAGS=-O -qinline -qro -qroconst -qmaxmem=16384 -qcpluscmt
+#DEFINES=-D_LARGE_FILES -D_LARGE_FILE_API
+#LIBS=-lbsd
+#STRIP=strip
+#AR=ar
+#DESTDIR=/usr
+
+# Solaris using CC
+#CXX=CC
+#CXXFLAGS=-fast -erroff=wvarhidemem
+#DEFINES=-D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE
+#STRIP=strip
+#AR=ar
+#DESTDIR=/usr
+
+# Solaris using GCC (optimized for UltraSPARC 1 CPU)
+#CXX=g++
+#CXXFLAGS=-O3 -mcpu=v9 -mtune=ultrasparc -m32
+#DEFINES=-D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE
+#STRIP=/usr/ccs/bin/strip
+#AR=/usr/ccs/bin/ar
+#DESTDIR=/usr
+
+# Tru64 5.1B using GCC3
+#CXX=g++
+#CXXFLAGS=-O2 -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_XOPEN_SOURCE=500
+#STRIP=strip
+#AR=ar
+#LDFLAGS=-rpath /usr/local/gcc/lib
+#DESTDIR=/usr
+
+# Tru64 5.1B using DEC C++
+#CXX=cxx
+#CXXFLAGS=-O4 -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -Dint64=long
+#STRIP=strip
+#AR=ar
+#LDFLAGS=
+#DESTDIR=/usr
+
+# QNX 6.x using GCC
+#CXX=g++
+#CXXFLAGS=-O2 -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -fexceptions
+#STRIP=strip
+#AR=ar
+#LDFLAGS=-fexceptions
+#DESTDIR=/usr
+
+# Cross-compile
+# Linux using arm-linux-g++
+#CXX=arm-linux-g++
+#CXXFLAGS=-O2
+#DEFINES=-D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE
+#STRIP=arm-linux-strip
+#AR=arm-linux-ar
+#LDFLAGS=-static
+#DESTDIR=/usr
+
+##########################
+
+COMPILE=$(CXX) $(CPPFLAGS) $(CXXFLAGS) $(DEFINES)
+LINK=$(CXX)
+
+WHAT=UNRAR
+
+UNRAR_OBJ=filestr.o recvol.o rs.o scantree.o qopen.o
+LIB_OBJ=filestr.o scantree.o dll.o qopen.o
+
+OBJECTS=rar.o strlist.o strfn.o pathfn.o smallfn.o global.o file.o filefn.o filcreat.o \
+   archive.o arcread.o unicode.o system.o isnt.o crypt.o crc.o rawread.o encname.o \
+   resource.o match.o timefn.o rdwrfn.o consio.o options.o errhnd.o rarvm.o secpassword.o \
+   rijndael.o getbits.o sha1.o sha256.o blake2s.o hash.o extinfo.o extract.o volume.o \
+  list.o find.o unpack.o headers.o threadpool.o rs16.o cmddata.o ui.o
+
+.cpp.o:
+   $(COMPILE) -D$(WHAT) -c $<
+
+all:   unrar
+
+install:   install-unrar
+
+uninstall: uninstall-unrar
+
+clean:
+   @rm -f *.o *.bak *~
+
+unrar: clean $(OBJECTS) $(UNRAR_OBJ)
+   @rm -f unrar
+   $(LINK) -o unrar $(LDFLAGS) $(OBJECTS) $(UNRAR_OBJ) $(LIBS) 
+   $(STRIP) unrar
+
+sfx:   WHAT=SFX_MODULE
+sfx:   clean $(OBJECTS)
+   @rm -f default.sfx
+   $(LINK) -o default.sfx $(LDFLAGS) $(OBJECTS)
+   $(STRIP) default.sfx
+
+lib:   WHAT=RARDLL
+lib:   CXXFLAGS+=$(LIBFLAGS)
+lib:   clean $(OBJECTS) $(LIB_OBJ)
+   @rm -f libunrar.so
+   @rm -f libunrar.a
+   $(LINK) -shared -o libunrar.so $(LDFLAGS) $(OBJECTS) $(LIB_OBJ)
+   $(AR) rcs libunrar.a $(OBJECTS) $(LIB_OBJ)
+
+install-unrar:
+           install -D unrar $(DESTDIR)/bin/unrar
+
+uninstall-unrar:
+           rm -f $(DESTDIR)/bin/unrar
+
+install-lib:
+       install libunrar.so $(DESTDIR)/lib
+       install libunrar.a $(DESTDIR)/lib
+
+uninstall-lib:
+       rm -f $(DESTDIR)/lib/libunrar.so

svinto commented on 2020-08-12 12:54

I get compilation errors with the official v4.0.0 tarball. Both with this AUR package and when compiling manually. I guess some defaults have changed with newer versions of gcc, so maybe a compilation flag is needed. But I'm not knowledgeable enough to figure it out.

But I found that I could compile the git version without errors. https://github.com/cataphract/php-rar

tjbp commented on 2018-01-30 13:01

@oi_wtf thanks - removed. I think it was always there in error - older versions seem to have supported 7 too.

oi_wtf commented on 2018-01-29 23:51

This package worked fine with PHP 7.2 from [extra] for me after removing the <7.0, so that "limit" is probably not needed anymore?

% php -i | grep -E 'PHP Ver|RAR'
PHP Version => 7.2.1
PHP Version => 7.2.1
RAR support => enabled
RAR EXT version => 4.0.0
UnRAR version => 5.50 beta5 patch1 2017-07-02
UnRAR API version => 8 extension 1