-
Notifications
You must be signed in to change notification settings - Fork 3k
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
yii framework activerecord object __get() can't work #870
Comments
Hi @fightingbamboo, can you provide more information? (The source and what the error is exactly?) This might be the same issue as #657 but I'm not sure from this. |
<?php
class CComponent
{
private $_m;
public function __get($name)
{
$getter='get'.$name;
if(method_exists($this,$getter))
return $this->$getter();
else if(isset($this->_m[$name]))
return $this->_m[$name];
echo "can't get $name <br />";
}
public function __set($name,$value)
{
$setter='set'.$name;
if(method_exists($this,$setter))
return $this->$setter($value);
echo "can't set '$name = $value' <br />";
}
public function __isset($name)
{
$getter='get'.$name;
if(method_exists($this,$getter))
return $this->$getter()!==null;
else if(is_array($this->_m))
{
if(isset($this->_m[$name]))
return true;
foreach($this->_m as $object)
{
if($object->getEnabled() && (property_exists($object,$name) || $object->canGetProperty($name)))
return true;
}
}
return false;
}
public function __call($name,$parameters)
{
if($this->_m!==null)
{
foreach($this->_m as $object)
{
if($object->getEnabled() && method_exists($object,$name))
return call_user_func_array(array($object,$name),$parameters);
}
}
}
public function hasProperty($name)
{
return method_exists($this,'get'.$name) || method_exists($this,'set'.$name);
}
public function canGetProperty($name)
{
return method_exists($this,'get'.$name);
}
public function canSetProperty($name)
{
return method_exists($this,'set'.$name);
}
}
class Ad extends CComponent
{
public function testfunc()
{
$this->testvar = "is's me";
echo "property testvar:", $this->testvar, "<br />";
}
}
$test = new Ad();
echo "call testfunc function:","<br />";
$test->testfunc();
echo "<br />";
echo "call testfunc property:","<br />";
$test->testfunc;
?> |
Why do you think this is an HHVM bug? Do you see different behavior using Zend PHP? I tried your code sample in three different versions of Zend and I get the same results: HHVM: call testfunc property: Zend 5.3: call testfunc property: Zend 5.4: call testfunc property: Zend 5.5: call testfunc property: |
I am so sorry,the code sample is wrong.I run the full app which written with yii. it run in zend 5.3 is ok,but in the hhvm is wrong. i only run the code samlple in hhvm. sorry very much.I give the right code sample later. |
Summary: # Motivation And if there is one is one design mistake Rust ecosystem made, it is making [`group_by` weird](rust-itertools/itertools#374) and possible for users to, quote: > I spent several hours debugging my code written using the group_by function. Luckily for internal users, the build tooling responds accordingly and fails build for all usages of deprecated API. Thus, there is a need to adjust all of them manually. # [Release notes](https://github.com/rust-itertools/itertools/blob/master/CHANGELOG.md#0130) ### Breaking - Removed implementation of `DoubleEndedIterator` for `ConsTuples` (#853) - Made `MultiProduct` fused and fixed on an empty iterator (#835, #834) - Changed `iproduct!` to return tuples for maxi one iterator too (#870) - Changed `PutBack::put_back` to return the old value (#880) - Removed deprecated `repeat_call, Itertools::{foreach, step, map_results, fold_results}` (#878) - Removed `TakeWhileInclusive::new` (#912) NOTE: Quick search didn't tell me anything related to breaking changes above, CI will tell. And, of course, scream to me if it breaks your personal build. Reviewed By: anps77 Differential Revision: D64306014 fbshipit-source-id: 881ac716e1dc23968d4a28000fdaccdbf9097ec2
a property in Ad can't call CComponent's __get($name)
The text was updated successfully, but these errors were encountered: