With -D php7 analyzer generates code resulting with PHP parsing exception 'cannot use temporary expression in write context' #5923

szczepanpp opened this Issue Jan 4, 2017 · 1 comment


None yet

2 participants

szczepanpp commented Jan 4, 2017 edited

Following Haxe code

var someMap = new Map();
var someObject = someMap.get(someKey);
someObject.someProperty = someValue;

generates this PHP code:

$someMap = new StringMap();
($someObject->data[$someKey] ?? null)->someProperty = $someValue;

and that can't be parsed by PHP: PHP Fatal error: Cannot use temporary expression in write context.

With -D no-analyzer generated code is

$someMap = new StringMap();
$someObject = ($someMap->data[$someKey] ?? null);
$someObject->someProperty = $someValue;

and that works.

Haxe compiler 3.4.0-RC2
PHP 7.0.8-0ubuntu0.16.04.3

PS. Found a discussion under http://stackoverflow.com/questions/37554407/is-there-a-switch-to-disable-cannot-use-temporary-expression-in-write-context

@RealyUniqueName RealyUniqueName self-assigned this Jan 4, 2017
@RealyUniqueName RealyUniqueName added a commit that closed this issue Jan 5, 2017
@RealyUniqueName RealyUniqueName [php7] dereference Syntax.binop(), Syntax.array() and Syntax.object()…
… in left part of assignments (fixes #5923)

Thanks for report.
Fixed in development branch.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment