phplate-static-binding

Object static properties in late static binding


Problem solved, its a bug, see https://github.com/docker-library/php/issues/133

What is really weird about this is that Im using this all the time in my framework, but suddenly it stops working for this particular example.

Before executing this part of logic, its used many times without a problem...no idea why this part does not work.

class DailyCompetitionWinnersFactory extends Factory
{
    public static $table = 'tf_dc_winners';
    public static $child_item_class_name = DailyCompetitionWinnersItem::class;
}
abstract class Factory extends coreClass
{
    static $factory_instance_counter = 0;
    static $child_item_class_name = null;
    static $table = null;

    protected $orig_handled_obj_array = null;
    protected $handled_obj_array = null;

    public static function Create()
    {
        return new static();
    }
}

Create new instance

DailyCompetitionWinnersFactory::Create()

I get instance of DailyCompetitionWinnersFactory, but it doesnt have any static properties that are defined.

enter image description here


Solution

  • Its a bug, see https://github.com/docker-library/php/issues/133


    Writing more characters so I can post this answer.