From fffe8d39f810d147c6db65f90ae4f71f4e0f0116 Mon Sep 17 00:00:00 2001 From: Bo Yang Date: Tue, 12 Dec 2017 17:47:04 -0800 Subject: Call php method via function name instead of calling directly. This changes the linking error if php extension is not statically linked to a runtime error. In this way, users who don't need Timestamp can still use protobuf even if date extension is not statically linked in php. --- php/tests/memory_leak_test.php | 8 ++++---- php/tests/test.sh | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) (limited to 'php/tests') diff --git a/php/tests/memory_leak_test.php b/php/tests/memory_leak_test.php index ce268838..507635e7 100644 --- a/php/tests/memory_leak_test.php +++ b/php/tests/memory_leak_test.php @@ -131,12 +131,12 @@ $timestamp = new \Google\Protobuf\Timestamp(); date_default_timezone_set('UTC'); $from = new DateTime('2011-01-01T15:03:01.012345UTC'); $timestamp->fromDateTime($from); -assert($from->format('U'), $timestamp->getSeconds()); -assert(0, $timestamp->getNanos()); +assert($from->format('U') == $timestamp->getSeconds()); +assert(0 == $timestamp->getNanos()); $to = $timestamp->toDateTime(); -assert(\DateTime::class, get_class($to)); -assert($from->format('U'), $to->format('U')); +assert(\DateTime::class == get_class($to)); +assert($from->format('U') == $to->format('U')); $from = new \Google\Protobuf\Value(); $from->setNumberValue(1); diff --git a/php/tests/test.sh b/php/tests/test.sh index a308a1d2..c35372d3 100755 --- a/php/tests/test.sh +++ b/php/tests/test.sh @@ -5,7 +5,7 @@ pushd ../ext/google/protobuf/ make clean || true set -e # Add following in configure for debug: --enable-debug CFLAGS='-g -O0' -phpize && ./configure CFLAGS='-g -O0 -DPROTOBUF_ENABLE_TIMESTAMP' && make +phpize && ./configure CFLAGS='-g -O0' && make popd tests=( array_test.php encode_decode_test.php generated_class_test.php generated_phpdoc_test.php map_field_test.php well_known_test.php generated_service_test.php descriptors_test.php ) -- cgit v1.2.3