ID:          33643
 Updated by:  [EMAIL PROTECTED]
 Reported By: Jason at hybd dot net
 Status:      Open
 Bug Type:    Documentation problem
 PHP Version: 5.1.0b2
 New Comment:

Actual result (4.x after removing "public static"):

4.3.10: No error
4.4.0: No error
5.0.4: No error
5.1.0: Fatal error

Is this really the expected result? I thought 4.4.0 should produce
something too. In which cases 4.4.0 produces errors?


Previous Comments:
------------------------------------------------------------------------

[2005-07-14 01:08:15] [EMAIL PROTECTED]

This is not gonna change, it's now how it's supposed to be.



------------------------------------------------------------------------

[2005-07-11 22:04:22] Jason at hybd dot net

May I be a pain and just ask will there be any chance that this bug
will be resolved at some point in the future, or will you push others
to work round this bug. May i suggest, seeing as this does break a lot
of things, would it be possible to make this something like a
ze1_compatiblity_mode to help people phase this change in?

I assume this fixes blugs like 32685. I assume is a similar issue as I
had relating to in 32963, and I assume many other people have reported
similar bugs.

------------------------------------------------------------------------

[2005-07-11 20:34:34] [EMAIL PROTECTED]

Yes, it is undocumented. But same goes for PHP 4.4.0 too. 
Reclassified. (this break was intentional and fixed a lot of references
related bugs)


------------------------------------------------------------------------

[2005-07-11 20:28:07] Jason at hybd dot net

Sorry, it's all fair and well making this bogus, but this change breaks
****LOADS**** of existing code, so it is not a bug and it's behavior is
NOT documented. The least you could have done is justify why this is
not a bug and why this change was introduced into the language!

This is really a PHP bug because thi has worked in all versions of PHP
prior to this. There has been nothing in the way of warning or anything
in recent releases to phase in this change in behaviour like there was
with the call by reference thing.

Do you expect many thousands of programmers to change their code
because if this stupid querk.

------------------------------------------------------------------------

[2005-07-11 13:06:46] Jason at hybd dot net

Description:
------------
This bug is a rehash of 33516, but I can't reopen as I'm not the
original author.

It seems like you can not pass tempories to function / method
parameters.

<?php

class Foo {
        public static function bar() {
                return array('a' => '1234567890');
        }
}

$tmp = Foo::bar();
$var = array_pop($tmp);

?>

Seems to work, but it shouldn't be down to the PHP user (imho) to
implement this as this change in PHP 5.1 breaks a lot of existing code.

Reproduce code:
---------------
<?php

class Foo {
        public static function bar() {
                return array('a' => '1234567890');
        }
}

$var = array_pop(Foo::bar());

?>

Expected result:
----------------
$var = '1234567890';
Foo::bar() gets placed in temporary variable

Actual result:
--------------
Fatal error: Only variables can be passed by reference 


------------------------------------------------------------------------


-- 
Edit this bug report at http://bugs.php.net/?id=33643&edit=1

Reply via email to