zephir-lang / zephir

Zephir is a compiled high-level language aimed to ease the creation of C-extensions for PHP
https://zephir-lang.com
MIT License
3.29k stars 466 forks source link

Can't unset object property using variable as property name. #808

Open kse300489 opened 9 years ago

kse300489 commented 9 years ago

Example:

var
  obj, property;

let
  obj = new stdClass(), property = "property000";
  obj->property000 = "test";

unset(obj->{property});

Got error:

Zephir\CompilerException: Cannot use expression type: property-dynamic-access in "unset" in ... Xml.zep

            unset(obj->{property});
    ------------------------------------^

--- Want to back this issue? **[Post a bounty on it!](https://www.bountysource.com/issues/9380369-can-t-unset-object-property-using-variable-as-property-name?utm_campaign=plugin&utm_content=tracker%2F280146&utm_medium=issues&utm_source=github)** We accept bounties via [Bountysource](https://www.bountysource.com/?utm_campaign=plugin&utm_content=tracker%2F280146&utm_medium=issues&utm_source=github).
kse300489 commented 9 years ago

@ovr Any ideas? I am really need this feature. This code unset(obj->property); is working, but this unset(obj->{property}); not. I can't remove object properties in loop.

Jurigag commented 8 years ago

@steffengy that would be nice to have though.

Just bumping

Jurigag commented 7 years ago

Well there is related phalcon issue to which requires this fix/feature to be implemented.