Skip to content

Commit 709b956

Browse files
committed
Merge branch 'php7'
2 parents de6b9b5 + e65be32 commit 709b956

File tree

143 files changed

+3745
-3289
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

143 files changed

+3745
-3289
lines changed

.travis.yml

+27-18
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,36 @@
1+
sudo: required
2+
dist: trusty
3+
14
language: php
25
php:
3-
- 5.5
4-
#- 5.4
5-
#- 5.3
6+
- 7.0
7+
- 7.1
8+
9+
matrix:
10+
fast_finish: true
11+
allow_failures:
12+
- php: 7.1
13+
614
env:
7-
- LIBMEMCACHED_VERSION=1.0.17
8-
- LIBMEMCACHED_VERSION=1.0.16
9-
- LIBMEMCACHED_VERSION=1.0.15
10-
- LIBMEMCACHED_VERSION=1.0.14
11-
- LIBMEMCACHED_VERSION=1.0.10
12-
- LIBMEMCACHED_VERSION=1.0.8
13-
- LIBMEMCACHED_VERSION=1.0.7
14-
- LIBMEMCACHED_VERSION=1.0.6
15-
- LIBMEMCACHED_VERSION=1.0.2
16-
- LIBMEMCACHED_VERSION=0.53
17-
- LIBMEMCACHED_VERSION=0.49
18-
- LIBMEMCACHED_VERSION=0.44
19-
20-
services:
21-
- memcached # will start memcached
15+
- LIBMEMCACHED_VERSION=1.0.18 # Debian Jessie / Ubuntu Xenial
16+
- LIBMEMCACHED_VERSION=1.0.16 # RHEL / CentOS 7
17+
- LIBMEMCACHED_VERSION=1.0.8 # Debian Wheezy / Ubuntu Trusty
18+
19+
addons:
20+
apt:
21+
packages:
22+
- sasl2-bin
23+
- libsasl2-dev
24+
- libevent-dev
2225

2326
before_script:
2427
- ./.travis/travis.sh before_script $LIBMEMCACHED_VERSION
2528

2629
script:
2730
- ./.travis/travis.sh script $LIBMEMCACHED_VERSION
31+
32+
cache:
33+
directories:
34+
- $HOME/cache
35+
36+

.travis/travis.sh

+50-31
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,12 @@ function validate_package_xml() {
4444

4545
function install_libmemcached() {
4646

47+
if test -d "${LIBMEMCACHED_PREFIX}"
48+
then
49+
echo "Using cached libmemcached: ${LIBMEMCACHED_PREFIX}"
50+
return
51+
fi
52+
4753
wget "https://launchpad.net/libmemcached/1.0/${LIBMEMCACHED_VERSION}/+download/libmemcached-${LIBMEMCACHED_VERSION}.tar.gz" -O libmemcached-${LIBMEMCACHED_VERSION}.tar.gz
4854

4955
tar xvfz libmemcached-${LIBMEMCACHED_VERSION}.tar.gz
@@ -73,43 +79,59 @@ function install_igbinary() {
7379
function install_msgpack() {
7480
git clone https://github.com/msgpack/msgpack-php.git
7581
pushd msgpack-php
76-
git checkout php5
7782
phpize
7883
./configure
7984
make
8085
make install
8186
popd
8287
}
8388

84-
function install_sasl() {
89+
function install_memcached() {
90+
local prefix="${HOME}/cache/memcached-sasl-${MEMCACHED_VERSION}"
91+
92+
if test -d "$prefix"
93+
then
94+
echo "Using cached memcached: ${prefix}"
95+
return
96+
fi
8597

86-
wget http://memcached.googlecode.com/files/memcached-1.4.15.tar.gz -O memcached-1.4.15.tar.gz
87-
tar xfz memcached-1.4.15.tar.gz
98+
wget http://www.memcached.org/files/memcached-${MEMCACHED_VERSION}.tar.gz -O memcached-${MEMCACHED_VERSION}.tar.gz
99+
tar xfz memcached-${MEMCACHED_VERSION}.tar.gz
88100

89-
pushd memcached-1.4.15
90-
./configure --enable-sasl --prefix="${HOME}/memcached"
101+
pushd memcached-${MEMCACHED_VERSION}
102+
./configure --enable-sasl --enable-sasl-pwdb --prefix="${prefix}"
91103
make
92104
make install
93105
popd
106+
}
107+
108+
function run_memcached() {
109+
local prefix="${HOME}/cache/memcached-sasl-${MEMCACHED_VERSION}"
94110

95-
sudo apt-get install sasl2-bin
96-
export SASL_CONF_PATH="${HOME}/sasl2"
111+
export SASL_CONF_PATH="/tmp/sasl2"
112+
113+
if test -d "${SASL_CONF_PATH}"
114+
then
115+
rm -rf "${SASL_CONF_PATH}"
116+
fi
97117

98-
# Create config path
99118
mkdir "${SASL_CONF_PATH}"
119+
export MEMCACHED_SASL_PWDB="${SASL_CONF_PATH}/sasldb2"
100120

101121
# Create configuration
102122
cat<<EOF > "${SASL_CONF_PATH}/memcached.conf"
103123
mech_list: PLAIN
104124
plainlog_level: 5
105-
sasldb_path: ${SASL_CONF_PATH}/sasldb2
125+
sasldb_path: ${MEMCACHED_SASL_PWDB}
106126
EOF
107127

108-
# Create password
109-
echo "test" | /usr/sbin/saslpasswd2 -c memcached -a memcached -f "${SASL_CONF_PATH}/sasldb2"
128+
echo "test" | /usr/sbin/saslpasswd2 -c memcached -a memcached -f "${MEMCACHED_SASL_PWDB}"
129+
130+
# Run normal memcached
131+
"${prefix}/bin/memcached" -d -p 11211
110132

111133
# Run memcached on port 11212 with SASL support
112-
"${HOME}/memcached/bin/memcached" -S -d -p 11212
134+
"${prefix}/bin/memcached" -S -d -p 11212
113135
}
114136

115137
function build_php_memcached() {
@@ -129,7 +151,8 @@ function build_php_memcached() {
129151
sasl_flag="--enable-memcached-sasl"
130152
fi
131153

132-
./configure --with-libmemcached-dir="$LIBMEMCACHED_PREFIX" $protocol_flag $sasl_flag --enable-memcached-json --enable-memcached-igbinary --enable-memcached-msgpack
154+
# ./configure --with-libmemcached-dir="$LIBMEMCACHED_PREFIX" $protocol_flag $sasl_flag
155+
./configure --with-libmemcached-dir="$LIBMEMCACHED_PREFIX" $protocol_flag $sasl_flag --enable-memcached-json --enable-memcached-msgpack --enable-memcached-igbinary
133156
make
134157
make install
135158
popd
@@ -152,30 +175,24 @@ EOF
152175
function run_memcached_tests() {
153176
export NO_INTERACTION=1
154177
export REPORT_EXIT_STATUS=1
155-
export TEST_PHP_EXECUTABLE=`which php`
178+
export TEST_PHP_EXECUTABLE=$(which php)
156179

157180
pushd "${PHP_MEMCACHED_BUILD_DIR}/memcached-${PHP_MEMCACHED_VERSION}"
158181
# We have one xfail test, we run it separately
159-
php run-tests.php -d extension=msgpack.so -d extension=igbinary.so -d extension=memcached.so -n ./tests/expire.phpt
182+
php run-tests.php -d extension=memcached.so -n ./tests/expire.phpt
160183
rm ./tests/expire.phpt
161184

162185
# Run normal tests
163-
php run-tests.php -d extension=msgpack.so -d extension=igbinary.so -d extension=memcached.so -n ./tests/*.phpt
186+
php run-tests.php --show-diff -d extension=modules/memcached.so -d extension=msgpack.so -d extension=igbinary.so -n ./tests/*.phpt
164187
retval=$?
165-
for i in `ls tests/*.out 2>/dev/null`; do
166-
echo "-- START ${i}";
167-
cat $i;
168-
echo "";
169-
echo "-- END";
170-
done
171188
popd
172-
173189
return $retval;
174190
}
175191

176192
# Command line arguments
177193
ACTION=$1
178194
LIBMEMCACHED_VERSION=$2
195+
MEMCACHED_VERSION="1.4.25"
179196

180197
if test "x$ACTION" = "x"; then
181198
echo "Usage: $0 <action> <libmemcached version>"
@@ -187,11 +204,15 @@ if test "x$LIBMEMCACHED_VERSION" = "x"; then
187204
exit 1
188205
fi
189206

207+
if test "x$3" != "x"; then
208+
MEMCACHED_VERSION=$3
209+
fi
210+
190211
# the extension version
191212
PHP_MEMCACHED_VERSION=$(php -r '$sxe = simplexml_load_file ("package.xml"); echo (string) $sxe->version->release;')
192213

193214
# Libmemcached install dir
194-
LIBMEMCACHED_PREFIX="${HOME}/libmemcached-${LIBMEMCACHED_VERSION}"
215+
LIBMEMCACHED_PREFIX="${HOME}/cache/libmemcached-${LIBMEMCACHED_VERSION}"
195216

196217
# Where to do the build
197218
PHP_MEMCACHED_BUILD_DIR="/tmp/php-memcached-build"
@@ -216,13 +237,11 @@ case $ACTION in
216237
# Install igbinary extension
217238
install_igbinary
218239

219-
# install msgpack
240+
# Install msgpack extension
220241
install_msgpack
221-
222-
# install SASL
223-
if test "x$ENABLE_SASL" = "xyes"; then
224-
install_sasl
225-
fi
242+
243+
install_memcached
244+
run_memcached
226245
;;
227246

228247
script)

README.markdown

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
Build Status
22
------------
3-
[![Build Status](https://travis-ci.org/php-memcached-dev/php-memcached.png?branch=master)](https://travis-ci.org/php-memcached-dev/php-memcached)
3+
[![Build Status](https://travis-ci.org/php-memcached-dev/php-memcached.png?branch=php7)](https://travis-ci.org/php-memcached-dev/php-memcached)
44

55
Description
66
-----------

config.m4

+40-61
Original file line numberDiff line numberDiff line change
@@ -106,72 +106,29 @@ if test "$PHP_MEMCACHED" != "no"; then
106106
AC_MSG_RESULT([$session_inc_path])
107107
fi
108108
fi
109-
109+
110110
if test "$PHP_MEMCACHED_JSON" != "no"; then
111111
AC_MSG_CHECKING([for json includes])
112112
json_inc_path=""
113-
114-
tmp_version=$PHP_VERSION
115-
if test -z "$tmp_version"; then
116-
if test -z "$PHP_CONFIG"; then
117-
AC_MSG_ERROR([php-config not found])
118-
fi
119-
PHP_MEMCACHED_VERSION_ORIG=`$PHP_CONFIG --version`;
120-
else
121-
PHP_MEMCACHED_VERSION_ORIG=$tmp_version
122-
fi
123113

124-
if test -z $PHP_MEMCACHED_VERSION_ORIG; then
125-
AC_MSG_ERROR([failed to detect PHP version, please report])
114+
if test -f "$abs_srcdir/include/php/ext/json/php_json.h"; then
115+
json_inc_path="$abs_srcdir/include/php"
116+
elif test -f "$abs_srcdir/ext/json/php_json.h"; then
117+
json_inc_path="$abs_srcdir"
118+
elif test -f "$phpincludedir/ext/json/php_json.h"; then
119+
json_inc_path="$phpincludedir"
120+
else
121+
for i in php php4 php5 php6; do
122+
if test -f "$prefix/include/$i/ext/json/php_json.h"; then
123+
json_inc_path="$prefix/include/$i"
124+
fi
125+
done
126126
fi
127-
128-
PHP_MEMCACHED_VERSION_MASK=`echo ${PHP_MEMCACHED_VERSION_ORIG} | awk 'BEGIN { FS = "."; } { printf "%d", ($1 * 1000 + $2) * 1000 + $3;}'`
129-
130-
if test $PHP_MEMCACHED_VERSION_MASK -ge 5003000; then
131-
if test -f "$abs_srcdir/include/php/ext/json/php_json.h"; then
132-
json_inc_path="$abs_srcdir/include/php"
133-
elif test -f "$abs_srcdir/ext/json/php_json.h"; then
134-
json_inc_path="$abs_srcdir"
135-
elif test -f "$phpincludedir/ext/json/php_json.h"; then
136-
json_inc_path="$phpincludedir"
137-
else
138-
for i in php php4 php5 php6; do
139-
if test -f "$prefix/include/$i/ext/json/php_json.h"; then
140-
json_inc_path="$prefix/include/$i"
141-
fi
142-
done
143-
fi
144-
if test "$json_inc_path" = ""; then
145-
AC_MSG_ERROR([Cannot find php_json.h])
146-
else
147-
AC_DEFINE(HAVE_JSON_API,1,[Whether JSON API is available])
148-
AC_DEFINE(HAVE_JSON_API_5_3,1,[Whether JSON API for PHP 5.3 is available])
149-
AC_MSG_RESULT([$json_inc_path])
150-
fi
151-
elif test $PHP_MEMCACHED_VERSION_MASK -ge 5002009; then
152-
dnl Check JSON for PHP 5.2.9+
153-
if test -f "$abs_srcdir/include/php/ext/json/php_json.h"; then
154-
json_inc_path="$abs_srcdir/include/php"
155-
elif test -f "$abs_srcdir/ext/json/php_json.h"; then
156-
json_inc_path="$abs_srcdir"
157-
elif test -f "$phpincludedir/ext/json/php_json.h"; then
158-
json_inc_path="$phpincludedir"
159-
else
160-
for i in php php4 php5 php6; do
161-
if test -f "$prefix/include/$i/ext/json/php_json.h"; then
162-
json_inc_path="$prefix/include/$i"
163-
fi
164-
done
165-
fi
166-
if test "$json_inc_path" = ""; then
167-
AC_MSG_ERROR([Cannot find php_json.h])
168-
else
169-
AC_DEFINE(HAVE_JSON_API,1,[Whether JSON API is available])
170-
AC_DEFINE(HAVE_JSON_API_5_2,1,[Whether JSON API for PHP 5.2 is available])
171-
AC_MSG_RESULT([$json_inc_path])
172-
fi
173-
else
174-
AC_MSG_RESULT([the PHP version does not support JSON serialization API])
127+
if test "$json_inc_path" = ""; then
128+
AC_MSG_ERROR([Cannot find php_json.h])
129+
else
130+
AC_DEFINE(HAVE_JSON_API,1,[Whether JSON API is available])
131+
AC_MSG_RESULT([$json_inc_path])
175132
fi
176133
fi
177134

@@ -339,6 +296,28 @@ if test "$PHP_MEMCACHED" != "no"; then
339296
AC_MSG_RESULT([no])
340297
fi
341298

299+
ORIG_CFLAGS="$CFLAGS"
300+
ORIG_LIBS="$LIBS"
301+
302+
CFLAGS="$CFLAGS $PHP_LIBMEMCACHED_INCLUDES"
303+
LIBS="$LIBS $PHP_LIBMEMCACHED_LIBS"
304+
305+
AC_CACHE_CHECK([whether memcached_exist is defined], ac_cv_have_memcached_exist, [
306+
AC_TRY_LINK(
307+
[ #include <libmemcached/memcached.h> ],
308+
[ memcached_exist (NULL, NULL, 0); ],
309+
[ ac_cv_have_memcached_exist="yes" ],
310+
[ ac_cv_have_memcached_exist="no" ]
311+
)
312+
])
313+
314+
CFLAGS="$ORIG_CFLAGS"
315+
LIBS="$ORIG_LIBS"
316+
317+
if test "$ac_cv_have_memcached_exist" = "yes"; then
318+
AC_DEFINE(HAVE_MEMCACHED_EXIST, [1], [Whether memcached_exist is defined])
319+
fi
320+
342321
PHP_MEMCACHED_FILES="php_memcached.c php_libmemcached_compat.c g_fmt.c"
343322

344323
if test "$PHP_SYSTEM_FASTLZ" != "no"; then

0 commit comments

Comments
 (0)