Edit report at https://bugs.php.net/bug.php?id=55369&edit=1

 ID:                 55369
 Updated by:         ras...@php.net
 Reported by:        md dot xytop at gmail dot com
 Summary:            Files with classes are included, but classes are not
                     defined correctly
-Status:             Open
+Status:             Not a bug
 Type:               Bug
 Package:            Class/Object related
 Operating System:   Debian/Ubuntu/MacOS
 PHP Version:        5.3.6
 Block user comment: N
 Private report:     N

 New Comment:

No idea what might have been wrong with your 5.3.5, but it works fine on 5.3.10 
and 5.4.0. I get the same output from both:

/home/rasmus/file3.php<br/>
/home/rasmus/file4.php<br/>
/home/rasmus/file2.php<br/>
/home/rasmus/file1.php<br/>
/home/rasmus/file0.php<br/>


Previous Comments:
------------------------------------------------------------------------
[2011-08-05 10:18:57] md dot xytop at gmail dot com

See first comment to look at example

------------------------------------------------------------------------
[2011-08-05 10:15:46] md dot xytop at gmail dot com

file0.php:

<?php

require_once(dirname(__FILE__) . '/file1.php');

class Class0
{
}

echo __FILE__ . '<br/>' . "\r\n";

?>


file1.php:

<?php

require_once(dirname(__FILE__) . '/file2.php');
require_once(dirname(__FILE__) . '/file4.php');

class Class1 extends Class0
{
}

echo __FILE__ . '<br/>' . "\r\n";

?>


file2.php:

<?php

require_once(dirname(__FILE__) . '/file1.php');
require_once(dirname(__FILE__) . '/file3.php');
require_once(dirname(__FILE__) . '/file4.php');

class Class2 extends Class0
{
}

echo __FILE__ . '<br/>' . "\r\n";

?>


file3.php:


<?php

require_once(dirname(__FILE__) . '/file1.php');

class Class3 extends Class1
{
}

echo __FILE__ . '<br/>' . "\r\n";

?>



file4.php:


<?php

class Class4 extends Class0
{
}

echo __FILE__ . '<br/>' . "\r\n";

?>

------------------------------------------------------------------------
[2011-08-05 10:12:32] md dot xytop at gmail dot com

Description:
------------
After updating our php code (added some classes, have rewritten some 
functionality) one of our utilites stopped to work. After deep digging we found 
that php doesn't define a class in some circumstances. In attachment is our 
handmade example.
Try to run file0.php

On 5.2.17 and 5.3.2 we have output:

/home/vitaly/.../public_html/file3.php
/home/vitaly/.../public_html/file4.php
/home/vitaly/.../public_html/file2.php
/home/vitaly/.../public_html/file1.php
/home/vitaly/.../public_html/file0.php

On 5.3.5:

Fatal error: Class 'Class1' not found in /.../file3.php on line 6

On our real project (which uses 5.2.17) ^^ we have the same fatal error. 
Project is very big and has many includes, so we can't provide simple example 
for it, but probably changing example from attachment to one or another side 
will do the trick..

We don't have 5.3.6 version, yes, we out of date, but I think this is something 
that's will reoccur from one version to another.

Expected result:
----------------
Run file0.php

I expect to have loading sequence



Actual result:
--------------
On some php version I have fatal error that class is undefined.


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



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

Reply via email to