#45789 [Bgs]: Silent crash on duplicate method

[email protected]
Newsgroups php.bugs
Message-ID <[email protected]>
 ID:               45789
 Updated by:       [email protected]
 Reported By:      DikMax at gmail dot com
 Status:           Bogus
 Bug Type:         Class/Object related
 Operating System: WinXP sp3
 PHP Version:      5.2.6
 New Comment:

verify, using phpinfo(), that you're editing the correct php.ini and
are not overwriting the settings somewhere.


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

[2008-08-11 22:12:43] DikMax at gmail dot com

Ok.
Maybe I wrote bad example.

I have next options in php.ini:

error_reporting  =  E_ALL | E_STRICT
display_errors = On
display_startup_errors = On
log_errors = On

and it still produce no output (in Apache's error.log or browser
window). First time I saw this thing when use include_once to other
file. And PHP silently stops running on include class with duplicate
methods.

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

[2008-08-11 21:53:05] [email protected]

Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to report
a bug at http://bugs.php.net/how-to-report.php

Please enable error reporting in your server, then you get a "Fatal
error: Cannot redeclare ClassName::method()". Setting this in the script
doesn'T work as the error is generated before the script executes.

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

[2008-08-11 21:38:35] DikMax at gmail dot com

Description:
------------
When write two methods with same name in one class PHP doesn't produce
any error. It just silently stops processing on include

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

ini_set('display_errors', 1);
error_reporting(E_ALL | E_STRICT);

class ClassName
{
    public function method()
    {
        echo 1;
    }
    
    public function method()
    {
        echo 1;
    }
}

echo 2;

Expected result:
----------------
Some compiler or interpreter error

Actual result:
--------------
Nothing


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


-- 
Edit this bug report at http://bugs.php.net/?id=45789&edit=1
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.