Skip to content

PHP Extension - Missing Google\Protobuf\Value:has* Methods #20036

@FabioBatSilva

Description

@FabioBatSilva

The PHP C extension implementation is missing has* methods for the Google\Protobuf\Value class that are present in the native PHP implementation.

This creates inconsistency between the two:

PHP Implementation :

C Implementation

static zend_function_entry google_protobuf_Value_phpmethods[] = {
PHP_ME(google_protobuf_Value, __construct, arginfo_construct, ZEND_ACC_PUBLIC)
PHP_ME(google_protobuf_Value, getNullValue, arginfo_void, ZEND_ACC_PUBLIC)
PHP_ME(google_protobuf_Value, setNullValue, arginfo_setter, ZEND_ACC_PUBLIC)
PHP_ME(google_protobuf_Value, getNumberValue, arginfo_void, ZEND_ACC_PUBLIC)
PHP_ME(google_protobuf_Value, setNumberValue, arginfo_setter, ZEND_ACC_PUBLIC)
PHP_ME(google_protobuf_Value, getStringValue, arginfo_void, ZEND_ACC_PUBLIC)
PHP_ME(google_protobuf_Value, setStringValue, arginfo_setter, ZEND_ACC_PUBLIC)
PHP_ME(google_protobuf_Value, getBoolValue, arginfo_void, ZEND_ACC_PUBLIC)
PHP_ME(google_protobuf_Value, setBoolValue, arginfo_setter, ZEND_ACC_PUBLIC)
PHP_ME(google_protobuf_Value, getStructValue, arginfo_void, ZEND_ACC_PUBLIC)
PHP_ME(google_protobuf_Value, setStructValue, arginfo_setter, ZEND_ACC_PUBLIC)
PHP_ME(google_protobuf_Value, getListValue, arginfo_void, ZEND_ACC_PUBLIC)
PHP_ME(google_protobuf_Value, setListValue, arginfo_setter, ZEND_ACC_PUBLIC)
PHP_ME(google_protobuf_Value, getKind, arginfo_void, ZEND_ACC_PUBLIC)
ZEND_FE_END


What version of protobuf and what language are you using?
Version: main
Language: php
OS: Linux

What did you do?

<?php

require_once (dirname(__DIR__) . '/vendor/autoload.php');

use Google\Protobuf\Value;

$v = new Value();

var_dump($v->hasNullValue());
# Compile the extension 
./php/tests/compile_extension.sh

# Run script
php -d display_errors=on -dextension=../ext/google/protobuf/modules/protobuf.so has_value_test.php

What did you expect to see

bool(false)

What did you see instead?

Uncaught Error: Call to undefined method Google\Protobuf\Value::hasNullValue() 

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions