Mantis Bugtracker 

View Issue Details Jump to Notes ] Issue History ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0002300TestLinkGeneralpublic2009-03-30 07:012010-05-01 20:35
Assigned Tofman 
PlatformOSOS Version
Product Version1.8.0 
Fixed in Version1.9 Beta 2 
Summary0002300: Failed opening required 'Users.class.php'
DescriptionI recently upgraded multiple installations of TestLink from 1.7.4 to 1.8.0. All but one of the installs is working just fine. One of them fails to load the home page when accessed. I don't see any difference in the configs that would cause a problem, they are all the same except for database definitions. I'm running Apache 2.2.11 with PHP 5.2.9. Here's the entry from the Apache log:

[Sun Mar 29 16:29:20 2009] [error] [xxx] PHP Fatal error: require_once() [<a href='function.require'>function.require</a>]: Failed opening required 'Users.class.php' (include_path='.:/usr/local/php/lib/php:.:/usr/local/apache2/htdocs/xxx/testlink/lib/functions/') in /usr/local/apache2/htdocs/xxx/testlink/lib/functions/common.php on line 109, referer: [^]

Note that I can see a "user.class.php" file in that location, but not a file "Users.class.php".

I saw a previous report of a similar issue with a Smarty class, but thought opening a new issue was the right thing to do.

TagsNo tags attached.
Database (MySQL,Postgres,etc)
PHP Version5.2.9
QA Team - Task Workflow Status
Attached Files

- Relationships

-  Notes
mhavlat (reporter)
2009-06-08 18:22

Francisco, this is problem with autoload. I hope you know what should be problem. Could you look at?
Eloff (reporter)
2009-08-10 15:54

I'm "hijacking" this ticket as this is an autoload problem.
On systems where the filesystem is casesensitive the current autoloader does not work.
The files are all lowercase, so a call to strtolower() will fix this.
This way:
function __autoload($class_name) 
    // exceptions
    $tlClasses = array('tlPlatform' => true);
    $classFileName = $class_name;
    if ( isset($tlClasses[$classFileName]) )
        $len = tlStringLen($classFileName) - $tlClassPrefixLen;
        $classFileName = tlSubstr($classFileName,$tlClassPrefixLen,$len);
        $classFileName = strtolower($classFileName); // This one
    require_once $classFileName . '.class.php';
mhavlat (reporter)
2009-08-11 03:05

should we check the function existence during installation?
fman (administrator)
2009-08-17 14:21

Please explain better I do not understand.

do not solve this way absolutely.
File case must be respected => because right name is users.class.php and not woth upper case.
Doing as suggested is just masking a problem
Eloff (reporter)
2009-08-17 14:47

Problem is that autoloading "tlPlatform" tries to include "Platform.class.php" when the filename is "platform.class.php"
So the code I gave was continuing on the "magic" prefix stripping from class name to file name.

Here is another way. What do you think?
(Another way is to require the file to be names exactly as the class)

function __autoload($class_name)
    // exceptions
    $tlClasses = array('tlPlatform' => 'platform');
    $classFileName = $class_name;
    if ( isset($tlClasses[$classFileName]) )
        $classFileName = $tlClasses[$classFileName];
    require_once $classFileName . '.class.php';
fman (administrator)
2009-08-17 15:10

I'm sorry now problem is clear => for exceptions => tlPlatfom we can do lower case.
Anyway IMHO solution is other:

platform.class.php => tlPlatform.class.php

If I'm not wrong on java your class file has to be equal to class name.

till we discuss with dev team (because we need to change several class files)
I will add your solution

sorry again, I read without care, but please undertood that you have used one issue to solve other issue and this is normally confuse people.
mhavlat (reporter)
2009-08-17 15:37

Francisco, Erik,
I agree the idea refactore class names and filenames with tlXxxx format.
I'm adding a note into DevGuide.

Eloff (reporter)
2009-08-17 15:54

> "If I'm not wrong on java your class file has to be equal to class name."
You are right (for public classes).

> "please undertood that you have used one issue to solve other issue and this is normally confuse people."

Yeah, I know it. In this specific case my symptoms are different, but the solution would fix both issues.

I agree on file name change.
schlundus (reporter)
2009-08-19 02:39

I agree on file name change too.
fman (administrator)
2009-08-19 14:01

tlPlatform.class.php -> done
schlundus (reporter)
2009-08-19 22:03

I will rename the ones i've implemented one by one
fman (administrator)
2009-08-19 22:10

let me knowm if you want help , if yes then send me list of classes that I ahve to work on
fman (administrator)
2009-09-10 22:52

work done by several developers, mainly by Morsing

- Issue History
Date Modified Username Field Change
2009-03-30 07:01 dmulter New Issue
2009-03-30 07:01 dmulter Browser => all
2009-03-30 07:01 dmulter PHP Version => 5.2.9
2009-06-08 18:22 mhavlat Note Added: 0007200
2009-06-08 18:22 mhavlat Assigned To => fman
2009-06-08 18:22 mhavlat Status new => feedback
2009-08-10 15:54 Eloff Note Added: 0007752
2009-08-11 03:05 mhavlat Note Added: 0007754
2009-08-11 03:05 mhavlat Status feedback => acknowledged
2009-08-17 14:21 fman Note Added: 0007772
2009-08-17 14:47 Eloff Note Added: 0007773
2009-08-17 15:10 fman Note Added: 0007774
2009-08-17 15:37 mhavlat Note Added: 0007776
2009-08-17 15:54 Eloff Note Added: 0007777
2009-08-19 02:39 schlundus Note Added: 0007797
2009-08-19 14:01 fman Note Added: 0007802
2009-08-19 22:03 schlundus Note Added: 0007808
2009-08-19 22:10 fman Note Added: 0007809
2009-09-10 22:52 fman Note Added: 0007958
2009-09-10 22:52 fman Status acknowledged => resolved
2009-09-10 22:52 fman Fixed in Version => 1.9 (DEV)
2009-09-10 22:52 fman Resolution open => fixed
2010-05-01 20:35 fman Status resolved => closed

Copyright © 2000 - 2020 MantisBT Team
Powered by Mantis Bugtracker