1

Closed

Internal error on create_function()

description

Hi,
I receive an internal error on a simple console application made with vs, this is the code:
 
<?php
 
class Program
{
static function Main()
{
    echo "Hello!\n";
    $f = create_function('$test', '$rpp = chr(0).chr(32); return $rpp;');
    fgets(STDIN);
    return 0;
}
}
 
?>
 
The instruction that causes the error is $rpp= chr(0).chr(32);
 
This is the full error:
 
Error 1 Internal error!
Please, report this bug via http://www.codeplex.com/WorkItem/List.aspx?ProjectName=Phalanger.
Additional information:
Object reference not set to an instance of an object.
at PHP.Core.Emit.ILEmitter.EmitLoadPhpBytes(PhpBytes value)
at PHP.Core.Emit.ILEmitter.LoadLiteral(Object value, Boolean box)
at PHP.Core.AST.Literal.Emit(CodeGenerator codeGenerator)
at PHP.Core.AST.ValueAssignEx.EmitSourceValRead(CodeGenerator codeGenerator)
at PHP.Core.AST.ValueAssignEx.Emit(CodeGenerator codeGenerator)
at PHP.Core.AST.ExpressionStmt.Emit(CodeGenerator codeGenerator)
at PHP.Core.CodeGenerator.EmitArgfullOverloadBody(PhpRoutine routine, List1 body, Position entirePosition, ShortPosition declarationBodyPosition)
at PHP.Core.AST.FunctionDecl.Emit(CodeGenerator codeGenerator)
at PHP.Core.AST.GlobalCode.Emit(CodeGenerator codeGenerator)
at PHP.Core.Reflection.SourceUnit.Emit(CodeGenerator codeGen)
at PHP.Core.Reflection.PureCompilationUnit.Compile(IEnumerable
1 sourceFiles, PureAssemblyBuilder assemblyBuilder, CompilationContext context, Encoding encoding)
at PHP.Core.Emit.PureAssemblyBuilder.Build(IEnumerable`1 sourceFiles, CompilationContext context)
at PHP.Core.ApplicationCompiler.Compile(ApplicationContext applicationContext, CompilerConfiguration config, ErrorSink errorSink, CompilationParameters ps)
    -1  -1  ConsoleApplication1
 
 
 
Many thanks
Closed May 23, 2012 at 6:01 PM by jakub
fixed -> closing

comments

jakub wrote May 23, 2012 at 6:01 PM

Thanks for reporting this.

I have fixed the issue (binary string in global function in pure mode). However global functions in pure mode may cause another (similar) exceptions. Please report any if you find.

https://github.com/DEVSENSE/Phalanger contains latest sources