-
-
Notifications
You must be signed in to change notification settings - Fork 468
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Unset from object property array not working #1259
Comments
@dreamsxin Could you please take a look? |
@dreamsxin as you can see above it's used within phalcon itself causing some problems |
$arrtest = new Test\ArrayAccessObj;
var_dump($arrtest);
unset($arrtest['one']);
var_dump($arrtest); The #define SEPARATE_ZVAL_IF_NOT_REF(zv) do { \
zval *_zv = (zv); \
if (Z_COPYABLE_P(_zv) || \
Z_IMMUTABLE_P(_zv)) { \
if (Z_REFCOUNT_P(_zv) > 1) { \
if (!Z_IMMUTABLE_P(_zv)) { \
Z_DELREF_P(_zv); \
} \
zval_copy_ctor_func(_zv); \
} \
} \
} while (0) Test2: class ArrayAccessObj implements \ArrayAccess
{
protected test;
public test2;
public function __construct() {
let this->test = [
"one":1,
"two":2,
"three":3
];
}
public function setTest2(string! offset, value)
{
let this->test2[offset] = value;
return this->test2;
}
public function unsetTest2(string! offset)
{
unset this->test2[offset];
return this->test2;
}
} $arrtest = new Test\ArrayAccessObj;
//var_dump($a = $arrtest->test2 = ['test', 'test']);
var_dump($a = $arrtest->setTest2('one', 'one'));
var_dump($arrtest->setTest2('two', 'two'));
var_dump($arrtest->unsetTest2('one'), $a); |
That's weird, because in this PR as you can see test is failing https://github.com/phalcon/cphalcon/pull/14176/files |
@Jurigag Can use zephir development version test again, the change 843f5c8#diff-773a733807b93616c23cc11607b87a30R573 |
I'm seeing that this issue still occurs in 0.12.2. |
@ruudboon could you please send a pull request with a test shows the issue |
…F() and SEPARATE_ARRAY() In PHP8.1 this macro will be removed - php/php-src@ec58a6f
…riable #1259 - Fix unset property via variable
Unfortunately unset from array is not working.
Sample function code:
compiled C code:
result:
Zephir version: 0.9.3a-dev
PHP: 7.0
OS: Ubuntu 16.04
May I provide additional informations, which help resolve this issue?
I tried to modify C code by myself . After remove PH_SEPARATE attribute, issue is gone.
The text was updated successfully, but these errors were encountered: