|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2005-04-10 22:22 UTC] ladislav dot prosek at matfyz dot cz
Description:
------------
There is probably a bug in memory allocation related to property getters. Note that the behavior depends on lengths of the two strings and also on the way the $q property is initialized.
Reproduce code:
---------------
class A
{
var $q;
function __construct()
{
$this->q = array();
}
function __get($name)
{
return $this->q;
}
};
$a = new A;
$b = "short";
$a->whatever =& $b;
$b = "much longer";
var_dump($a);
Expected result:
----------------
// as __get does not return a reference
// the output should IMHO look like this:
object(A)#1 (1) {
["q"]=>
array(0) {
}
}
// if you guys think the output should be
// different, please do explain it!
Actual result:
--------------
object(A)#1 (1) {
["q"]=>
CRASH!
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Wed Oct 29 20:00:01 2025 UTC |
object(A)#1 (1) { ["q"]=> &UNKNOWN:0 } /usr/src/php/php5/Zend/zend_execute.c(891) : Freeing 0x0A117D6C (16 bytes), script=/home/jani/t.php /usr/src/php/php5/Zend/zend_variables.h(45) : Freeing 0x0A117D2C (12 bytes), script=/home/jani/t.php /usr/src/php/php5/Zend/zend_variables.c(120) : Actual location (location was relayed) === Total 2 memory leaks detected ===