kjdev / php-ext-snappy Goto Github PK
View Code? Open in Web Editor NEWSnappy Extension for PHP
License: Other
Snappy Extension for PHP
License: Other
I'm not certain if this package just hasn't been updated to support PHP8 yet, or if it's a problem with my machine/configuration. The output of make is:
/bin/sh /Users/troy/php-ext-snappy/libtool --mode=compile cc -I. -I/Users/troy/php-ext-snappy -I/Users/troy/php-ext-snappy/include -I/Users/troy/php-ext-snappy/main -I/Users/troy/php-ext-snappy -I/usr/local/Cellar/php/8.0.1_1/include/php -I/usr/local/Cellar/php/8.0.1_1/include/php/main -I/usr/local/Cellar/php/8.0.1_1/include/php/TSRM -I/usr/local/Cellar/php/8.0.1_1/include/php/Zend -I/usr/local/Cellar/php/8.0.1_1/include/php/ext -I/usr/local/Cellar/php/8.0.1_1/include/php/ext/date/lib -I/Users/troy/php-ext-snappy/snappy -DHAVE_CONFIG_H -g -O2 -c /Users/troy/php-ext-snappy/snappy.c -o snappy.lo
mkdir .libs
cc -I. -I/Users/troy/php-ext-snappy -I/Users/troy/php-ext-snappy/include -I/Users/troy/php-ext-snappy/main -I/Users/troy/php-ext-snappy -I/usr/local/Cellar/php/8.0.1_1/include/php -I/usr/local/Cellar/php/8.0.1_1/include/php/main -I/usr/local/Cellar/php/8.0.1_1/include/php/TSRM -I/usr/local/Cellar/php/8.0.1_1/include/php/Zend -I/usr/local/Cellar/php/8.0.1_1/include/php/ext -I/usr/local/Cellar/php/8.0.1_1/include/php/ext/date/lib -I/Users/troy/php-ext-snappy/snappy -DHAVE_CONFIG_H -g -O2 -c /Users/troy/php-ext-snappy/snappy.c -fno-common -DPIC -o .libs/snappy.o
/bin/sh /Users/troy/php-ext-snappy/libtool --mode=compile g++ -I. -I/Users/troy/php-ext-snappy -I/Users/troy/php-ext-snappy/include -I/Users/troy/php-ext-snappy/main -I/Users/troy/php-ext-snappy -I/usr/local/Cellar/php/8.0.1_1/include/php -I/usr/local/Cellar/php/8.0.1_1/include/php/main -I/usr/local/Cellar/php/8.0.1_1/include/php/TSRM -I/usr/local/Cellar/php/8.0.1_1/include/php/Zend -I/usr/local/Cellar/php/8.0.1_1/include/php/ext -I/usr/local/Cellar/php/8.0.1_1/include/php/ext/date/lib -I/Users/troy/php-ext-snappy/snappy -DHAVE_CONFIG_H -g -O2 -c /Users/troy/php-ext-snappy/snappy/snappy-c.cc -o snappy/snappy-c.lo
mkdir snappy/.libs
g++ -I. -I/Users/troy/php-ext-snappy -I/Users/troy/php-ext-snappy/include -I/Users/troy/php-ext-snappy/main -I/Users/troy/php-ext-snappy -I/usr/local/Cellar/php/8.0.1_1/include/php -I/usr/local/Cellar/php/8.0.1_1/include/php/main -I/usr/local/Cellar/php/8.0.1_1/include/php/TSRM -I/usr/local/Cellar/php/8.0.1_1/include/php/Zend -I/usr/local/Cellar/php/8.0.1_1/include/php/ext -I/usr/local/Cellar/php/8.0.1_1/include/php/ext/date/lib -I/Users/troy/php-ext-snappy/snappy -DHAVE_CONFIG_H -g -O2 -c /Users/troy/php-ext-snappy/snappy/snappy-c.cc -fno-common -DPIC -o snappy/.libs/snappy-c.o
In file included from /Users/troy/php-ext-snappy/snappy/snappy-c.cc:29:
In file included from /Users/troy/php-ext-snappy/snappy/snappy.h:45:
/Users/troy/php-ext-snappy/snappy/snappy-stubs-public.h:54:14: warning: alias
declarations are a C++11 extension [-Wc++11-extensions]
using int8 = std::int8_t;
^
/Users/troy/php-ext-snappy/snappy/snappy-stubs-public.h:55:15: warning: alias
declarations are a C++11 extension [-Wc++11-extensions]
using uint8 = std::uint8_t;
^
/Users/troy/php-ext-snappy/snappy/snappy-stubs-public.h:56:15: warning: alias
declarations are a C++11 extension [-Wc++11-extensions]
using int16 = std::int16_t;
^
/Users/troy/php-ext-snappy/snappy/snappy-stubs-public.h:57:16: warning: alias
declarations are a C++11 extension [-Wc++11-extensions]
using uint16 = std::uint16_t;
^
/Users/troy/php-ext-snappy/snappy/snappy-stubs-public.h:58:15: warning: alias
declarations are a C++11 extension [-Wc++11-extensions]
using int32 = std::int32_t;
^
/Users/troy/php-ext-snappy/snappy/snappy-stubs-public.h:59:16: warning: alias
declarations are a C++11 extension [-Wc++11-extensions]
using uint32 = std::uint32_t;
^
/Users/troy/php-ext-snappy/snappy/snappy-stubs-public.h:60:15: warning: alias
declarations are a C++11 extension [-Wc++11-extensions]
using int64 = std::int64_t;
^
/Users/troy/php-ext-snappy/snappy/snappy-stubs-public.h:61:16: warning: alias
declarations are a C++11 extension [-Wc++11-extensions]
using uint64 = std::uint64_t;
^
In file included from /Users/troy/php-ext-snappy/snappy/snappy-c.cc:29:
/Users/troy/php-ext-snappy/snappy/snappy.h:197:10: error: unknown type name
'constexpr'
static constexpr int kBlockLog = 16;
^
/Users/troy/php-ext-snappy/snappy/snappy.h:198:10: error: unknown type name
'constexpr'
static constexpr size_t kBlockSize = 1 << kBlockLog;
^
/Users/troy/php-ext-snappy/snappy/snappy.h:198:26: error: expected ';' after top
level declarator
static constexpr size_t kBlockSize = 1 << kBlockLog;
^
;
/Users/troy/php-ext-snappy/snappy/snappy.h:200:10: error: unknown type name
'constexpr'
static constexpr int kMinHashTableBits = 8;
^
/Users/troy/php-ext-snappy/snappy/snappy.h:201:10: error: unknown type name
'constexpr'
static constexpr size_t kMinHashTableSize = 1 << kMinHashTableBits;
^
/Users/troy/php-ext-snappy/snappy/snappy.h:201:26: error: expected ';' after top
level declarator
static constexpr size_t kMinHashTableSize = 1 << kMinHashTableBits;
^
;
/Users/troy/php-ext-snappy/snappy/snappy.h:203:10: error: unknown type name
'constexpr'
static constexpr int kMaxHashTableBits = 14;
^
/Users/troy/php-ext-snappy/snappy/snappy.h:204:10: error: unknown type name
'constexpr'
static constexpr size_t kMaxHashTableSize = 1 << kMaxHashTableBits;
^
/Users/troy/php-ext-snappy/snappy/snappy.h:204:26: error: expected ';' after top
level declarator
static constexpr size_t kMaxHashTableSize = 1 << kMaxHashTableBits;
^
;
8 warnings and 9 errors generated.
make: *** [snappy/snappy-c.lo] Error 1
I can't build it for php7.3
Also i run phpsize7.3 but ./configure build for 7.1
Is it better to use AC_LANG_PUSH
and AC_LANG_POP
when compiling related C++ files?
Because I was trying to add the snappy extension to static-php-cli and discovered that the snappy extension's AC_LANG([C++])
would cause other extensions and autoconf AC_CHECK_LIB to generate incorrect results when compiled inline.
A reproducible example is that when I was compiling Swoole and snappy inline on the macOS platform, I found that the content of conftest.c for checking kqueue in php-src/configure
changed to namespace conftest{
.
It doesn't support php7.4
Would be great to allow build it with apcu support (like igbinary doing) to allow use snappy as serialization for it
Vulnerability Details : CVE-2009-3736
| RESOURCE | VULNERABILITY | SEVERITY | INSTALLED VERSION | FIXED VERSION |
+-----------------------------+---------------+----------+-------------------+---------------+
| /app/php-ext-snappy/libtool | CVE-2009-3736 | MEDIUM | 1.5.26 | |
+-----------------------------+---------------+----------+-------------------+---------------+
Used to package the extension for Alpinelinux https://gitlab.alpinelinux.org/alpine/aports/-/merge_requests/11990
Faced that 2 tests fails for s390x arch
PHP : /usr/bin/php7
PHP_SAPI : cli
PHP_VERSION : 7.4.9
ZEND_VERSION: 3.4.0
PHP_OS : Linux - Linux runner-u9etpb6z-project-46-concurrent-0 5.4.43-1-lts #2-Alpine SMP Thu, 28 May 2020 20:13:48 UTC s390x
INI actual : /builds/andypost/aports/testing/php7-snappy/src/php-ext-snappy-0.1.11/tmp-php.ini
More .INIs :
CWD : /builds/andypost/aports/testing/php7-snappy/src/php-ext-snappy-0.1.11
Extra dirs :
VALGRIND : Not used
=====================================================================
TIME START 2020-09-02 20:23:53
=====================================================================
FAIL Test snappy_compress() function : basic functionality [tests/001.phpt]
PASS Test snappy_compress() function : error conditions [tests/002.phpt]
SKIP Test snappy_compress() function : error conditions [tests/002_b.phpt] reason: PHP is too new
FAIL Test snappy_compress() function : variation [tests/003.phpt]
PASS Test snappy_uncompress() function : basic functionality [tests/004.phpt]
PASS Test snappy_uncompress() function : error conditions [tests/005.phpt]
SKIP Test snappy_uncompress() function : error conditions [tests/005_b.phpt] reason: PHP is too new
PASS Test phpinfo() displays snappy info [tests/info.phpt]
=====================================================================
TIME END 2020-09-02 20:23:53
=====================================================================
TEST RESULT SUMMARY
---------------------------------------------------------------------
Exts skipped : 0
Exts tested : 12
---------------------------------------------------------------------
Number of tests : 8 6
Tests skipped : 2 ( 25.0%) --------
Tests warned : 0 ( 0.0%) ( 0.0%)
Tests failed : 2 ( 25.0%) ( 33.3%)
Tests passed : 4 ( 50.0%) ( 66.7%)
---------------------------------------------------------------------
Time taken : 0 seconds
=====================================================================
=====================================================================
FAILED TEST SUMMARY
---------------------------------------------------------------------
Test snappy_compress() function : basic functionality [tests/001.phpt]
Test snappy_compress() function : variation [tests/003.phpt]
Hi,
I am getting following error during make test:
PHP Warning: PHP Startup: Unable to load dynamic library '/home/rishi/projects/php-ext-snappy/modules/snappy.so' - /home/rishi/projects/php-ext-snappy/modules/snappy.so: undefined symbol: _ZTVN10__cxxabiv117__class_type_infoE in Unknown on line 0
Warning: PHP Startup: Unable to load dynamic library '/home/rishi/projects/php-ext-snappy/modules/snappy.so' - /home/rishi/projects/php-ext-snappy/modules/snappy.so: undefined symbol: _ZTVN10__cxxabiv117__class_type_infoE in Unknown on line 0
PHP Warning: PHP Startup: Unable to load dynamic library '/home/rishi/projects/php-ext-snappy/modules/snappy.so' - /home/rishi/projects/php-ext-snappy/modules/snappy.so: undefined symbol: _ZTVN10__cxxabiv117__class_type_infoE in Unknown on line 0
Warning: PHP Startup: Unable to load dynamic library '/home/rishi/projects/php-ext-snappy/modules/snappy.so' - /home/rishi/projects/php-ext-snappy/modules/snappy.so: undefined symbol: _ZTVN10__cxxabiv117__class_type_infoE in Unknown on line 0
Here is complete log:
bin/bash /home/rishi/projects/php-ext-snappy/libtool --mode=install cp ./snappy.la /home/rishi/projects/php-ext-snappy/modules
libtool: install: cp ./.libs/snappy.so /home/rishi/projects/php-ext-snappy/modules/snappy.so
libtool: install: cp ./.libs/snappy.lai /home/rishi/projects/php-ext-snappy/modules/snappy.la
Libraries have been installed in:
/home/rishi/projects/php-ext-snappy/modules
If you ever happen to want to link against installed libraries
in a given directory, LIBDIR, you must either use libtool, and
specify the full pathname of the library, or use the `-LLIBDIR'
flag during linking and do at least one of the following:
See any operating system documentation about shared libraries for
Build complete.
Don't forget to run 'make test'.
PHP Warning: PHP Startup: Unable to load dynamic library '/home/rishi/projects/php-ext-snappy/modules/snappy.so' - /home/rishi/projects/php-ext-snappy/modules/snappy.so: undefined symbol: _ZTVN10__cxxabiv117__class_type_infoE in Unknown on line 0
Warning: PHP Startup: Unable to load dynamic library '/home/rishi/projects/php-ext-snappy/modules/snappy.so' - /home/rishi/projects/php-ext-snappy/modules/snappy.so: undefined symbol: _ZTVN10__cxxabiv117__class_type_infoE in Unknown on line 0
PHP Warning: PHP Startup: Unable to load dynamic library '/home/rishi/projects/php-ext-snappy/modules/snappy.so' - /home/rishi/projects/php-ext-snappy/modules/snappy.so: undefined symbol: _ZTVN10__cxxabiv117__class_type_infoE in Unknown on line 0
Warning: PHP Startup: Unable to load dynamic library '/home/rishi/projects/php-ext-snappy/modules/snappy.so' - /home/rishi/projects/php-ext-snappy/modules/snappy.so: undefined symbol: _ZTVN10__cxxabiv117__class_type_infoE in Unknown on line 0
PHP : /usr/bin/php
PHP_SAPI : cli
PHP_VERSION : 5.3.10-1ubuntu3.7
ZEND_VERSION: 2.3.0
PHP_OS : Linux - Linux FAB-HO-186-L 3.5.0-39-generic #60~precise1-Ubuntu SMP Wed Aug 14 15:38:41 UTC 2013 x86_64
INI actual : /home/rishi/projects/php-ext-snappy/tmp-php.ini
More .INIs :
CWD : /home/rishi/projects/php-ext-snappy
Extra dirs :
FAIL Test snappy_compress() function : basic functionality [tests/001.phpt]
FAIL Test snappy_compress() function : error conditions [tests/002.phpt]
FAIL Test snappy_compress() function : variation [tests/003.phpt]
FAIL Test snappy_uncompress() function : basic functionality [tests/004.phpt]
FAIL Test snappy_uncompress() function : error conditions [tests/005.phpt]
TIME END 2013-09-09 12:25:00
Exts skipped : 0
Number of tests : 6 6
Tests skipped : 0 ( 0.0%) --------
Tests warned : 0 ( 0.0%) ( 0.0%)
Tests failed : 6 (100.0%) (100.0%)
Expected fail : 0 ( 0.0%) ( 0.0%)
Test snappy_compress() function : basic functionality [tests/001.phpt]
Test snappy_compress() function : error conditions [tests/002.phpt]
Test snappy_compress() function : variation [tests/003.phpt]
Test snappy_uncompress() function : basic functionality [tests/004.phpt]
Test snappy_uncompress() function : error conditions [tests/005.phpt]
You may have found a problem in PHP.
This report can be automatically sent to the PHP QA team at
http://qa.php.net/reports and http://news.php.net/php.qa.reports
This gives us a better understanding of PHP's behavior.
If you don't want to send the report immediately you can choose
option "s" to save it. You can then email it to [email protected] later.
Do you want to send this report now? [Yns]: no
Hi guys! I can't install snappy in Ubuntu 18.04.
What I'm doing wrong?
rafael@Ubuntu-1804-bionic-64-minimal:~$ git clone --recursive --depth=1 https://github.com/kjdev/php-ext-snappy.git
Cloning into 'php-ext-snappy'...
remote: Counting objects: 22, done.
remote: Compressing objects: 100% (19/19), done.
remote: Total 22 (delta 1), reused 11 (delta 1), pack-reused 0
Unpacking objects: 100% (22/22), done.
Submodule 'snappy' (https://github.com/google/snappy.git) registered for path 'snappy'
Cloning into '/home/rafael/php-ext-snappy/snappy'...
remote: Counting objects: 785, done.
remote: Compressing objects: 100% (3/3), done.
remote: Total 785 (delta 0), reused 1 (delta 0), pack-reused 782
Receiving objects: 100% (785/785), 2.39 MiB | 4.13 MiB/s, done.
Resolving deltas: 100% (508/508), done.
Submodule path 'snappy': checked out 'b02bfa754ebf27921d8da3bd2517eab445b84ff9'
rafael@Ubuntu-1804-bionic-64-minimal:~$ cd php-ext-snappy/
rafael@Ubuntu-1804-bionic-64-minimal:~/php-ext-snappy$ phpize
Configuring for:
PHP Api Version: 20151012
Zend Module Api No: 20151012
Zend Extension Api No: 320151012
rafael@Ubuntu-1804-bionic-64-minimal:~/php-ext-snappy$ ./configure
checking for grep that handles long lines and -e... /bin/grep
checking for egrep... /bin/grep -E
checking for a sed that does not truncate output... /bin/sed
checking for cc... cc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables...
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether cc accepts -g... yes
checking for cc option to accept ISO C89... none needed
checking how to run the C preprocessor... cc -E
checking for icc... no
checking for suncc... no
checking whether cc understands -c and -o together... yes
checking for system library directory... lib
checking if compiler supports -R... no
checking if compiler supports -Wl,-rpath,... yes
checking build system type... x86_64-pc-linux-gnu
checking host system type... x86_64-pc-linux-gnu
checking target system type... x86_64-pc-linux-gnu
checking for PHP prefix... /usr
checking for PHP includes... -I/usr/include/php/20151012 -I/usr/include/php/20151012/main -I/usr/include/php/20151012/TSRM -I/usr/include/php/20151012/Zend -I/usr/include/php/20151012/ext -I/usr/include/php/20151012/ext/date/lib
checking for PHP extension directory... /usr/lib/php/20151012
checking for PHP installed headers prefix... /usr/include/php/20151012
checking if debug is enabled... no
checking if zts is enabled... no
checking for re2c... no
configure: WARNING: You will need re2c 0.13.4 or later if you want to regenerate PHP parsers.
checking for gawk... gawk
checking PHP version... #define PHP_VERSION "7.0.31-1+ubuntu18.04.1+deb.sury.org+1"
./configure: line 4216: test: too many arguments
checking whether to enable snappy support... yes, shared
checking for snappy header... no
checking searching for libsnappy... use bundled version
checking for g++... no
checking for c++... no
checking for gpp... no
checking for aCC... no
checking for CC... no
checking for cxx... no
checking for cc++... no
checking for cl.exe... no
checking for FCC... no
checking for KCC... no
checking for RCC... no
checking for xlC_r... no
checking for xlC... no
checking whether we are using the GNU C++ compiler... no
checking whether g++ accepts -g... no
checking how to run the C++ preprocessor... /lib/cpp
configure: error: in `/home/rafael/php-ext-snappy':
configure: error: C++ preprocessor "/lib/cpp" fails sanity check
See `config.log' for more details
Currently there is no easy way to set the max decompressed size using this extension. This means that snappy can be used for zip bombing attacks if it's used to compress user input.
A $max_decoded_len parameter, which limits the max size of the decompressed payload similar to zlib_decode(), would be nice to have.
Ubuntu
I have tried as ReadMe instructed. In other words, I have made so file and copied into relevant directory that contians other .so files. And I made snappy.ini file in /etc/php/7.2/conf.d and 20-snappy.ini file /etc/php/7.2/mods-available.
After that, I have tried to composer install again. But still it says my system has no php extension snappy.
Windows
Is there no solution for this extension. I can't find any solution here.
Hi,
we are running snappy with build-essential installed on ubuntu:16.04 for some while now. This setup is not working anymore with the new merges from yesterday (29.05.).
We get the following error:
#error This file requires compiler and library support \
Step #0: /usr/include/c++/5/bits/c++0x_warning.h:32:2: error: #error This file requires compiler and library support for the ISO C++ 2011 standard. This support must be enabled with the -std=c++11 or -std=gnu++11 compiler options.
What do we need to change? do we need more than the build-essential package? Can we provide more information on that issue?
Kind regards,
Christian
config.status: error: cannot find input file: `snappy/snappy-stubs-public.h.in'
from
php7.1.33
CentOS Linux release 7.7.1908 (Core)
Linux mirror.iwangzhenet 3.10.0-1062.18.1.el7.x86_64 #1 SMP Tue Mar 17 23:49:17 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux
Hi @kjdev,
Is this extension compatible to PHP 7? Does it need to be fixed or ready for PHP 7? If it needs to be fixed, do you manage to do it? and ETA?
Thanks
Can this extension be published to pecl?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.