Skip to content
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

Concat does not work with global properties #2063

Open
sergeyklay opened this issue Feb 23, 2020 · 2 comments
Open

Concat does not work with global properties #2063

sergeyklay opened this issue Feb 23, 2020 · 2 comments
Labels

Comments

@sergeyklay
Copy link
Member

Zephir Code

namespace Bug;

class ClassPropertyConcat
{
    private store = "";

    public function add(string value) -> void
    {
        let this->store .= value;
    }

    public function add2(string value) -> void
    {
        let this->store = this->store . value;
    }

    public function get() -> string
    {
        return this->store;
    }
}

Test

--TEST--
Test me
--SKIPIF--
<?php include __DIR__ . 'skipif.inc'; ?>
--FILE--
<?php
$test = new Bug\ClassPropertyConcat();
var_dump($test->get());

$test->add2('phalcon');
$test->add2(' framework');
var_dump($test->get());

$test = new Bug\ClassPropertyConcat();
var_dump($test->get());

// This does not works
$test->add('phalcon');
$test->add(' framework');
var_dump($test->get());
?>
--EXPECT--
string(0) ""
string(17) "phalcon framework"
string(0) ""
string(17) "phalcon framework"

Output

string(0) ""
string(17) "phalcon framework"
string(0) ""
string(10) " framework" 
@sergeyklay sergeyklay added the bug label Feb 23, 2020
@sergeyklay
Copy link
Member Author

Possible workaround

    public function add(string value) -> void
    {
        string store;

        let store = this->store;
        let store .= value;
        let this->store = store;
    }

Actually we're used this in such way always.

@sergeyklay
Copy link
Member Author

/cc @niden

@Jeckerson Jeckerson added this to the 0.13.x milestone Apr 13, 2021
@Jeckerson Jeckerson modified the milestones: 0.13.x, 0.14.x Sep 12, 2021
@Jeckerson Jeckerson modified the milestones: 0.14.x, Backlog Oct 3, 2021
@Jeckerson Jeckerson removed this from the Backlog milestone Sep 13, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants