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

Increment/decrement operator not working as expected on object property? #119

Closed amnuts closed 10 years ago

amnuts commented 10 years ago

The documentation at http://zephir-lang.com/control.html#let suggests that the increment and decrement operator can be used on an object property. However, I've found with a very simple test that this doesn't appear to be so.

My simple test class (which is basically the 'hello world' from the tutorial), php calling code and results are be seen here:

https://gist.github.com/amnuts/8633535

In essence; neither of these work:

let this->counter1++; let this->revcounter1--;

These always produce the value 1:

let this->counter2 += 1; let this->revcounter2 -= 1;

These reliably work:

let this->counter3 = this->counter3 + 1; let this->revcounter3 = this->revcounter3 - 1;

This is using Zephir 0.3.0a.

ovr commented 10 years ago

work on this....

mruz commented 10 years ago

I'm getting segmentation fault in increment_function(), zephir_is_iterable_ex() is this related?

ovr commented 10 years ago

@mruz paste code plz for test

mruz commented 10 years ago

I'm getting the errors with phalcon 2.0.0 and base-app 2.0

Just ran the index.php, but gdb php and run index.php does not say too much:

Program received signal SIGSEGV, Segmentation fault.
0x00007ffff2c4399d in zephir_is_iterable_ex () from /usr/lib64/php5/extensions/phalcon.so
mruz commented 10 years ago

I'm getting segmentation fault in compiler.zep#L2045 now.

phalcon commented 10 years ago

Could you try again using the latest zephir?

mruz commented 10 years ago

It works. It started working a few days ago, Thanks!

mruz commented 10 years ago

Also append the string not working properly:

let self::_documentTitle .= title;

This overwrites the _documentTitle.

ovr commented 10 years ago

@mruz open new issue don`t write in closed issue!