Opened 5 years ago

Closed 3 years ago

#238 closed defect (worksforme)

if and else execute together! (class extends)

Reported by: ehsanch Owned by: moo
Priority: critical Milestone: 1.3.2
Component: cacher Version: 1.3.0
Keywords: Cc:
Application: PHP Version: tested on 5.2.6
Other Exts: SAPI: FastCGI
Probability: Always Blocked By:
Blocking:

Description

i create a simple php script :

<?php
class newclass {
    public function newfunc() {
        echo 'class exist';
    }
}
 
if (true) {
    class myclass1 extends newclass {}
}
else {
    class myclass2 extends newclass {}
}
 
$test = new myclass2;
$test->newfunc();
 

[root@server]# php test.php
Fatal error: Class 'myclass2' not found in test.php on line 15

[root@server]# php-cgi test.php
X-Powered-By: PHP/5.2.6
Content-type: text/html
class exist

Change History (2)

comment:1 Changed 5 years ago by moo

  • Status changed from new to assigned

comment:2 Changed 3 years ago by moo

  • Resolution set to worksforme
  • Status changed from assigned to closed

pls try 1.3.1 or 1.3.2 or svn branches/1.3

$ php -c xcache-test.ini -v
PHP 5.3.3-dev (cli) (built: Mar 12 2010 12:10:23)
Copyright (c) 1997-2010 The PHP Group
Zend Engine v2.3.0, Copyright (c) 1998-2010 Zend Technologies
    with XCache v1.3.2-dev, Copyright (c) 2005-2011, by mOo

$ php -c xcache-test.ini test.php

Fatal error: Class 'myclass2' not found in /home/moo/src/xcache/branches/1.3/test.php on line 15

$ php-cgi -c xcache-test.ini -v
PHP 5.3.3-dev (cgi-fcgi) (built: Mar 12 2010 12:10:21)
Copyright (c) 1997-2010 The PHP Group
Zend Engine v2.3.0, Copyright (c) 1998-2010 Zend Technologies
    with XCache v1.3.2-dev, Copyright (c) 2005-2011, by mOo

$ php-cgi -c xcache-test.ini test.php
X-Powered-By: PHP/5.3.3-dev
Content-type: text/html

<br />
<b>Fatal error</b>:  Class 'myclass2' not found in <b>/home/moo/src/xcache/branches/1.3/test.php</b> on line <b>15</b><br />
Note: See TracTickets for help on using tickets.