Commit 190b5270 authored by Paul Yang's avatar Paul Yang Committed by GitHub

Make PHP c extension work with PHP7 (#2951)

parent 43234828
...@@ -65,6 +65,9 @@ src/js_embed ...@@ -65,6 +65,9 @@ src/js_embed
src/protoc src/protoc
src/unittest_proto_middleman src/unittest_proto_middleman
# vim generated
*.swp
# Generated test scaffolding # Generated test scaffolding
src/no_warning_test.cc src/no_warning_test.cc
src/no-warning-test src/no-warning-test
......
...@@ -32,6 +32,7 @@ env: ...@@ -32,6 +32,7 @@ env:
- CONFIG=ruby22 - CONFIG=ruby22
- CONFIG=jruby - CONFIG=jruby
- CONFIG=php5.6_mac - CONFIG=php5.6_mac
- CONFIG=php7.0_mac
matrix: matrix:
exclude: exclude:
# It's nontrivial to programmatically install a new JDK from the command # It's nontrivial to programmatically install a new JDK from the command
......
...@@ -8,6 +8,7 @@ Recommended.JsonInput.DurationHas6FractionalDigits.Validator ...@@ -8,6 +8,7 @@ Recommended.JsonInput.DurationHas6FractionalDigits.Validator
Recommended.JsonInput.DurationHas9FractionalDigits.Validator Recommended.JsonInput.DurationHas9FractionalDigits.Validator
Recommended.JsonInput.DurationHasZeroFractionalDigit.Validator Recommended.JsonInput.DurationHasZeroFractionalDigit.Validator
Recommended.JsonInput.Int64FieldBeString.Validator Recommended.JsonInput.Int64FieldBeString.Validator
Recommended.JsonInput.MapFieldValueIsNull
Recommended.JsonInput.OneofZeroBool.JsonOutput Recommended.JsonInput.OneofZeroBool.JsonOutput
Recommended.JsonInput.OneofZeroBool.ProtobufOutput Recommended.JsonInput.OneofZeroBool.ProtobufOutput
Recommended.JsonInput.OneofZeroBytes.JsonOutput Recommended.JsonInput.OneofZeroBytes.JsonOutput
...@@ -24,6 +25,8 @@ Recommended.JsonInput.OneofZeroUint32.JsonOutput ...@@ -24,6 +25,8 @@ Recommended.JsonInput.OneofZeroUint32.JsonOutput
Recommended.JsonInput.OneofZeroUint32.ProtobufOutput Recommended.JsonInput.OneofZeroUint32.ProtobufOutput
Recommended.JsonInput.OneofZeroUint64.JsonOutput Recommended.JsonInput.OneofZeroUint64.JsonOutput
Recommended.JsonInput.OneofZeroUint64.ProtobufOutput Recommended.JsonInput.OneofZeroUint64.ProtobufOutput
Recommended.JsonInput.RepeatedFieldMessageElementIsNull
Recommended.JsonInput.RepeatedFieldPrimitiveElementIsNull
Recommended.JsonInput.StringEndsWithEscapeChar Recommended.JsonInput.StringEndsWithEscapeChar
Recommended.JsonInput.StringFieldSurrogateInWrongOrder Recommended.JsonInput.StringFieldSurrogateInWrongOrder
Recommended.JsonInput.StringFieldUnpairedHighSurrogate Recommended.JsonInput.StringFieldUnpairedHighSurrogate
...@@ -127,24 +130,12 @@ Required.JsonInput.Int32FieldStringValue.JsonOutput ...@@ -127,24 +130,12 @@ Required.JsonInput.Int32FieldStringValue.JsonOutput
Required.JsonInput.Int32FieldStringValue.ProtobufOutput Required.JsonInput.Int32FieldStringValue.ProtobufOutput
Required.JsonInput.Int32FieldStringValueEscaped.JsonOutput Required.JsonInput.Int32FieldStringValueEscaped.JsonOutput
Required.JsonInput.Int32FieldStringValueEscaped.ProtobufOutput Required.JsonInput.Int32FieldStringValueEscaped.ProtobufOutput
Required.JsonInput.Int32MapEscapedKey.JsonOutput
Required.JsonInput.Int32MapEscapedKey.ProtobufOutput
Required.JsonInput.Int32MapField.JsonOutput
Required.JsonInput.Int32MapField.ProtobufOutput
Required.JsonInput.Int64FieldMaxValue.JsonOutput Required.JsonInput.Int64FieldMaxValue.JsonOutput
Required.JsonInput.Int64FieldMaxValue.ProtobufOutput Required.JsonInput.Int64FieldMaxValue.ProtobufOutput
Required.JsonInput.Int64FieldMinValue.JsonOutput Required.JsonInput.Int64FieldMinValue.JsonOutput
Required.JsonInput.Int64FieldMinValue.ProtobufOutput Required.JsonInput.Int64FieldMinValue.ProtobufOutput
Required.JsonInput.Int64MapEscapedKey.JsonOutput
Required.JsonInput.Int64MapEscapedKey.ProtobufOutput
Required.JsonInput.Int64MapField.JsonOutput
Required.JsonInput.Int64MapField.ProtobufOutput
Required.JsonInput.MessageField.JsonOutput Required.JsonInput.MessageField.JsonOutput
Required.JsonInput.MessageField.ProtobufOutput Required.JsonInput.MessageField.ProtobufOutput
Required.JsonInput.MessageMapField.JsonOutput
Required.JsonInput.MessageMapField.ProtobufOutput
Required.JsonInput.MessageRepeatedField.JsonOutput
Required.JsonInput.MessageRepeatedField.ProtobufOutput
Required.JsonInput.OptionalBoolWrapper.JsonOutput Required.JsonInput.OptionalBoolWrapper.JsonOutput
Required.JsonInput.OptionalBoolWrapper.ProtobufOutput Required.JsonInput.OptionalBoolWrapper.ProtobufOutput
Required.JsonInput.OptionalBytesWrapper.JsonOutput Required.JsonInput.OptionalBytesWrapper.JsonOutput
...@@ -165,14 +156,13 @@ Required.JsonInput.OptionalUint64Wrapper.JsonOutput ...@@ -165,14 +156,13 @@ Required.JsonInput.OptionalUint64Wrapper.JsonOutput
Required.JsonInput.OptionalUint64Wrapper.ProtobufOutput Required.JsonInput.OptionalUint64Wrapper.ProtobufOutput
Required.JsonInput.OptionalWrapperTypesWithNonDefaultValue.JsonOutput Required.JsonInput.OptionalWrapperTypesWithNonDefaultValue.JsonOutput
Required.JsonInput.OptionalWrapperTypesWithNonDefaultValue.ProtobufOutput Required.JsonInput.OptionalWrapperTypesWithNonDefaultValue.ProtobufOutput
Required.JsonInput.PrimitiveRepeatedField.JsonOutput
Required.JsonInput.PrimitiveRepeatedField.ProtobufOutput
Required.JsonInput.RepeatedBoolWrapper.JsonOutput Required.JsonInput.RepeatedBoolWrapper.JsonOutput
Required.JsonInput.RepeatedBoolWrapper.ProtobufOutput Required.JsonInput.RepeatedBoolWrapper.ProtobufOutput
Required.JsonInput.RepeatedBytesWrapper.JsonOutput Required.JsonInput.RepeatedBytesWrapper.JsonOutput
Required.JsonInput.RepeatedBytesWrapper.ProtobufOutput Required.JsonInput.RepeatedBytesWrapper.ProtobufOutput
Required.JsonInput.RepeatedDoubleWrapper.JsonOutput Required.JsonInput.RepeatedDoubleWrapper.JsonOutput
Required.JsonInput.RepeatedDoubleWrapper.ProtobufOutput Required.JsonInput.RepeatedDoubleWrapper.ProtobufOutput
Required.JsonInput.RepeatedFieldWrongElementTypeExpectingMessagesGotInt
Required.JsonInput.RepeatedFieldWrongElementTypeExpectingStringsGotInt Required.JsonInput.RepeatedFieldWrongElementTypeExpectingStringsGotInt
Required.JsonInput.RepeatedFloatWrapper.JsonOutput Required.JsonInput.RepeatedFloatWrapper.JsonOutput
Required.JsonInput.RepeatedFloatWrapper.ProtobufOutput Required.JsonInput.RepeatedFloatWrapper.ProtobufOutput
...@@ -186,9 +176,15 @@ Required.JsonInput.RepeatedUint32Wrapper.JsonOutput ...@@ -186,9 +176,15 @@ Required.JsonInput.RepeatedUint32Wrapper.JsonOutput
Required.JsonInput.RepeatedUint32Wrapper.ProtobufOutput Required.JsonInput.RepeatedUint32Wrapper.ProtobufOutput
Required.JsonInput.RepeatedUint64Wrapper.JsonOutput Required.JsonInput.RepeatedUint64Wrapper.JsonOutput
Required.JsonInput.RepeatedUint64Wrapper.ProtobufOutput Required.JsonInput.RepeatedUint64Wrapper.ProtobufOutput
Required.JsonInput.StringFieldEscape.JsonOutput
Required.JsonInput.StringFieldEscape.ProtobufOutput
Required.JsonInput.StringFieldNotAString Required.JsonInput.StringFieldNotAString
Required.JsonInput.StringFieldSurrogatePair.JsonOutput Required.JsonInput.StringFieldSurrogatePair.JsonOutput
Required.JsonInput.StringFieldSurrogatePair.ProtobufOutput Required.JsonInput.StringFieldSurrogatePair.ProtobufOutput
Required.JsonInput.StringFieldUnicodeEscape.JsonOutput
Required.JsonInput.StringFieldUnicodeEscape.ProtobufOutput
Required.JsonInput.StringFieldUnicodeEscapeWithLowercaseHexLetters.JsonOutput
Required.JsonInput.StringFieldUnicodeEscapeWithLowercaseHexLetters.ProtobufOutput
Required.JsonInput.Struct.JsonOutput Required.JsonInput.Struct.JsonOutput
Required.JsonInput.Struct.ProtobufOutput Required.JsonInput.Struct.ProtobufOutput
Required.JsonInput.TimestampMaxValue.JsonOutput Required.JsonInput.TimestampMaxValue.JsonOutput
...@@ -203,12 +199,8 @@ Required.JsonInput.TimestampWithPositiveOffset.JsonOutput ...@@ -203,12 +199,8 @@ Required.JsonInput.TimestampWithPositiveOffset.JsonOutput
Required.JsonInput.TimestampWithPositiveOffset.ProtobufOutput Required.JsonInput.TimestampWithPositiveOffset.ProtobufOutput
Required.JsonInput.Uint32FieldMaxFloatValue.JsonOutput Required.JsonInput.Uint32FieldMaxFloatValue.JsonOutput
Required.JsonInput.Uint32FieldMaxFloatValue.ProtobufOutput Required.JsonInput.Uint32FieldMaxFloatValue.ProtobufOutput
Required.JsonInput.Uint32MapField.JsonOutput
Required.JsonInput.Uint32MapField.ProtobufOutput
Required.JsonInput.Uint64FieldMaxValue.JsonOutput Required.JsonInput.Uint64FieldMaxValue.JsonOutput
Required.JsonInput.Uint64FieldMaxValue.ProtobufOutput Required.JsonInput.Uint64FieldMaxValue.ProtobufOutput
Required.JsonInput.Uint64MapField.JsonOutput
Required.JsonInput.Uint64MapField.ProtobufOutput
Required.JsonInput.ValueAcceptBool.JsonOutput Required.JsonInput.ValueAcceptBool.JsonOutput
Required.JsonInput.ValueAcceptBool.ProtobufOutput Required.JsonInput.ValueAcceptBool.ProtobufOutput
Required.JsonInput.ValueAcceptFloat.JsonOutput Required.JsonInput.ValueAcceptFloat.JsonOutput
......
...@@ -12,5 +12,5 @@ ...@@ -12,5 +12,5 @@
export DOCKERFILE_DIR=jenkins/docker32 export DOCKERFILE_DIR=jenkins/docker32
export DOCKER_RUN_SCRIPT=jenkins/pull_request_in_docker.sh export DOCKER_RUN_SCRIPT=jenkins/pull_request_in_docker.sh
export OUTPUT_DIR=testoutput export OUTPUT_DIR=testoutput
export TEST_SET="php_all_32" export TEST_SET="php_all"
./jenkins/build_and_run_docker.sh ./jenkins/build_and_run_docker.sh
...@@ -147,6 +147,23 @@ RUN cd php-5.5.38 && ./configure --enable-maintainer-zts --prefix=/usr/local/php ...@@ -147,6 +147,23 @@ RUN cd php-5.5.38 && ./configure --enable-maintainer-zts --prefix=/usr/local/php
make && make install && cd .. make && make install && cd ..
RUN cd php-5.5.38 && make clean && ./configure --prefix=/usr/local/php-5.5 && \ RUN cd php-5.5.38 && make clean && ./configure --prefix=/usr/local/php-5.5 && \
make && make install && cd .. make && make install && cd ..
RUN wget http://am1.php.net/get/php-5.6.30.tar.bz2/from/this/mirror
RUN mv mirror php-5.6.30.tar.bz2
RUN tar -xvf php-5.6.30.tar.bz2
RUN cd php-5.6.30 && ./configure --enable-maintainer-zts --prefix=/usr/local/php-5.6-zts && \
make && make install && cd ..
RUN cd php-5.6.30 && make clean && ./configure --prefix=/usr/local/php-5.6 && \
make && make install && cd ..
RUN wget http://am1.php.net/get/php-7.0.18.tar.bz2/from/this/mirror
RUN mv mirror php-7.0.18.tar.bz2
RUN tar -xvf php-7.0.18.tar.bz2
RUN cd php-7.0.18 && ./configure --enable-maintainer-zts --prefix=/usr/local/php-7.0-zts && \
make && make install && cd ..
RUN cd php-7.0.18 && make clean && ./configure --prefix=/usr/local/php-7.0 && \
make && make install && cd ..
RUN php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');" RUN php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
RUN php composer-setup.php RUN php composer-setup.php
RUN mv composer.phar /usr/bin/composer RUN mv composer.phar /usr/bin/composer
...@@ -157,21 +174,21 @@ RUN cd /tmp && \ ...@@ -157,21 +174,21 @@ RUN cd /tmp && \
rm -rf protobuf && \ rm -rf protobuf && \
git clone https://github.com/google/protobuf.git && \ git clone https://github.com/google/protobuf.git && \
cd protobuf && \ cd protobuf && \
git reset --hard 46ae90dc5e145b12fffa7e053a908a9f3e066286 && \ git reset --hard 6b27c1f981a9a93918e4039f236ead27165a8e91 && \
cd php && \ cd php && \
ln -sfn /usr/local/php-5.5/bin/php /usr/bin/php && \ ln -sfn /usr/local/php-5.5/bin/php /usr/bin/php && \
ln -sfn /usr/local/php-5.5/bin/php-config /usr/bin/php-config && \ ln -sfn /usr/local/php-5.5/bin/php-config /usr/bin/php-config && \
ln -sfn /usr/local/php-5.5/bin/phpize /usr/bin/phpize && \ ln -sfn /usr/local/php-5.5/bin/phpize /usr/bin/phpize && \
composer install && \ composer install && \
mv vendor /usr/local/vendor-5.5 && \ mv vendor /usr/local/vendor-5.5 && \
ln -sfn /usr/bin/php5.6 /usr/bin/php && \ ln -sfn /usr/local/php-5.6/bin/php /usr/bin/php && \
ln -sfn /usr/bin/php-config5.6 /usr/bin/php-config && \ ln -sfn /usr/local/php-5.6/bin/php-config /usr/bin/php-config && \
ln -sfn /usr/bin/phpize5.6 /usr/bin/phpize && \ ln -sfn /usr/local/php-5.6/bin/phpize /usr/bin/phpize && \
composer install && \ composer install && \
mv vendor /usr/local/vendor-5.6 && \ mv vendor /usr/local/vendor-5.6 && \
ln -sfn /usr/bin/php7.0 /usr/bin/php && \ ln -sfn /usr/local/php-7.0/bin/php /usr/bin/php && \
ln -sfn /usr/bin/php-config7.0 /usr/bin/php-config && \ ln -sfn /usr/local/php-7.0/bin/php-config /usr/bin/php-config && \
ln -sfn /usr/bin/phpize7.0 /usr/bin/phpize && \ ln -sfn /usr/local/php-7.0/bin/phpize /usr/bin/phpize && \
composer install && \ composer install && \
mv vendor /usr/local/vendor-7.0 mv vendor /usr/local/vendor-7.0
......
...@@ -80,14 +80,31 @@ RUN cd /tmp && \ ...@@ -80,14 +80,31 @@ RUN cd /tmp && \
ln -sfn /usr/bin/phpize7.0 /usr/bin/phpize && \ ln -sfn /usr/bin/phpize7.0 /usr/bin/phpize && \
composer install && \ composer install && \
mv vendor /usr/local/vendor-7.0 mv vendor /usr/local/vendor-7.0
RUN wget http://am1.php.net/get/php-5.5.38.tar.bz2/from/this/mirror RUN wget http://am1.php.net/get/php-5.5.38.tar.bz2/from/this/mirror
RUN mv mirror php-5.5.38.tar.bz2 RUN mv mirror php-5.5.38.tar.bz2
RUN tar -xvf php-5.5.38.tar.bz2 RUN tar -xvf php-5.5.38.tar.bz2
RUN cd php-5.5.38 && ./configure --enable-maintainer-zts --prefix=/usr/local/php-5.5-zts && \ RUN cd php-5.5.38 && ./configure --enable-maintainer-zts --prefix=/usr/local/php-5.5-zts && \
make && make install && make clean && cd .. make && make install && make clean && cd ..
RUN cd php-5.5.38 && ./configure --enable-bcmath --prefix=/usr/local/php-5.5-bc && \ RUN cd php-5.5.38 && make clean && ./configure --enable-bcmath --prefix=/usr/local/php-5.5 && \
make && make install && make clean && cd .. make && make install && make clean && cd ..
RUN wget http://am1.php.net/get/php-5.6.30.tar.bz2/from/this/mirror
RUN mv mirror php-5.6.30.tar.bz2
RUN tar -xvf php-5.6.30.tar.bz2
RUN cd php-5.6.30 && ./configure --enable-maintainer-zts --prefix=/usr/local/php-5.6-zts && \
make && make install && cd ..
RUN cd php-5.6.30 && make clean && ./configure --enable-bcmath --prefix=/usr/local/php-5.6 && \
make && make install && cd ..
RUN wget http://am1.php.net/get/php-7.0.18.tar.bz2/from/this/mirror
RUN mv mirror php-7.0.18.tar.bz2
RUN tar -xvf php-7.0.18.tar.bz2
RUN cd php-7.0.18 && ./configure --enable-maintainer-zts --prefix=/usr/local/php-7.0-zts && \
make && make install && cd ..
RUN cd php-7.0.18 && make clean && ./configure --enable-bcmath --prefix=/usr/local/php-7.0 && \
make && make install && cd ..
################## ##################
# Python dependencies # Python dependencies
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
...@@ -55,39 +55,60 @@ static void add_to_table(HashTable* t, const void* def, void* value) { ...@@ -55,39 +55,60 @@ static void add_to_table(HashTable* t, const void* def, void* value) {
uint nIndex = (ulong)def & t->nTableMask; uint nIndex = (ulong)def & t->nTableMask;
zval* pDest = NULL; zval* pDest = NULL;
zend_hash_index_update(t, (zend_ulong)def, &value, sizeof(zval*), (void**)&pDest); php_proto_zend_hash_index_update(t, (zend_ulong)def, &value, sizeof(zval*),
(void**)&pDest);
} }
static void* get_from_table(const HashTable* t, const void* def) { static void* get_from_table(const HashTable* t, const void* def) {
void** value; void** value;
if (zend_hash_index_find(t, (zend_ulong)def, (void**)&value) == FAILURE) { if (php_proto_zend_hash_index_find(t, (zend_ulong)def, (void**)&value) ==
FAILURE) {
zend_error(E_ERROR, "PHP object not found for given definition.\n"); zend_error(E_ERROR, "PHP object not found for given definition.\n");
return NULL; return NULL;
} }
return *value; return *value;
} }
static bool exist_in_table(const HashTable* t, const void* def) {
void** value;
return (php_proto_zend_hash_index_find(t, (zend_ulong)def, (void**)&value) ==
SUCCESS);
}
static void add_to_list(HashTable* t, void* value) { static void add_to_list(HashTable* t, void* value) {
zval* pDest = NULL; zval* pDest = NULL;
zend_hash_next_index_insert(t, &value, sizeof(void*), (void**)&pDest); php_proto_zend_hash_next_index_insert(t, &value, sizeof(void*),
(void**)&pDest);
} }
void add_def_obj(const void* def, zval* value) { void add_def_obj(const void* def, PHP_PROTO_HASHTABLE_VALUE value) {
#if PHP_MAJOR_VERSION < 7
Z_ADDREF_P(value); Z_ADDREF_P(value);
#else
++GC_REFCOUNT(value);
#endif
add_to_table(upb_def_to_php_obj_map, def, value); add_to_table(upb_def_to_php_obj_map, def, value);
} }
zval* get_def_obj(const void* def) { PHP_PROTO_HASHTABLE_VALUE get_def_obj(const void* def) {
return (zval*)get_from_table(upb_def_to_php_obj_map, def); return (PHP_PROTO_HASHTABLE_VALUE)get_from_table(upb_def_to_php_obj_map, def);
} }
void add_ce_obj(const void* ce, zval* value) { void add_ce_obj(const void* ce, PHP_PROTO_HASHTABLE_VALUE value) {
#if PHP_MAJOR_VERSION < 7
Z_ADDREF_P(value); Z_ADDREF_P(value);
#else
++GC_REFCOUNT(value);
#endif
add_to_table(ce_to_php_obj_map, ce, value); add_to_table(ce_to_php_obj_map, ce, value);
} }
zval* get_ce_obj(const void* ce) { PHP_PROTO_HASHTABLE_VALUE get_ce_obj(const void* ce) {
return (zval*)get_from_table(ce_to_php_obj_map, ce); return (PHP_PROTO_HASHTABLE_VALUE)get_from_table(ce_to_php_obj_map, ce);
}
bool class_added(const void* ce) {
return exist_in_table(ce_to_php_obj_map, ce);
} }
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
...@@ -125,12 +146,23 @@ static PHP_GINIT_FUNCTION(protobuf) { ...@@ -125,12 +146,23 @@ static PHP_GINIT_FUNCTION(protobuf) {
static PHP_GSHUTDOWN_FUNCTION(protobuf) { static PHP_GSHUTDOWN_FUNCTION(protobuf) {
} }
#if PHP_MAJOR_VERSION >= 7
static void php_proto_hashtable_descriptor_release(zval* value) {
void* ptr = Z_PTR_P(value);
zend_object* object = *(zend_object**)ptr;
if(--GC_REFCOUNT(object) == 0) {
zend_objects_store_del(object);
}
efree(ptr);
}
#endif
static PHP_RINIT_FUNCTION(protobuf) { static PHP_RINIT_FUNCTION(protobuf) {
ALLOC_HASHTABLE(upb_def_to_php_obj_map); ALLOC_HASHTABLE(upb_def_to_php_obj_map);
zend_hash_init(upb_def_to_php_obj_map, 16, NULL, ZVAL_PTR_DTOR, 0); zend_hash_init(upb_def_to_php_obj_map, 16, NULL, HASHTABLE_VALUE_DTOR, 0);
ALLOC_HASHTABLE(ce_to_php_obj_map); ALLOC_HASHTABLE(ce_to_php_obj_map);
zend_hash_init(ce_to_php_obj_map, 16, NULL, ZVAL_PTR_DTOR, 0); zend_hash_init(ce_to_php_obj_map, 16, NULL, HASHTABLE_VALUE_DTOR, 0);
generated_pool = NULL; generated_pool = NULL;
generated_pool_php = NULL; generated_pool_php = NULL;
...@@ -145,10 +177,12 @@ static PHP_RSHUTDOWN_FUNCTION(protobuf) { ...@@ -145,10 +177,12 @@ static PHP_RSHUTDOWN_FUNCTION(protobuf) {
zend_hash_destroy(ce_to_php_obj_map); zend_hash_destroy(ce_to_php_obj_map);
FREE_HASHTABLE(ce_to_php_obj_map); FREE_HASHTABLE(ce_to_php_obj_map);
#if PHP_MAJOR_VERSION < 7
if (generated_pool_php != NULL) { if (generated_pool_php != NULL) {
zval_dtor(generated_pool_php); zval_dtor(generated_pool_php);
FREE_ZVAL(generated_pool_php); FREE_ZVAL(generated_pool_php);
} }
#endif
return 0; return 0;
} }
...@@ -170,6 +204,7 @@ static PHP_MINIT_FUNCTION(protobuf) { ...@@ -170,6 +204,7 @@ static PHP_MINIT_FUNCTION(protobuf) {
static PHP_MSHUTDOWN_FUNCTION(protobuf) { static PHP_MSHUTDOWN_FUNCTION(protobuf) {
PEFREE(message_handlers); PEFREE(message_handlers);
PEFREE(repeated_field_handlers); PEFREE(repeated_field_handlers);
PEFREE(repeated_field_iter_handlers);
PEFREE(map_field_handlers); PEFREE(map_field_handlers);
return 0; return 0;
......
This diff is collapsed.
This diff is collapsed.
...@@ -325,9 +325,18 @@ CONVERT_TO_FLOAT(double); ...@@ -325,9 +325,18 @@ CONVERT_TO_FLOAT(double);
bool protobuf_convert_to_bool(zval* from, int8_t* to) { bool protobuf_convert_to_bool(zval* from, int8_t* to) {
switch (Z_TYPE_P(from)) { switch (Z_TYPE_P(from)) {
#if PHP_MAJOR_VERSION < 7
case IS_BOOL: case IS_BOOL:
*to = (int8_t)Z_BVAL_P(from); *to = (int8_t)Z_BVAL_P(from);
break; break;
#else
case IS_TRUE:
*to = 1;
break;
case IS_FALSE:
*to = 0;
break;
#endif
case IS_LONG: case IS_LONG:
*to = (int8_t)(Z_LVAL_P(from) != 0); *to = (int8_t)(Z_LVAL_P(from) != 0);
break; break;
...@@ -357,12 +366,16 @@ bool protobuf_convert_to_string(zval* from) { ...@@ -357,12 +366,16 @@ bool protobuf_convert_to_string(zval* from) {
case IS_STRING: { case IS_STRING: {
return true; return true;
} }
#if PHP_MAJOR_VERSION < 7
case IS_BOOL: case IS_BOOL:
#else
case IS_TRUE:
case IS_FALSE:
#endif
case IS_LONG: case IS_LONG:
case IS_DOUBLE: { case IS_DOUBLE: {
int use_copy;
zval tmp; zval tmp;
zend_make_printable_zval(from, &tmp, &use_copy); php_proto_zend_make_printable_zval(from, &tmp);
ZVAL_COPY_VALUE(from, &tmp); ZVAL_COPY_VALUE(from, &tmp);
return true; return true;
} }
...@@ -417,34 +430,45 @@ PHP_METHOD(Util, checkMessage) { ...@@ -417,34 +430,45 @@ PHP_METHOD(Util, checkMessage) {
PHP_METHOD(Util, checkRepeatedField) { PHP_METHOD(Util, checkRepeatedField) {
zval* val; zval* val;
long type; PHP_PROTO_LONG type;
const zend_class_entry* klass = NULL; const zend_class_entry* klass = NULL;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "zl|C", &val, &type, if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "zl|C", &val, &type,
&klass) == FAILURE) { &klass) == FAILURE) {
return; return;
} }
#if PHP_MAJOR_VERSION >= 7
if (Z_ISREF_P(val)) {
ZVAL_DEREF(val);
}
#endif
if (Z_TYPE_P(val) == IS_ARRAY) { if (Z_TYPE_P(val) == IS_ARRAY) {
HashTable* table = Z_ARRVAL_P(val); HashTable* table = HASH_OF(val);
HashPosition pointer; HashPosition pointer;
void* memory; void* memory;
#if PHP_MAJOR_VERSION < 7
zval* repeated_field; zval* repeated_field;
MAKE_STD_ZVAL(repeated_field);
#else
zval repeated_field;
#endif
repeated_field_create_with_type(repeated_field_type, to_fieldtype(type), repeated_field_create_with_type(repeated_field_type, to_fieldtype(type),
klass, &repeated_field TSRMLS_CC); klass, &repeated_field TSRMLS_CC);
RepeatedField* intern =
(RepeatedField*)zend_object_store_get_object(repeated_field TSRMLS_CC);
for (zend_hash_internal_pointer_reset_ex(table, &pointer); for (zend_hash_internal_pointer_reset_ex(table, &pointer);
zend_hash_get_current_data_ex(table, (void**)&memory, &pointer) == php_proto_zend_hash_get_current_data_ex(table, (void**)&memory,
SUCCESS; &pointer) == SUCCESS;
zend_hash_move_forward_ex(table, &pointer)) { zend_hash_move_forward_ex(table, &pointer)) {
repeated_field_handlers->write_dimension(repeated_field, NULL, repeated_field_handlers->write_dimension(
*(zval**)memory TSRMLS_CC); CACHED_TO_ZVAL_PTR(repeated_field), NULL,
CACHED_PTR_TO_ZVAL_PTR((CACHED_VALUE*)memory) TSRMLS_CC);
} }
Z_DELREF_P(repeated_field); Z_DELREF_P(CACHED_TO_ZVAL_PTR(repeated_field));
RETURN_ZVAL(repeated_field, 1, 0); RETURN_ZVAL(CACHED_TO_ZVAL_PTR(repeated_field), 1, 0);
} else if (Z_TYPE_P(val) == IS_OBJECT) { } else if (Z_TYPE_P(val) == IS_OBJECT) {
if (!instanceof_function(Z_OBJCE_P(val), repeated_field_type TSRMLS_CC)) { if (!instanceof_function(Z_OBJCE_P(val), repeated_field_type TSRMLS_CC)) {
...@@ -452,8 +476,7 @@ PHP_METHOD(Util, checkRepeatedField) { ...@@ -452,8 +476,7 @@ PHP_METHOD(Util, checkRepeatedField) {
repeated_field_type->name); repeated_field_type->name);
return; return;
} }
RepeatedField* intern = RepeatedField* intern = UNBOX(RepeatedField, val);
(RepeatedField*)zend_object_store_get_object(val TSRMLS_CC);
if (to_fieldtype(type) != intern->type) { if (to_fieldtype(type) != intern->type) {
zend_error(E_USER_ERROR, "Incorrect repeated field type."); zend_error(E_USER_ERROR, "Incorrect repeated field type.");
return; return;
...@@ -474,43 +497,55 @@ PHP_METHOD(Util, checkRepeatedField) { ...@@ -474,43 +497,55 @@ PHP_METHOD(Util, checkRepeatedField) {
PHP_METHOD(Util, checkMapField) { PHP_METHOD(Util, checkMapField) {
zval* val; zval* val;
long key_type, value_type; PHP_PROTO_LONG key_type, value_type;
const zend_class_entry* klass = NULL; const zend_class_entry* klass = NULL;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "zll|C", &val, &key_type, if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "zll|C", &val, &key_type,
&value_type, &klass) == FAILURE) { &value_type, &klass) == FAILURE) {
return; return;
} }
#if PHP_MAJOR_VERSION >= 7
if (Z_ISREF_P(val)) {
ZVAL_DEREF(val);
}
#endif
if (Z_TYPE_P(val) == IS_ARRAY) { if (Z_TYPE_P(val) == IS_ARRAY) {
HashTable* table = Z_ARRVAL_P(val); HashTable* table = Z_ARRVAL_P(val);
HashPosition pointer; HashPosition pointer;
zval key, *map_field; zval key;
void* value; void* value;
#if PHP_MAJOR_VERSION < 7
zval* map_field;
MAKE_STD_ZVAL(map_field);
#else
zval map_field;
#endif
map_field_create_with_type(map_field_type, to_fieldtype(key_type), map_field_create_with_type(map_field_type, to_fieldtype(key_type),
to_fieldtype(value_type), klass, to_fieldtype(value_type), klass,
&map_field TSRMLS_CC); &map_field TSRMLS_CC);
Map* intern =
(Map*)zend_object_store_get_object(map_field TSRMLS_CC);
for (zend_hash_internal_pointer_reset_ex(table, &pointer); for (zend_hash_internal_pointer_reset_ex(table, &pointer);
zend_hash_get_current_data_ex(table, (void**)&value, &pointer) == php_proto_zend_hash_get_current_data_ex(table, (void**)&value,
SUCCESS; &pointer) == SUCCESS;
zend_hash_move_forward_ex(table, &pointer)) { zend_hash_move_forward_ex(table, &pointer)) {
zend_hash_get_current_key_zval_ex(table, &key, &pointer); zend_hash_get_current_key_zval_ex(table, &key, &pointer);
map_field_handlers->write_dimension(map_field, &key, map_field_handlers->write_dimension(
*(zval**)value TSRMLS_CC); CACHED_TO_ZVAL_PTR(map_field), &key,
CACHED_PTR_TO_ZVAL_PTR((CACHED_VALUE*)value) TSRMLS_CC);
} }
Z_DELREF_P(map_field); Z_DELREF_P(CACHED_TO_ZVAL_PTR(map_field));
RETURN_ZVAL(map_field, 1, 0); RETURN_ZVAL(CACHED_TO_ZVAL_PTR(map_field), 1, 0);
} else if (Z_TYPE_P(val) == IS_OBJECT) { } else if (Z_TYPE_P(val) == IS_OBJECT) {
if (!instanceof_function(Z_OBJCE_P(val), map_field_type TSRMLS_CC)) { if (!instanceof_function(Z_OBJCE_P(val), map_field_type TSRMLS_CC)) {
zend_error(E_USER_ERROR, "Given value is not an instance of %s.", zend_error(E_USER_ERROR, "Given value is not an instance of %s.",
map_field_type->name); map_field_type->name);
return; return;
} }
Map* intern = (Map*)zend_object_store_get_object(val TSRMLS_CC); Map* intern = UNBOX(Map, val);
if (to_fieldtype(key_type) != intern->key_type) { if (to_fieldtype(key_type) != intern->key_type) {
zend_error(E_USER_ERROR, "Incorrect map field key type."); zend_error(E_USER_ERROR, "Incorrect map field key type.");
return; return;
......
...@@ -284,6 +284,9 @@ class MapField implements \ArrayAccess, \IteratorAggregate, \Countable ...@@ -284,6 +284,9 @@ class MapField implements \ArrayAccess, \IteratorAggregate, \Countable
GPBUtil::checkString($value, true); GPBUtil::checkString($value, true);
break; break;
case GPBType::MESSAGE: case GPBType::MESSAGE:
if (is_null($value)) {
trigger_error("Map element cannot be null.", E_USER_ERROR);
}
GPBUtil::checkMessage($value, $this->klass); GPBUtil::checkMessage($value, $this->klass);
break; break;
default: default:
......
...@@ -225,6 +225,10 @@ class RepeatedField implements \ArrayAccess, \IteratorAggregate, \Countable ...@@ -225,6 +225,10 @@ class RepeatedField implements \ArrayAccess, \IteratorAggregate, \Countable
GPBUtil::checkString($value, true); GPBUtil::checkString($value, true);
break; break;
case GPBType::MESSAGE: case GPBType::MESSAGE:
if (is_null($value)) {
trigger_error("RepeatedField element cannot be null.",
E_USER_ERROR);
}
GPBUtil::checkMessage($value, $this->klass); GPBUtil::checkMessage($value, $this->klass);
break; break;
default: default:
......
...@@ -751,23 +751,13 @@ class RepeatedFieldTest extends PHPUnit_Framework_TestCase ...@@ -751,23 +751,13 @@ class RepeatedFieldTest extends PHPUnit_Framework_TestCase
$arr []= $sub_m; $arr []= $sub_m;
$this->assertSame(1, $arr[0]->getA()); $this->assertSame(1, $arr[0]->getA());
$null = null; $this->assertEquals(1, count($arr));
$arr []= $null;
$this->assertNull($arr[1]);
$this->assertEquals(2, count($arr));
for ($i = 0; $i < count($arr); $i++) {
$arr[$i] = $null;
$this->assertNull($arr[$i]);
}
// Test set. // Test set.
$sub_m = new TestMessage_Sub();
$sub_m->setA(2);
$arr [0]= $sub_m; $arr [0]= $sub_m;
$this->assertSame(1, $arr[0]->getA()); $this->assertSame(2, $arr[0]->getA());
$arr [1]= $null;
$this->assertNull($arr[1]);
} }
/** /**
...@@ -817,6 +807,27 @@ class RepeatedFieldTest extends PHPUnit_Framework_TestCase ...@@ -817,6 +807,27 @@ class RepeatedFieldTest extends PHPUnit_Framework_TestCase
$arr []= new TestMessage; $arr []= new TestMessage;
} }
/**
* @expectedException PHPUnit_Framework_Error
*/
public function testMessageAppendNullFail()
{
$arr = new RepeatedField(GPBType::MESSAGE, TestMessage_Sub::class);
$null = null;
$arr []= $null;
}
/**
* @expectedException PHPUnit_Framework_Error
*/
public function testMessageSetNullFail()
{
$arr = new RepeatedField(GPBType::MESSAGE, TestMessage_Sub::class);
$arr []= new TestMessage_Sub();
$null = null;
$arr[0] = $null;
}
######################################################### #########################################################
# Test offset type # Test offset type
######################################################### #########################################################
......
...@@ -3,10 +3,8 @@ ...@@ -3,10 +3,8 @@
# gdb --args php -dextension=../ext/google/protobuf/modules/protobuf.so `which # gdb --args php -dextension=../ext/google/protobuf/modules/protobuf.so `which
# phpunit` --bootstrap autoload.php tmp_test.php # phpunit` --bootstrap autoload.php tmp_test.php
# #
gdb --args php -dextension=../ext/google/protobuf/modules/protobuf.so `which phpunit` --bootstrap autoload.php array_test.php gdb --args php -dextension=../ext/google/protobuf/modules/protobuf.so `which phpunit` --bootstrap autoload.php encode_decode_test.php
# #
# # gdb --args php -dextension=../ext/google/protobuf/modules/protobuf.so # gdb --args php -dextension=../ext/google/protobuf/modules/protobuf.so memory_leak_test.php
# memory_leak_test.php
# #
# # USE_ZEND_ALLOC=0 valgrind --leak-check=yes php # USE_ZEND_ALLOC=0 valgrind --leak-check=yes php -dextension=../ext/google/protobuf/modules/protobuf.so memory_leak_test.php
# -dextension=../ext/google/protobuf/modules/protobuf.so memory_leak_test.php
...@@ -616,11 +616,7 @@ class MapFieldTest extends PHPUnit_Framework_TestCase { ...@@ -616,11 +616,7 @@ class MapFieldTest extends PHPUnit_Framework_TestCase {
$arr[0] = $sub_m; $arr[0] = $sub_m;
$this->assertSame(1, $arr[0]->getA()); $this->assertSame(1, $arr[0]->getA());
$null = NULL; $this->assertEquals(1, count($arr));
$arr[1] = $null;
$this->assertNull($arr[1]);
$this->assertEquals(2, count($arr));
} }
/** /**
...@@ -653,6 +649,17 @@ class MapFieldTest extends PHPUnit_Framework_TestCase { ...@@ -653,6 +649,17 @@ class MapFieldTest extends PHPUnit_Framework_TestCase {
$arr[0] = new TestMessage_Sub(); $arr[0] = new TestMessage_Sub();
} }
/**
* @expectedException PHPUnit_Framework_Error
*/
public function testMessageSetNullFail()
{
$arr =
new MapField(GPBType::INT32, GPBType::MESSAGE, TestMessage::class);
$null = NULL;
$arr[0] = $null;
}
######################################################### #########################################################
# Test memory leak # Test memory leak
######################################################### #########################################################
......
...@@ -83,7 +83,8 @@ $n = new TestMessage(); ...@@ -83,7 +83,8 @@ $n = new TestMessage();
$n->mergeFromString($data); $n->mergeFromString($data);
assert(1 === $n->getOneofMessage()->getA()); assert(1 === $n->getOneofMessage()->getA());
$from = new TestMessage(); # $from = new TestMessage();
$to = new TestMessage(); # $to = new TestMessage();
TestUtil::setTestMessage($from); # TestUtil::setTestMessage($from);
$to->mergeFrom($from); # $to->mergeFrom($from);
# TestUtil::assertTestMessage($to);
...@@ -51,8 +51,6 @@ class TestUtil ...@@ -51,8 +51,6 @@ class TestUtil
public static function setTestMessage(TestMessage $m) public static function setTestMessage(TestMessage $m)
{ {
$sub = new TestMessage_Sub();
$m->setOptionalInt32(-42); $m->setOptionalInt32(-42);
$m->setOptionalInt64(-43); $m->setOptionalInt64(-43);
$m->setOptionalUint32(42); $m->setOptionalUint32(42);
...@@ -69,6 +67,7 @@ class TestUtil ...@@ -69,6 +67,7 @@ class TestUtil
$m->setOptionalString('a'); $m->setOptionalString('a');
$m->setOptionalBytes('b'); $m->setOptionalBytes('b');
$m->setOptionalEnum(TestEnum::ONE); $m->setOptionalEnum(TestEnum::ONE);
$sub = new TestMessage_Sub();
$m->setOptionalMessage($sub); $m->setOptionalMessage($sub);
$m->getOptionalMessage()->SetA(33); $m->getOptionalMessage()->SetA(33);
......
...@@ -371,12 +371,9 @@ use_php() { ...@@ -371,12 +371,9 @@ use_php() {
PHP=`which php` PHP=`which php`
PHP_CONFIG=`which php-config` PHP_CONFIG=`which php-config`
PHPIZE=`which phpize` PHPIZE=`which phpize`
rm $PHP ln -sfn "/usr/local/php-${VERSION}/bin/php" $PHP
rm $PHP_CONFIG ln -sfn "/usr/local/php-${VERSION}/bin/php-config" $PHP_CONFIG
rm $PHPIZE ln -sfn "/usr/local/php-${VERSION}/bin/phpize" $PHPIZE
cp "/usr/bin/php$VERSION" $PHP
cp "/usr/bin/php-config$VERSION" $PHP_CONFIG
cp "/usr/bin/phpize$VERSION" $PHPIZE
generate_php_test_proto generate_php_test_proto
} }
...@@ -403,18 +400,13 @@ use_php_bc() { ...@@ -403,18 +400,13 @@ use_php_bc() {
} }
build_php5.5() { build_php5.5() {
PHP=`which php` use_php 5.5
PHP_CONFIG=`which php-config`
PHPIZE=`which phpize`
ln -sfn "/usr/local/php-5.5/bin/php" $PHP
ln -sfn "/usr/local/php-5.5/bin/php-config" $PHP_CONFIG
ln -sfn "/usr/local/php-5.5/bin/phpize" $PHPIZE
generate_php_test_proto
pushd php pushd php
rm -rf vendor rm -rf vendor
cp -r /usr/local/vendor-5.5 vendor cp -r /usr/local/vendor-5.5 vendor
./vendor/bin/phpunit wget https://phar.phpunit.de/phpunit-4.8.0.phar -O /usr/bin/phpunit
phpunit
popd popd
pushd conformance pushd conformance
# TODO(teboring): Add it back # TODO(teboring): Add it back
...@@ -423,51 +415,21 @@ build_php5.5() { ...@@ -423,51 +415,21 @@ build_php5.5() {
} }
build_php5.5_c() { build_php5.5_c() {
PHP=`which php` use_php 5.5
PHP_CONFIG=`which php-config` wget https://phar.phpunit.de/phpunit-4.8.0.phar -O /usr/bin/phpunit
PHPIZE=`which phpize`
ln -sfn "/usr/local/php-5.5/bin/php" $PHP
ln -sfn "/usr/local/php-5.5/bin/php-config" $PHP_CONFIG
ln -sfn "/usr/local/php-5.5/bin/phpize" $PHPIZE
generate_php_test_proto
wget https://phar.phpunit.de/phpunit-old.phar -O /usr/bin/phpunit
cd php/tests && /bin/bash ./test.sh && cd ../.. cd php/tests && /bin/bash ./test.sh && cd ../..
pushd conformance pushd conformance
make test_php_c # make test_php_c
popd popd
} }
build_php5.5_zts_c() { build_php5.5_zts_c() {
use_php_zts 5.5 use_php_zts 5.5
wget https://phar.phpunit.de/phpunit-old.phar -O /usr/bin/phpunit wget https://phar.phpunit.de/phpunit-4.8.0.phar -O /usr/bin/phpunit
cd php/tests && /bin/bash ./test.sh && cd ../.. cd php/tests && /bin/bash ./test.sh && cd ../..
pushd conformance pushd conformance
make test_php_c
popd
}
build_php5.5_32() {
use_php_bc 5.5
pushd php
rm -rf vendor
cp -r /usr/local/vendor-5.5 vendor
./vendor/bin/phpunit
popd
# TODO(teboring): Add conformance test.
# pushd conformance
# make test_php
# popd
}
build_php5.5_c_32() {
use_php_bc 5.5
wget https://phar.phpunit.de/phpunit-old.phar -O /usr/bin/phpunit
cd php/tests && /bin/bash ./test.sh && cd ../..
# TODO(teboring): Add conformance test.
# pushd conformance
# make test_php_c # make test_php_c
# popd popd
} }
build_php5.6() { build_php5.6() {
...@@ -475,7 +437,8 @@ build_php5.6() { ...@@ -475,7 +437,8 @@ build_php5.6() {
pushd php pushd php
rm -rf vendor rm -rf vendor
cp -r /usr/local/vendor-5.6 vendor cp -r /usr/local/vendor-5.6 vendor
./vendor/bin/phpunit wget https://phar.phpunit.de/phpunit-5.7.0.phar -O /usr/bin/phpunit
phpunit
popd popd
pushd conformance pushd conformance
# TODO(teboring): Add it back # TODO(teboring): Add it back
...@@ -485,9 +448,19 @@ build_php5.6() { ...@@ -485,9 +448,19 @@ build_php5.6() {
build_php5.6_c() { build_php5.6_c() {
use_php 5.6 use_php 5.6
wget https://phar.phpunit.de/phpunit-5.7.0.phar -O /usr/bin/phpunit
cd php/tests && /bin/bash ./test.sh && cd ../.. cd php/tests && /bin/bash ./test.sh && cd ../..
pushd conformance pushd conformance
make test_php_c # make test_php_c
popd
}
build_php5.6_zts_c() {
use_php_zts 5.6
wget https://phar.phpunit.de/phpunit-5.7.0.phar -O /usr/bin/phpunit
cd php/tests && /bin/bash ./test.sh && cd ../..
pushd conformance
# make test_php_c
popd popd
} }
...@@ -511,7 +484,7 @@ build_php5.6_mac() { ...@@ -511,7 +484,7 @@ build_php5.6_mac() {
# Test # Test
cd php/tests && /bin/bash ./test.sh && cd ../.. cd php/tests && /bin/bash ./test.sh && cd ../..
pushd conformance pushd conformance
make test_php_c # make test_php_c
popd popd
} }
...@@ -520,7 +493,8 @@ build_php7.0() { ...@@ -520,7 +493,8 @@ build_php7.0() {
pushd php pushd php
rm -rf vendor rm -rf vendor
cp -r /usr/local/vendor-7.0 vendor cp -r /usr/local/vendor-7.0 vendor
./vendor/bin/phpunit wget https://phar.phpunit.de/phpunit-5.6.0.phar -O /usr/bin/phpunit
phpunit
popd popd
pushd conformance pushd conformance
# TODO(teboring): Add it back # TODO(teboring): Add it back
...@@ -530,9 +504,43 @@ build_php7.0() { ...@@ -530,9 +504,43 @@ build_php7.0() {
build_php7.0_c() { build_php7.0_c() {
use_php 7.0 use_php 7.0
wget https://phar.phpunit.de/phpunit-5.6.0.phar -O /usr/bin/phpunit
cd php/tests && /bin/bash ./test.sh && cd ../.. cd php/tests && /bin/bash ./test.sh && cd ../..
pushd conformance pushd conformance
make test_php_c # make test_php_c
popd
}
build_php7.0_zts_c() {
use_php_zts 7.0
wget https://phar.phpunit.de/phpunit-5.6.0.phar -O /usr/bin/phpunit
cd php/tests && /bin/bash ./test.sh && cd ../..
pushd conformance
# make test_php_c
popd
}
build_php7.0_mac() {
generate_php_test_proto
# Install PHP
curl -s https://php-osx.liip.ch/install.sh | bash -s 7.0
PHP_FOLDER=`find /usr/local -type d -name "php7-7.0*"` # The folder name may change upon time
export PATH="$PHP_FOLDER/bin:$PATH"
# Install phpunit
curl https://phar.phpunit.de/phpunit-5.6.0.phar -L -o phpunit.phar
chmod +x phpunit.phar
sudo mv phpunit.phar /usr/local/bin/phpunit
# Install valgrind
echo "#! /bin/bash" > valgrind
chmod ug+x valgrind
sudo mv valgrind /usr/local/bin/valgrind
# Test
cd php/tests && /bin/bash ./test.sh && cd ../..
pushd conformance
# make test_php_c
popd popd
} }
...@@ -542,13 +550,10 @@ build_php_all() { ...@@ -542,13 +550,10 @@ build_php_all() {
build_php7.0 build_php7.0
build_php5.5_c build_php5.5_c
build_php5.6_c build_php5.6_c
# build_php7.0_c build_php7.0_c
build_php5.5_zts_c build_php5.5_zts_c
} build_php5.6_zts_c
build_php7.0_zts_c
build_php_all_32() {
build_php5.5_32
build_php5.5_c_32
} }
# Note: travis currently does not support testing more than one language so the # Note: travis currently does not support testing more than one language so the
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment