Solved thread

This post is marked as solved. If you think the information contained on this thread must be part of the official documentation, please contribute submitting a pull request to its repository.

in window no error ,in centos 7 64 has error: undefined Call function my_get_host

in window no error ,in centos 7 64 has error: undefined Call function mygethost.

the window php 5.6 ts, the centos 7 64 php5.6 nts.

Zephir version 0.9.4a-dev-1e1c234ef0

I think the code “mygethost” as a PHP function to call, not as a function of the C language, so it can not find. I don't knows the solution.

the "mygethost" is my optimizers

the config.json

"extra-sources": [ "my/my.c" ],

the code:

#include "../ext_config.h"

#include <php.h>
#include "../php_ext.h"
#include "../ext.h"

#include <Zend/zend_operators.h>
#include <Zend/zend_exceptions.h>
#include <Zend/zend_interfaces.h>

#include "kernel/main.h"
#include "kernel/memory.h"
#include "kernel/fcall.h"
#include "kernel/operators.h"
#include "kernel/exception.h"
#include "kernel/concat.h"
#include "ext/spl/spl_exceptions.h"
#include "kernel/array.h"
#include "kernel/string.h"
#include "kernel/object.h"
#include "kernel/hash.h"
void my_get_host(zval *return_value TSRMLS_DC)

the optimizers

    namespace Zephir\Optimizers\FunctionCall;

use Zephir\Call;
use Zephir\CompilerException;
use Zephir\CompilationContext;
use Zephir\CompiledExpression;
use Zephir\Optimizers\OptimizerAbstract;

class MyGetHostOptimizer extends OptimizerAbstract

    public function optimize(array $expression, Call $call, CompilationContext $context)

        $symbolVariable = $call->getSymbolVariable(true, $context);
        if ($symbolVariable->isNotVariableAndString()) {
            throw new CompilerException("Returned values by functions can only be assigned to variant variables", $expression);

        if ($call->mustInitSymbolVariable()) {
        $symbol = $context->backend->getVariableCode($symbolVariable);
        $context->codePrinter->output('my_get_host(' . $symbol . ' TSRMLS_CC);');

        return new CompiledExpression('variable', $symbolVariable->getRealName(), $expression);



I think it is a function of the prefix “my" and the module name "my", causing the conflict,

I modify the function of the prefix after the problem is solved.