PhpCodeProvider.Parse can't work, why?

Discussion about the open-source Phalanger [?] project.

PhpCodeProvider.Parse can't work, why?

Postby benleilei » August 23rd, 2012, 1:12 pm

I want to use PhpCodeProvider.Parse(), but it can't work.
this is php code :
Code: Select all
<?php

class testClass

    public function funcMain($paramA)
    {
        $paramB = $_POST["name"];
        if(count($paramA) > 0)
        {
            echo "hello world.";
        }
        else
        {
            echo "exit application.";
        }
    }
}

?>

this is c# code :
Code: Select all
var provider = new PhpCodeProvider();
CodeCompileUnit codeUnit = provider.Parse(sr);

when run, it has a exception : Function calls that are not members of object cannot be translated.
Code: Select all
   在 PHP.Core.CodeDom.PhpCodeDomParser.PhpCodeDomParserImplementation.TranslateVarLikeConstructUse(VarLikeConstructUse use, MethodContextBase method, IStatementInsertContext IC)
   在 PHP.Core.CodeDom.PhpCodeDomParser.PhpCodeDomParserImplementation.TranslateExpression(Expression Expression, MethodContextBase method, IStatementInsertContext IC)
   在 PHP.Core.CodeDom.PhpCodeDomParser.PhpCodeDomParserImplementation.TranslateBinaryOperation(BinaryEx Operation, MethodContextBase method, IStatementInsertContext IC)
   在 PHP.Core.CodeDom.PhpCodeDomParser.PhpCodeDomParserImplementation.TranslateExpression(Expression Expression, MethodContextBase method, IStatementInsertContext IC)
   在 PHP.Core.CodeDom.PhpCodeDomParser.PhpCodeDomParserImplementation.TranslateBinaryOperation(BinaryEx Operation, MethodContextBase method, IStatementInsertContext IC)
   在 PHP.Core.CodeDom.PhpCodeDomParser.PhpCodeDomParserImplementation.TranslateExpression(Expression Expression, MethodContextBase method, IStatementInsertContext IC)
   在 PHP.Core.CodeDom.PhpCodeDomParser.PhpCodeDomParserImplementation.TranslateConditions(List`1 Conditions, Int32 start, MethodContext Method, IBlockContext block)
   在 PHP.Core.CodeDom.PhpCodeDomParser.PhpCodeDomParserImplementation.TranslateStatement(IfStmt statement, MethodContextBase method, IBlockContext block)
   在 PHP.Core.CodeDom.PhpCodeDomParser.PhpCodeDomParserImplementation.TranslateBlock(IEnumerable`1 statements, MethodContextBase method, IBlockContext block)
   在 PHP.Core.CodeDom.PhpCodeDomParser.PhpCodeDomParserImplementation.TranslateMethod(MethodDecl Method, IBlockContext block)
   在 PHP.Core.CodeDom.PhpCodeDomParser.PhpCodeDomParserImplementation.TranslateBlock(IEnumerable`1 members, IBlockContext block)
   在 PHP.Core.CodeDom.PhpCodeDomParser.PhpCodeDomParserImplementation.TranslateTypeDecl(TypeDecl sType, IBlockContext block)
   在 PHP.Core.CodeDom.PhpCodeDomParser.PhpCodeDomParserImplementation.TranslateBlock(IEnumerable`1 statements, MethodContextBase method, IBlockContext block)
   在 PHP.Core.CodeDom.PhpCodeDomParser.PhpCodeDomParserImplementation.Translate(GlobalCode gc)
   在 PHP.Core.CodeDom.PhpCodeDomParser.PhpCodeDomParserImplementation.Parse(String codeText)
   在 PHP.Core.CodeDom.PhpCodeDomParser.Parse(TextReader codeStream)
   在 System.CodeDom.Compiler.CodeDomProvider.Parse(TextReader codeStream)


The reason is that use count function. why ?
benleilei
 
Posts: 1
Joined: August 23rd, 2012, 1:04 pm

Return to Phalanger project

Who is online

Users browsing this forum: No registered users and 3 guests

cron

User Control Panel

Login

Who is online

In total there are 3 users online :: 0 registered, 0 hidden and 3 guests (based on users active over the past 5 minutes)
Most users ever online was 89 on October 15th, 2018, 4:06 pm

Users browsing this forum: No registered users and 3 guests
Phalanger