O
O
Oleg Abrazhaev2014-08-29 07:42:10
PHP
Oleg Abrazhaev, 2014-08-29 07:42:10

Why is it not possible in PHP 5.5 to create a property equal to the instance of the successor in the class?

Who knows why it is impossible to create a property equal to the instance of the successor in the class?
php crashes without errors, just a crash. Version 5.5.16.
Code example:

class Pricing extends Master
{
    /**
     * @var Brute
     */
    private $processingManager;

    public function __construct()
    {
        parent::__construct();

        $this->processingManager = new Brute();
    }

    /**
     *
     * @param array $result
     * @throws Exception
     */
    public function process($result)
    {
        return $this->processingManager->process($result);
    }
}

class Brute extends Pricing {

 public function process($result)
    {
        //some code
    }
}

I am getting 502 error in nginx. PHP runs through php5-fpm.
If I change the code to create Pricing directly (removing Brute from it) or direct Brute then everything works.
Above, Master, from which Pricing is inherited, implements the SomeInterface interface, i.e. it is common.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexander, 2014-08-29
@seyfer

In my opinion, there is a loop, tk. in the constructor you have new Brute () initialized

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question