orchidsoftware / orchidsoftware/platform

Unexpted changing of public properties in class Screen

Open
#2,778 0 comments 0 reactions 1 assignee View on GitHub

@tabuna is already working on this.

Since Dec 25, 2023.

Errors
Dominant language
PHP
Stars
4.8k
Forks
662
Avg merge
1d 9h
Merged PRs (30d)
7

Description

it seems that value of ALL public properties of Screen is changed after query() call.
Even if this property is not changed in query()
Compare values in query() and Save

class MyScreen extends Screen
{
    protected $protected_property = 'Some protected value';
    public  $public_property  = 'Some public value';

    public function query($id = null): iterable
    {
        echo $this->protected_property; // 'Some protected value'
        echo $this->public_property;  // 'Some public value'
        return [];
    }

    public function layout(): iterable
    {
        return [Layout::rows([
            Button::make('Кнопка')->method('Save')
        ])];
    }

    public function Save()
    {
        echo $this->protected_property; // 'Some protected value'
        echo $this->public_property;  // null. WTF?!
    }

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.