#33088 [NEW]: Output Buffering + Callback method = unable to change object properties
| From: | spam at cimmanon dot org | Date: | Sat, 21 May 2005 00:10:51 +0000 |
| Subject: | #33088 [NEW]: Output Buffering + Callback method = unable to change object properties | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-79294@lists.php.net to get a copy of this message | ||
From: spam at cimmanon dot org
Operating system: OpenBSD
PHP version: 4.3.11
PHP Bug Type: Output Control
Bug description: Output Buffering + Callback method = unable to change object properties
Description:
------------
For some reason output buffering inside a callback method prevents an
object's properties from being modified outside of the object. Using
output buffering without a callback works as expected, though.
Reproduce code:
---------------
<?
class foo {
var $var = '';
function foo() {
$this->var = 'rar';
print 'foo started<hr>';
ob_start(array(&$this, 'bar'));
}
function bar() {
print $this->var . "<br>";
$this->var = 'asdf';
print $this->var;
}
}
$foo = new foo;
$foo->var = 'rarar';
?>
Expected result:
----------------
I expected $foo->var to be set to 'rarar' after the initial object
creation via constructor, then 'asdf'. Instead, it remains set to 'rar',
then 'asdf'.
--
Edit bug report at http://bugs.php.net/?id=33088&edit=1
--
Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=33088&r=trysnapshot4
Try a CVS snapshot (php5.0): http://bugs.php.net/fix.php?id=33088&r=trysnapshot50
Try a CVS snapshot (php5.1): http://bugs.php.net/fix.php?id=33088&r=trysnapshot51
Fixed in CVS: http://bugs.php.net/fix.php?id=33088&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=33088&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=33088&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=33088&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=33088&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=33088&r=support
Expected behavior: http://bugs.php.net/fix.php?id=33088&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=33088&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=33088&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=33088&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=33088&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=33088&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=33088&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=33088&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=33088&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=33088&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=33088&r=mysqlcfg