EDIT: I'm adding a screenshot of the actual errors, as a proof that this is what happens.
Note, that the $post_id and $id properties are undefined, because the parent Y_CF
class has a magic __get()
method, but again - it's not available in the child class.
I've had a bunch of issues already(including one, where PHP would pretty much just ignore a portion of an included file, even if I threw a bunch of random characters in there, which should cause a fatal error), but I'm finally down to a single issue: I have two classes - a parent and a main class. The parent class is abstract and has a factory method that returns different child classes, based on parameters passed to it. The odd thing happens, with one of the child classes - it doesn't have the methods of the parent class. I'm posting only the relevant pieces of code
abstract class Y_CF {
// even if "public", it doesn't work
protected function parse_attributes( $attributes, $core_atts = array() ) {
$this->__settings['attributes'] = wp_parse_args( $core_atts, $attributes );
}
}
class Y_CF_Text extends Y_CF {
public function __construct( $settings ) {
parent::__construct( $settings );
// This is false
var_dump( method_exists( $this, 'parse_attributes' ) );
$this->parse_attributes( $this->attributes, array(
'id' => "Y_field_{$this->id}",
'class' => esc_attr( 'yotta-text-input ' . $this->class ),
'type' => ! empty( $this->attributes['type'] ) ? $this->attributes['type'] : 'text',
'value' => $this->format_value( $this->value ),
'name' => $this->gen_name(),
) );
}
}
As you can see, my main class is Y_CF
and I'm extending it with Y_CF_Text
.
Note, that I've tried this code on my local server(ubuntu 14) and it works just fine(as it should).
I'm suspecting that the problem is somewhere in the server configuration, but I don't have any clue where.
What I did so far:
- Updated PHP to 5.5.12 ( the issue was happening with 5.3 as well )
- Disabled opcache
- Disabled memcached
- Restarted php, nginx and the whole server
All of those had no effect whatsoever.
I've also looked all over the internet and couldn't find anything that remotely mimics my situation.