mirror of
https://github.com/php-win-ext/php-rar.git
synced 2026-03-24 04:52:07 +01:00
Compare commits
15 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
1a623543c4 | ||
|
|
cfffb63b5a | ||
|
|
c99b6925ad | ||
|
|
792c622f3e | ||
|
|
3f507ce2db | ||
|
|
7ba9c28e15 | ||
|
|
717d75ec8e | ||
|
|
498286b7af | ||
|
|
d1c7fcd5a1 | ||
|
|
55d30dfa5d | ||
|
|
52f8a34342 | ||
|
|
5a930a03aa | ||
|
|
234a78c2f7 | ||
|
|
19b94313c2 | ||
|
|
7b2749af57 |
27
.github/workflows/ci.yml
vendored
Normal file
27
.github/workflows/ci.yml
vendored
Normal file
@@ -0,0 +1,27 @@
|
||||
name: CI
|
||||
on:
|
||||
push:
|
||||
branches: ['*']
|
||||
jobs:
|
||||
test-linux:
|
||||
runs-on: ubuntu-latest
|
||||
strategy:
|
||||
fail-fast: true
|
||||
matrix:
|
||||
php-rel: ['8.2', '8.3', '8.4', '8.5']
|
||||
ts-state: [ts, nts]
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v5
|
||||
- name: Setup PHP
|
||||
id: setup-php
|
||||
uses: shivammathur/setup-php@v2
|
||||
with:
|
||||
php-version: '${{ matrix.php-rel }}'
|
||||
env:
|
||||
phpts: '${{ matrix.ts-state }}'
|
||||
|
||||
- name: build extension
|
||||
run: phpize && ./configure --enable-rar && make
|
||||
- name: run tests
|
||||
run: rm run-tests.php && cp run-tests8.php run-tests.php && make test
|
||||
49
.github/workflows/windows.yml
vendored
Normal file
49
.github/workflows/windows.yml
vendored
Normal file
@@ -0,0 +1,49 @@
|
||||
name: Publish Windows Releases
|
||||
on:
|
||||
release:
|
||||
types: [created]
|
||||
push:
|
||||
branches: ['*']
|
||||
|
||||
permissions:
|
||||
contents: write
|
||||
|
||||
jobs:
|
||||
get-extension-matrix:
|
||||
runs-on: ubuntu-latest
|
||||
outputs:
|
||||
matrix: ${{ steps.extension-matrix.outputs.matrix }}
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v5
|
||||
- name: Get the extension matrix
|
||||
id: extension-matrix
|
||||
uses: php/php-windows-builder/extension-matrix@v1
|
||||
build:
|
||||
needs: get-extension-matrix
|
||||
runs-on: ${{ matrix.os }}
|
||||
continue-on-error: false
|
||||
strategy:
|
||||
fail-fast: true
|
||||
matrix: ${{fromJson(needs.get-extension-matrix.outputs.matrix)}}
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v5
|
||||
- name: Build the extension
|
||||
uses: php/php-windows-builder/extension@v1
|
||||
with:
|
||||
php-version: ${{ matrix.php-version }}
|
||||
arch: ${{ matrix.arch }}
|
||||
ts: ${{ matrix.ts }}
|
||||
args: '--enable-rar'
|
||||
test-runner: 'run-tests8.php'
|
||||
release:
|
||||
runs-on: ubuntu-latest
|
||||
needs: build
|
||||
if: ${{ github.event_name == 'release' }}
|
||||
steps:
|
||||
- name: Upload artifact to the release
|
||||
uses: php/php-windows-builder/release@v1
|
||||
with:
|
||||
release: ${{ github.event.release.tag_name }}
|
||||
# token: ${{ secrets.GITHUB_TOKEN }}
|
||||
1
.gitignore
vendored
1
.gitignore
vendored
@@ -11,6 +11,7 @@
|
||||
/modules
|
||||
/missing
|
||||
/.deps
|
||||
*.dep
|
||||
/.libs
|
||||
/Makefile
|
||||
/Makefile.fragments
|
||||
|
||||
33
README.md
33
README.md
@@ -10,6 +10,33 @@ unrar/LICENSE.txt for details.
|
||||
Some modifications have been applied to the UnRAR library, mainly to allow
|
||||
streaming extraction of files without using threads.
|
||||
|
||||
[](https://ci.appveyor.com/project/cataphract/php-rar/branch/master)
|
||||
[](https://travis-ci.org/cataphract/php-rar)
|
||||
[](https://codecov.io/gh/cataphract/php-rar)
|
||||
| Version | Status |
|
||||
|---------|------------------------------|
|
||||
| master | unmaintened :x: |
|
||||
| v4.x | maintened :white_check_mark: |
|
||||
|
||||
Maintained PHP Versions compatibility:
|
||||
|
||||
| PHP Version | Status |
|
||||
|-------------|------------------------|
|
||||
| 5.x | no :x: |
|
||||
| 7.x | no :x: |
|
||||
| 8.0 | yes :white_check_mark: |
|
||||
| 8.1 | yes :white_check_mark: |
|
||||
| 8.2 | yes :white_check_mark: |
|
||||
| 8.3 | yes :white_check_mark: |
|
||||
| 8.4 | yes :white_check_mark: |
|
||||
| 8.5 | yes :white_check_mark: |
|
||||
|
||||
Installation system support:
|
||||
|
||||
| Platform | Status |
|
||||
|----------|------------------------|
|
||||
| PECL | no :x: |
|
||||
| PIE | yes :white_check_mark: |
|
||||
|
||||
To install the extension, use PIE (PHP Installer Extension) with a command like:
|
||||
|
||||
```bash
|
||||
pie install php-win-ext/rar
|
||||
```
|
||||
|
||||
31
appveyor.bat
31
appveyor.bat
@@ -1,31 +0,0 @@
|
||||
echo Running appveyor.bat
|
||||
echo on
|
||||
|
||||
CALL "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\bin\vcvars32.bat"
|
||||
|
||||
IF NOT EXIST "C:\projects\php-sdk" (
|
||||
wget -nv http://windows.php.net/downloads/php-sdk/php-sdk-binary-tools-20110915.zip
|
||||
7z x -y php-sdk-binary-tools-20110915.zip -oC:\projects\php-sdk
|
||||
)
|
||||
IF NOT EXIST "C:\projects\php-src\Release_TS\php7ts.lib" (
|
||||
git clone --depth=1 --branch=PHP-7.1 https://github.com/php/php-src C:\projects\php-src
|
||||
wget -nv http://windows.php.net/downloads/php-sdk/deps-7.1-vc14-x86.7z
|
||||
7z x -y deps-7.1-vc14-x86.7z -oC:\projects\php-src
|
||||
CALL C:\projects\php-sdk\bin\phpsdk_setvars.bat
|
||||
cd C:\projects\php-src
|
||||
CALL buildconf.bat
|
||||
CALL configure.bat --disable-all --enable-cli --with-config-file-scan-dir=C:\projects\extension\bin\modules.d --with-prefix=%APPVEYOR_BUILD_FOLDER%\bin --with-php-build=deps
|
||||
nmake
|
||||
) ELSE (
|
||||
echo php7ts.lib already exists
|
||||
cd C:\projects\php-src
|
||||
CALL C:\projects\php-sdk\bin\phpsdk_setvars.bat
|
||||
)
|
||||
|
||||
CALL buildconf.bat --force --add-modules-dir=%APPVEYOR_BUILD_FOLDER%\..
|
||||
CALL configure.bat --disable-all --enable-cli --enable-rar=shared --with-config-file-scan-dir=C:\projects\extension\bin\modules.d --with-prefix=%APPVEYOR_BUILD_FOLDER%\bin --with-php-build=deps
|
||||
nmake || exit /b
|
||||
rmdir Release_TS\php-rar /S /Q
|
||||
del /S /Q "Release_TS\*.sbr"
|
||||
|
||||
copy %APPVEYOR_BUILD_FOLDER%\run-tests8.php C:\projects\php-src\run-tests.php
|
||||
26
appveyor.yml
26
appveyor.yml
@@ -1,26 +0,0 @@
|
||||
# Based on igbinary's appveyor config.
|
||||
|
||||
version: '{branch}.{build}'
|
||||
install:
|
||||
- cmd: choco feature enable -n=allowGlobalConfirmation
|
||||
- cmd: cinst wget
|
||||
- cmd: mkdir %APPVEYOR_BUILD_FOLDER%\bin
|
||||
|
||||
build_script:
|
||||
- cmd: "%APPVEYOR_BUILD_FOLDER%\\appveyor.bat"
|
||||
|
||||
test_script:
|
||||
- cmd: cd C:\projects\php-src
|
||||
- cmd: set NO_INTERACTION=1
|
||||
- cmd: set REPORT_EXIT_STATUS=1
|
||||
- cmd: set TZ=UTC
|
||||
- cmd: 'nmake test TESTS="--show-diff --set-timeout 30 -d extension=C:\projects\php-src\Release_TS\php_rar.dll %APPVEYOR_BUILD_FOLDER%\tests"'
|
||||
|
||||
after_test:
|
||||
# - cmd: dir /S C:\projects\php-src\Release_TS
|
||||
- cmd: 'del C:\projects\php-src\Release_TS\php_rar.*'
|
||||
|
||||
cache:
|
||||
- C:\ProgramData\chocolatey\lib -> appveyor.yml
|
||||
- C:\projects\php-src
|
||||
- C:\projects\php-sdk
|
||||
@@ -1,85 +0,0 @@
|
||||
jobs:
|
||||
- template: azure-template.yml
|
||||
parameters:
|
||||
name: php_5_3_valgrind
|
||||
displayName: PHP 5.3 ZTS (valgrind, clang)
|
||||
phpVersion: '5.3'
|
||||
clang: true
|
||||
valgrind: true
|
||||
zts: true
|
||||
|
||||
- template: azure-template.yml
|
||||
parameters:
|
||||
name: php_5_4
|
||||
displayName: PHP 5.4
|
||||
phpVersion: '5.4'
|
||||
|
||||
- template: azure-template.yml
|
||||
parameters:
|
||||
name: php_5_5
|
||||
displayName: PHP 5.5
|
||||
phpVersion: '5.5'
|
||||
|
||||
- template: azure-template.yml
|
||||
parameters:
|
||||
name: php_5_6
|
||||
displayName: PHP 5.6
|
||||
phpVersion: '5.6'
|
||||
|
||||
- template: azure-template.yml
|
||||
parameters:
|
||||
name: php_5_6_valgrind
|
||||
displayName: PHP 5.6 ZTS (valgrind, clang)
|
||||
phpVersion: '5.6'
|
||||
clang: true
|
||||
valgrind: true
|
||||
zts: true
|
||||
|
||||
- template: azure-template.yml
|
||||
parameters:
|
||||
name: php_7_0
|
||||
displayName: PHP 7.0
|
||||
phpVersion: '7.0'
|
||||
|
||||
- template: azure-template.yml
|
||||
parameters:
|
||||
name: php_7_1
|
||||
displayName: PHP 7.1
|
||||
phpVersion: '7.1'
|
||||
|
||||
- template: azure-template.yml
|
||||
parameters:
|
||||
name: php_7_2
|
||||
displayName: PHP 7.2
|
||||
phpVersion: '7.2'
|
||||
|
||||
- template: azure-template.yml
|
||||
parameters:
|
||||
name: php_7_3
|
||||
displayName: PHP 7.3
|
||||
phpVersion: '7.3'
|
||||
|
||||
- template: azure-template.yml
|
||||
parameters:
|
||||
name: php_7_4
|
||||
displayName: PHP 7.4 ZTS (valgrind, clang)
|
||||
phpVersion: '7.4'
|
||||
clang: true
|
||||
valgrind: true
|
||||
zts: true
|
||||
|
||||
- template: azure-template.yml
|
||||
parameters:
|
||||
name: php_8_0
|
||||
displayName: PHP 8.0 ZTS
|
||||
phpVersion: '8.0'
|
||||
zts: true
|
||||
publishCoverage: true
|
||||
|
||||
- template: azure-template.yml
|
||||
parameters:
|
||||
name: php_8_0_valgrind
|
||||
displayName: PHP 8.0 (valgrind, clang)
|
||||
phpVersion: '8.0'
|
||||
clang: true
|
||||
valgrind: true
|
||||
@@ -1,65 +0,0 @@
|
||||
parameters:
|
||||
name: ~
|
||||
displayName: ~
|
||||
phpVersion: bundled
|
||||
imageName: ubuntu-20.04
|
||||
zts: false
|
||||
clang: false
|
||||
publishCoverage: false
|
||||
valgrind: false
|
||||
|
||||
jobs:
|
||||
- job: ${{ parameters.name }}
|
||||
displayName: ${{ parameters.displayName }}
|
||||
pool:
|
||||
vmImage: ${{ parameters.imageName }}
|
||||
|
||||
variables:
|
||||
${{ if eq(parameters.clang, true) }}:
|
||||
CC: clang
|
||||
CXX: clang++
|
||||
|
||||
steps:
|
||||
- checkout: self
|
||||
displayName: Checkout
|
||||
clean: true
|
||||
submodules: recursive
|
||||
|
||||
- bash: |
|
||||
source test_funcs.sh
|
||||
install_php ${{ parameters.phpVersion }} ${{ parameters.zts }}
|
||||
displayName: Install PHP ${{ parameters.phpVersion }}
|
||||
|
||||
- ${{ if eq(parameters.valgrind, true) }}:
|
||||
- bash: >
|
||||
sudo apt-get install valgrind
|
||||
displayName: "Install Valgrind"
|
||||
|
||||
- script: |
|
||||
source test_funcs.sh
|
||||
build_ext ${{ parameters.phpVersion }} ${{ parameters.zts }} ${{ parameters.publishCoverage }}
|
||||
displayName: Build extension
|
||||
|
||||
- script: |
|
||||
source test_funcs.sh
|
||||
run_tests ${{ parameters.phpVersion }} ${{ parameters.zts }} ${{ parameters.publishCoverage }}
|
||||
${{ if eq(parameters.valgrind, true) }}:
|
||||
env:
|
||||
RUN_TESTS_FLAGS: -m
|
||||
displayName: Run tests
|
||||
|
||||
- task: PublishTestResults@2
|
||||
displayName: Publish test results
|
||||
condition: succeededOrFailed()
|
||||
inputs:
|
||||
testResultsFormat: 'JUnit'
|
||||
testResultsFiles: 'report.xml'
|
||||
searchFolder: '$(System.DefaultWorkingDirectory)'
|
||||
mergeTestResults: true
|
||||
|
||||
- ${{ if eq(parameters.publishCoverage, true) }}:
|
||||
- bash: >
|
||||
bash <(curl -s https://codecov.io/bash)
|
||||
displayName: "Publish coverage (Codecov)"
|
||||
env:
|
||||
CODECOV_TOKEN: $(CODECOV_TOKEN)
|
||||
@@ -1,8 +1,8 @@
|
||||
{
|
||||
"name": "rar",
|
||||
"type": "extension",
|
||||
"name": "php-win-ext/rar",
|
||||
"type": "php-ext",
|
||||
"license": [
|
||||
"PHP License"
|
||||
"PHP-3.01"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
@@ -14,5 +14,8 @@
|
||||
"email": "tony@daylessday.org"
|
||||
}
|
||||
],
|
||||
"require": {
|
||||
"php": ">= 8.0.0"
|
||||
},
|
||||
"description": "rar extension"
|
||||
}
|
||||
@@ -31,7 +31,7 @@ if (PHP_RAR != "no") {
|
||||
arcread.cpp filefn.cpp \
|
||||
global.cpp list.cpp \
|
||||
encname.cpp file.cpp \
|
||||
secpassword.cpp options.cpp", "rar");
|
||||
secpassword.cpp options.cpp", "rar", "unrar_obj");
|
||||
|
||||
AC_DEFINE("HAVE_RAR", 1, "Rar support");
|
||||
}
|
||||
|
||||
@@ -51,7 +51,7 @@
|
||||
extern zend_module_entry rar_module_entry;
|
||||
#define phpext_rar_ptr &rar_module_entry
|
||||
|
||||
#define PHP_RAR_VERSION "4.2.0"
|
||||
#define PHP_RAR_VERSION "4.2.1"
|
||||
|
||||
#ifdef PHP_WIN32
|
||||
#define PHP_RAR_API __declspec(dllexport)
|
||||
|
||||
@@ -247,7 +247,7 @@ void minit_rarerror(TSRMLS_D) /* {{{ */
|
||||
zend_exception_get_default(TSRMLS_C), NULL TSRMLS_CC);
|
||||
#else
|
||||
rarexception_ce_ptr = zend_register_internal_class_ex(&ce,
|
||||
zend_exception_get_default(TSRMLS_C));
|
||||
zend_ce_exception);
|
||||
#endif
|
||||
rarexception_ce_ptr->ce_flags |= ZEND_ACC_FINAL;
|
||||
zend_declare_property_bool(rarexception_ce_ptr, "usingExceptions",
|
||||
|
||||
18
rararch.c
18
rararch.c
@@ -544,7 +544,8 @@ static int rararch_dimensions_preamble(rar_file_t *rar,
|
||||
/* }}} */
|
||||
|
||||
/* {{{ RarArchive count_elements handler */
|
||||
static int rararch_count_elements(handler_this_t *object, long *count TSRMLS_DC)
|
||||
|
||||
static int rararch_count_elements(zend_object *object, zend_long *count TSRMLS_DC)
|
||||
{
|
||||
rar_file_t *rar = NULL;
|
||||
size_t entry_count;
|
||||
@@ -555,10 +556,10 @@ static int rararch_count_elements(handler_this_t *object, long *count TSRMLS_DC)
|
||||
}
|
||||
|
||||
entry_count = _rar_entry_count(rar);
|
||||
if (entry_count > LONG_MAX)
|
||||
entry_count = (size_t) LONG_MAX;
|
||||
if (entry_count > ZEND_LONG_MAX)
|
||||
entry_count = ZEND_LONG_MAX;
|
||||
|
||||
*count = (long) entry_count;
|
||||
*count = (zend_long) entry_count;
|
||||
|
||||
return SUCCESS;
|
||||
}
|
||||
@@ -970,6 +971,13 @@ ZEND_END_ARG_INFO()
|
||||
|
||||
ZEND_BEGIN_ARG_INFO(arginfo_rararchive_void, 0)
|
||||
ZEND_END_ARG_INFO()
|
||||
|
||||
#if PHP_VERSION_ID >= 80200
|
||||
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_rararchive_tostring, 0, 0, IS_STRING, 0)
|
||||
ZEND_END_ARG_INFO()
|
||||
#else
|
||||
#define arginfo_rararchive_tostring arginfo_rararchive_void
|
||||
#endif
|
||||
/* }}} */
|
||||
|
||||
static zend_function_entry php_rararch_class_functions[] = {
|
||||
@@ -984,7 +992,7 @@ static zend_function_entry php_rararch_class_functions[] = {
|
||||
PHP_ME_MAPPING(isBroken, rar_broken_is, arginfo_rararchive_void, ZEND_ACC_PUBLIC)
|
||||
PHP_ME_MAPPING(setAllowBroken, rar_allow_broken_set, arginfo_rararchive_setallowbroken, ZEND_ACC_PUBLIC)
|
||||
PHP_ME_MAPPING(close, rar_close, arginfo_rararchive_void, ZEND_ACC_PUBLIC)
|
||||
PHP_ME(rararch, __toString, arginfo_rararchive_void, ZEND_ACC_PUBLIC)
|
||||
PHP_ME(rararch, __toString, arginfo_rararchive_tostring, ZEND_ACC_PUBLIC)
|
||||
PHP_ME_MAPPING(__construct, rar_bogus_ctor, arginfo_rararchive_void, ZEND_ACC_PRIVATE | ZEND_ACC_CTOR)
|
||||
#if PHP_MAJOR_VERSION >= 8
|
||||
PHP_ME(rararch, getIterator, arginfo_rararchive_getiterator, ZEND_ACC_PUBLIC)
|
||||
|
||||
17
rarentry.c
17
rarentry.c
@@ -65,7 +65,11 @@ void _rar_entry_to_zval(zval *parent,
|
||||
char *filename;
|
||||
int filename_size,
|
||||
filename_len;
|
||||
#if PHP_MAJOR_VERSION >= 7
|
||||
zend_long unp_size; /* zval stores PHP ints as zend_long, so use that here */
|
||||
#else
|
||||
long unp_size; /* zval stores PHP ints as long, so use that here */
|
||||
#endif
|
||||
zval *parent_copy = parent;
|
||||
#if PHP_MAJOR_VERSION < 7
|
||||
/* allocate zval on the heap */
|
||||
@@ -85,7 +89,9 @@ void _rar_entry_to_zval(zval *parent,
|
||||
zend_update_property(rar_class_entry_ptr, obj, "rarfile",
|
||||
sizeof("rararch") - 1, parent_copy TSRMLS_CC);
|
||||
|
||||
#if ULONG_MAX > 0xffffffffUL
|
||||
#if PHP_MAJOR_VERSION >= 7 && ZEND_ENABLE_ZVAL_LONG64
|
||||
unp_size = ((zend_long) entry->UnpSize) + (((zend_long) entry->UnpSizeHigh) << 32);
|
||||
#elif PHP_MAJOR_VERSION < 7 && ULONG_MAX > 0xffffffffUL
|
||||
unp_size = ((long) entry->UnpSize) + (((long) entry->UnpSizeHigh) << 32);
|
||||
#else
|
||||
/* for 32-bit long, at least don't give negative values */
|
||||
@@ -735,6 +741,13 @@ ZEND_END_ARG_INFO()
|
||||
|
||||
ZEND_BEGIN_ARG_INFO(arginfo_rar_void, 0)
|
||||
ZEND_END_ARG_INFO()
|
||||
|
||||
#if PHP_VERSION_ID >= 80200
|
||||
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_rar_tostring, 0, 0, IS_STRING, 0)
|
||||
ZEND_END_ARG_INFO()
|
||||
#else
|
||||
#define arginfo_rar_tostring arginfo_rar_void
|
||||
#endif
|
||||
/* }}} */
|
||||
|
||||
static zend_function_entry php_rar_class_functions[] = {
|
||||
@@ -755,7 +768,7 @@ static zend_function_entry php_rar_class_functions[] = {
|
||||
PHP_ME(rarentry, getRedirType, arginfo_rar_void, ZEND_ACC_PUBLIC)
|
||||
PHP_ME(rarentry, isRedirectToDirectory, arginfo_rar_void, ZEND_ACC_PUBLIC)
|
||||
PHP_ME(rarentry, getRedirTarget, arginfo_rar_void, ZEND_ACC_PUBLIC)
|
||||
PHP_ME(rarentry, __toString, arginfo_rar_void, ZEND_ACC_PUBLIC)
|
||||
PHP_ME(rarentry, __toString, arginfo_rar_tostring, ZEND_ACC_PUBLIC)
|
||||
PHP_ME_MAPPING(__construct, rar_bogus_ctor, arginfo_rar_void, ZEND_ACC_PRIVATE | ZEND_ACC_CTOR)
|
||||
{NULL, NULL, NULL}
|
||||
};
|
||||
|
||||
@@ -2829,10 +2829,10 @@ case "$1" in
|
||||
gdb --args {$cmd}
|
||||
;;
|
||||
"valgrind")
|
||||
USE_ZEND_ALLOC=0 valgrind $2 ${cmd}
|
||||
USE_ZEND_ALLOC=0 valgrind $2 {$cmd}
|
||||
;;
|
||||
"rr")
|
||||
rr record $2 ${cmd}
|
||||
rr record $2 {$cmd}
|
||||
;;
|
||||
*)
|
||||
{$cmd}
|
||||
|
||||
@@ -163,5 +163,5 @@ 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, boo%s given in %s on line %d
|
||||
Warning: rar_list() expects parameter 1 to be RarArchive, %s given in %s on line %d
|
||||
Done
|
||||
|
||||
@@ -91,5 +91,5 @@ 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, boo%s given in %s on line %d
|
||||
Warning: rar_entry_get() expects parameter 1 to be RarArchive, %s given in %s on line %d
|
||||
Done
|
||||
|
||||
@@ -31,6 +31,6 @@ 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, boo%s given in %s on line %d
|
||||
Warning: rar_entry_get() expects parameter 1 to be RarArchive, %s given in %s on line %d
|
||||
|
||||
Done
|
||||
|
||||
@@ -9,10 +9,6 @@ $rar_file1 = rar_open(dirname(__FILE__).'/multi.part1.rar');
|
||||
$entries = rar_list($rar_file1);
|
||||
echo count($entries)." files:\n\n";
|
||||
//var_dump($entries);
|
||||
function int32_to_hex($value) {
|
||||
$value &= 0xffffffff;
|
||||
return str_pad(strtoupper(dechex($value)), 8, "0", STR_PAD_LEFT);
|
||||
}
|
||||
foreach ($entries as $e) {
|
||||
$stream = $e->getStream();
|
||||
if ($stream === false) {
|
||||
@@ -25,7 +21,7 @@ foreach ($entries as $e) {
|
||||
$a .= fread($stream, 8192);
|
||||
}
|
||||
echo strlen($a)." bytes, CRC ";
|
||||
echo int32_to_hex(crc32($a))."\n\n"; //you can confirm they're equal to those given by $e->getCrc()
|
||||
echo strtoupper(hash("crc32b", $a))."\n\n"; //you can confirm they're equal to those given by $e->getCrc()
|
||||
}
|
||||
|
||||
echo "Done\n";
|
||||
|
||||
@@ -9,10 +9,6 @@ $rar_file1 = rar_open(dirname(__FILE__).'/store_method.rar');
|
||||
$entries = rar_list($rar_file1);
|
||||
echo count($entries)." files:\n\n";
|
||||
//var_dump($entries);
|
||||
function int32_to_hex($value) {
|
||||
$value &= 0xffffffff;
|
||||
return str_pad(strtoupper(dechex($value)), 8, "0", STR_PAD_LEFT);
|
||||
}
|
||||
foreach ($entries as $e) {
|
||||
$stream = $e->getStream();
|
||||
echo $e->getName().": ";
|
||||
@@ -21,7 +17,7 @@ foreach ($entries as $e) {
|
||||
$a .= fread($stream, 512);
|
||||
}
|
||||
echo strlen($a)." bytes, CRC ";
|
||||
echo int32_to_hex(crc32($a))."\n\n"; //you can confirm they're equal to those given by $e->getCrc()
|
||||
echo strtoupper(hash("crc32b", $a))."\n\n"; //you can confirm they're equal to those given by $e->getCrc()
|
||||
}
|
||||
|
||||
echo "Done\n";
|
||||
|
||||
@@ -9,10 +9,6 @@ $rar_file1 = rar_open(dirname(__FILE__).'/solid.rar');
|
||||
$entries = rar_list($rar_file1);
|
||||
echo count($entries)." files:\n\n";
|
||||
//var_dump($entries);
|
||||
function int32_to_hex($value) {
|
||||
$value &= 0xffffffff;
|
||||
return str_pad(strtoupper(dechex($value)), 8, "0", STR_PAD_LEFT);
|
||||
}
|
||||
foreach ($entries as $e) {
|
||||
$stream = $e->getStream();
|
||||
echo $e->getName().": ";
|
||||
@@ -21,7 +17,7 @@ foreach ($entries as $e) {
|
||||
$a .= fread($stream, 8192);
|
||||
}
|
||||
echo strlen($a)." bytes, CRC ";
|
||||
echo int32_to_hex(crc32($a))."\n\n"; //you can confirm they're equal to those given by $e->getCrc()
|
||||
echo strtoupper(hash("crc32b", $a))."\n\n"; //you can confirm they're equal to those given by $e->getCrc()
|
||||
}
|
||||
|
||||
echo "Done\n";
|
||||
|
||||
@@ -4,6 +4,9 @@ RarArchive get iterator on closed file
|
||||
<?php if(!extension_loaded("rar")) print "skip"; ?>
|
||||
--FILE--
|
||||
<?php
|
||||
if (PHP_VERSION_ID>=80500){
|
||||
ini_set('fatal_error_backtraces', 'Off');
|
||||
}
|
||||
$rarF = RarArchive::open(dirname(__FILE__) . '/latest_winrar.rar');
|
||||
$rarF->close();
|
||||
foreach ($rarF as $k => $rarE) {
|
||||
|
||||
@@ -10,10 +10,6 @@ function resolve($vol) {
|
||||
else
|
||||
return null;
|
||||
}
|
||||
function int32_to_hex($value) {
|
||||
$value &= 0xffffffff;
|
||||
return str_pad(strtoupper(dechex($value)), 8, "0", STR_PAD_LEFT);
|
||||
}
|
||||
$rar_file1 = rar_open(dirname(__FILE__).'/multi_broken.part1.rar', null, 'resolve');
|
||||
foreach ($rar_file1 as $e) {
|
||||
$stream = $e->getStream();
|
||||
@@ -23,7 +19,7 @@ foreach ($rar_file1 as $e) {
|
||||
$a .= fread($stream, 8192);
|
||||
}
|
||||
echo strlen($a)." bytes, CRC ";
|
||||
echo int32_to_hex(crc32($a))."\n\n"; //you can confirm they're equal to those given by $e->getCrc()
|
||||
echo strtoupper(hash("crc32b", $a))."\n\n"; //you can confirm they're equal to those given by $e->getCrc()
|
||||
}
|
||||
|
||||
echo "Done\n";
|
||||
|
||||
@@ -10,10 +10,6 @@ function resolve($vol) {
|
||||
else
|
||||
return null;
|
||||
}
|
||||
function int32_to_hex($value) {
|
||||
$value &= 0xffffffff;
|
||||
return str_pad(strtoupper(dechex($value)), 8, "0", STR_PAD_LEFT);
|
||||
}
|
||||
echo "Fail:\n";
|
||||
$rar_file1 = rar_open(dirname(__FILE__).'/multi_broken.part1.rar');
|
||||
$entry = $rar_file1->getEntry('file2.txt');
|
||||
@@ -22,7 +18,7 @@ echo "\nSuccess:\n";
|
||||
$rar_file1 = rar_open(dirname(__FILE__).'/multi_broken.part1.rar', null, 'resolve');
|
||||
$entry = $rar_file1->getEntry('file2.txt');
|
||||
$entry->extract(null, dirname(__FILE__) . "/temp_file2.txt");
|
||||
echo int32_to_hex(crc32(file_get_contents(dirname(__FILE__) . "/temp_file2.txt")));
|
||||
echo strtoupper(hash("crc32b", file_get_contents(dirname(__FILE__) . "/temp_file2.txt")));
|
||||
echo "\n";
|
||||
echo "Done\n";
|
||||
?>
|
||||
|
||||
@@ -11,17 +11,13 @@ function resolve($vol) {
|
||||
else
|
||||
return null;
|
||||
}
|
||||
function int32_to_hex($value) {
|
||||
$value &= 0xffffffff;
|
||||
return str_pad(strtoupper(dechex($value)), 8, "0", STR_PAD_LEFT);
|
||||
}
|
||||
$stream = fopen("rar://" .
|
||||
dirname(__FILE__) . '/multi_broken.part1.rar' .
|
||||
"#file2.txt", "r", false,
|
||||
stream_context_create(array('rar'=>array('volume_callback'=>'resolve'))));
|
||||
$a = stream_get_contents($stream);
|
||||
echo strlen($a)." bytes, CRC ";
|
||||
echo int32_to_hex(crc32($a))."\n\n"; //you can confirm they're equal to those given by $e->getCrc()
|
||||
echo strtoupper(hash("crc32b", $a))."\n\n"; //you can confirm they're equal to those given by $e->getCrc()
|
||||
echo "Done.\n";
|
||||
--EXPECTF--
|
||||
17704 bytes, CRC F2C79881
|
||||
|
||||
@@ -7,6 +7,9 @@ if (key_exists('USE_ZEND_ALLOC', $_ENV) && PHP_VERSION_ID < 70000) die('skip do
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
if (PHP_VERSION_ID>=80500){
|
||||
ini_set('fatal_error_backtraces', 'Off');
|
||||
}
|
||||
|
||||
$f1 = dirname(__FILE__) . "/latest_winrar.rar";
|
||||
$a = RarArchive::open($f1);
|
||||
|
||||
@@ -4,6 +4,9 @@ RarArchive read_property gives a fatal error on a write context
|
||||
<?php if(!extension_loaded("rar")) print "skip"; ?>
|
||||
--FILE--
|
||||
<?php
|
||||
if (PHP_VERSION_ID>=80500){
|
||||
ini_set('fatal_error_backtraces', 'Off');
|
||||
}
|
||||
|
||||
$f1 = dirname(__FILE__) . "/latest_winrar.rar";
|
||||
$a = RarArchive::open($f1);
|
||||
|
||||
@@ -7,6 +7,9 @@ if (key_exists('USE_ZEND_ALLOC', $_ENV) && PHP_VERSION_ID < 70000) die('skip do
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
if (PHP_VERSION_ID>=80500){
|
||||
ini_set('fatal_error_backtraces', 'Off');
|
||||
}
|
||||
|
||||
$f1 = dirname(__FILE__) . "/latest_winrar.rar";
|
||||
$a = RarArchive::open($f1);
|
||||
|
||||
@@ -4,6 +4,9 @@ RarArchive unset_property gives a fatal error
|
||||
<?php if(!extension_loaded("rar")) print "skip"; ?>
|
||||
--FILE--
|
||||
<?php
|
||||
if (PHP_VERSION_ID>=80500){
|
||||
ini_set('fatal_error_backtraces', 'Off');
|
||||
}
|
||||
|
||||
$f1 = dirname(__FILE__) . "/latest_winrar.rar";
|
||||
$a = RarArchive::open($f1);
|
||||
|
||||
@@ -4,6 +4,9 @@ Traversal of RarArchive with foreach by reference gives error
|
||||
<?php if(!extension_loaded("rar")) print "skip"; ?>
|
||||
--FILE--
|
||||
<?php
|
||||
if (PHP_VERSION_ID>=80500){
|
||||
ini_set('fatal_error_backtraces', 'Off');
|
||||
}
|
||||
|
||||
$f1 = dirname(__FILE__) . "/latest_winrar.rar";
|
||||
$a = RarArchive::open($f1);
|
||||
|
||||
@@ -3,6 +3,7 @@ Supports version 5 RAR files
|
||||
--SKIPIF--
|
||||
<?php if(!extension_loaded("rar")) die("skip");
|
||||
if (isset($_ENV['APPVEYOR'])) die("skip failing on appveyor");
|
||||
if ($_ENV['RUNNER_OS'] === 'Windows') die("skip failing on Windows runner on GitHub Action");
|
||||
--FILE--
|
||||
<?php
|
||||
RarException::setUsingExceptions(true);
|
||||
|
||||
Reference in New Issue
Block a user