#99 Can not reassign $this in /functions/imap_mailbox.php ....


on line 25 of imap_mailbox is the following line
....(Line might vary as I'm using a version specific to

$mbx_parent = &$this;

This is a bug specific to PHP 5.1, in PHP 5.0 and PHP4
this is fine (and in PHP4 the & is needed). However in
PHP 5.1, the reference operatror, &, seems to create a
fatal error in PHP stating it can not reassign $this.

To me this is a PHP bug, and I have told the guys at
Zend (see: http://bugs.php.net/bug.php?id=32745\)

However, the guys at Zend seem to think different. I
have replied to them (no reply yet), saying that I
think they are mad because this breaks a load of
compatiblity with PHP 4.x's querks. However they seem
to have some random excuse, saying that $mbx_parent
could already be === to $this, and therefore therefore
they prevent the assignment of the reference as this
internally screws up PHP. However I've said it works
fine in earlier versions of PHP, so why do things screw
up now to them.

Anyway to cut a long story short, it seems they won't
fix this, so it seems it might be an idea for you to
make a fix / hack.

I simply removed the &, and this should be fine for
PHP5.x as assignment is done by reference on PHP5.
However this will break on PHP4 I'm sure. If this is
the case it might be an idea to look into some other
way round this. Another idea would be to bug the guys
on the Zend bug reporting site by adding comments to my
PHP bug report so they listen to the fact they are
breaking a load of backward compatiblity + older scripts.


  • Jonathan Angliss

    Logged In: YES

    I think the better way to fix this would be to replace all
    instances of $mbx_parent in that function (addMbx) with
    $this as that is ultimately what the error line is doing. I
    believe this should resolve the issue, and not break PHP4.
    I shall take a look at the code, and have a test with PHP4,
    however as I don't have a PHP5 environment, I cannot test.
    Are you able to test the change for me?

  • Jonathan Angliss

    • assigned_to: nobody --> jangliss
  • Tomas Kuliavas

    Tomas Kuliavas - 2005-07-24

    Logged In: YES

    Issue is for devel branch only. Affected code is removed
    from 1.4.5.

  • Tomas Kuliavas

    Tomas Kuliavas - 2005-07-24
    • milestone: 101717 -->
  • Tomas Kuliavas

    Tomas Kuliavas - 2005-11-27
    • status: open --> closed

Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

JavaScript is required for this form.

No, thanks