aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBo Yang <teboring@google.com>2018-07-13 03:44:49 +0000
committerBo Yang <teboring@google.com>2018-07-13 05:47:10 +0000
commit51c188c2ccb0f9dac475a50c77c4f57ab96fbc4a (patch)
tree4001fb62bec322891c9e591848f8f5d1e47d81a6
parentf21d4d6830a935da99c9aa107827c1d827768121 (diff)
downloadprotobuf-51c188c2ccb0f9dac475a50c77c4f57ab96fbc4a.tar.gz
protobuf-51c188c2ccb0f9dac475a50c77c4f57ab96fbc4a.tar.bz2
protobuf-51c188c2ccb0f9dac475a50c77c4f57ab96fbc4a.zip
Fix php tests
-rw-r--r--php/ext/google/protobuf/message.c1
-rw-r--r--php/src/Google/Protobuf/Internal/GPBUtil.php7
-rwxr-xr-xphp/tests/compatibility_test.sh2
-rw-r--r--php/tests/test_util.php1
4 files changed, 6 insertions, 5 deletions
diff --git a/php/ext/google/protobuf/message.c b/php/ext/google/protobuf/message.c
index e28e42a1..9363191d 100644
--- a/php/ext/google/protobuf/message.c
+++ b/php/ext/google/protobuf/message.c
@@ -283,6 +283,7 @@ void build_class_from_descriptor(
// -----------------------------------------------------------------------------
void Message_construct(zval* msg, zval* array_wrapper) {
+ TSRMLS_FETCH();
zend_class_entry* ce = Z_OBJCE_P(msg);
MessageHeader* intern = NULL;
if (EXPECTED(class_added(ce))) {
diff --git a/php/src/Google/Protobuf/Internal/GPBUtil.php b/php/src/Google/Protobuf/Internal/GPBUtil.php
index b75d9bab..ec0bf6bd 100644
--- a/php/src/Google/Protobuf/Internal/GPBUtil.php
+++ b/php/src/Google/Protobuf/Internal/GPBUtil.php
@@ -305,11 +305,8 @@ class GPBUtil
$name,
$file_proto)
{
- $parts = explode('.', $name);
- foreach ($parts as $i => $part) {
- $parts[$i] = static::getClassNamePrefix($parts[$i], $file_proto) . $parts[$i];
- }
- return implode('\\', $parts);
+ $classname = implode('_', explode('.', $name));
+ return static::getClassNamePrefix($classname, $file_proto) . $classname;
}
public static function getClassNameWithoutPackage(
diff --git a/php/tests/compatibility_test.sh b/php/tests/compatibility_test.sh
index b5b255ea..b377d85c 100755
--- a/php/tests/compatibility_test.sh
+++ b/php/tests/compatibility_test.sh
@@ -122,6 +122,8 @@ composer install
tests=( array_test.php encode_decode_test.php generated_class_test.php map_field_test.php well_known_test.php )
sed -i.bak '/php_implementation_test.php/d' phpunit.xml
sed -i.bak '/generated_phpdoc_test.php/d' phpunit.xml
+sed -i.bak 's/generated_phpdoc_test.php//g' tests/test.sh
+sed -i.bak '/memory_leak_test.php/d' tests/test.sh
for t in "${tests[@]}"
do
remove_error_test tests/$t
diff --git a/php/tests/test_util.php b/php/tests/test_util.php
index a676d097..e23ace74 100644
--- a/php/tests/test_util.php
+++ b/php/tests/test_util.php
@@ -241,6 +241,7 @@ class TestUtil
if (PHP_INT_SIZE == 4) {
assert('-43' === $m->getRepeatedInt64()[0]);
assert('43' === $m->getRepeatedUint64()[0]);
+ var_dump($m->getRepeatedSint64()[0]);
assert('-45' === $m->getRepeatedSint64()[0]);
assert('47' === $m->getRepeatedFixed64()[0]);
assert('-47' === $m->getRepeatedSfixed64()[0]);