HaxeFoundation / haxe

Haxe - The Cross-Platform Toolkit
https://haxe.org
6.14k stars 656 forks source link

[php] SPOD - update() function fails unexpected #3572

Closed markknol closed 9 years ago

markknol commented 9 years ago

If I try to update() when using haxe I get en unexpected error.

My example testcase is here: https://gist.github.com/markknol/faeeb1e15b561b12533b

When I do this, I get an error

var game = _api.newGame(3); // creates instance of Game (sys.db.Object)
var gameID = game.id;

var game1 = Game.manager.get(gameID);
game1.round++;
game1.update();

Expected: database entry of Game gets updated without issues

Got:

uncaught exception: Creating default object from empty value (errno: 2) in C:\Mark\Projects\xxxxxxxxx\bin\lib\sys\db\Manager.class.php at line #168Creating default object from empty value

Hotfix I changed this line at Manager line 223 Reflect.setField(cache,name,v); to this if (cache!=null) Reflect.setField(cache,name,v); The database entry is updated and the error is gone, so it seems to be fixed.

Questions:

I use:

markknol commented 9 years ago

If i var_dump($game1) in the generated source, the cache object seems to miss: https://gist.github.com/markknol/0ad9ddc808147e0f49fc

The code in Manager.class.php#169 is $cache->{$name} = $v;

waneck commented 9 years ago

Have you tried the latest haxe (nightly)? There have been made many fixes to SPOD in Haxe lately.

markknol commented 9 years ago

No haven't tried that, since it's used for production, I cannot afford building with nightlies.

waneck commented 9 years ago

Okay. In theory this is fixed. Feel free to reopen this when you test it.