Capitalisation issue

6 views
Skip to first unread message

robert....@gmail.com

unread,
Oct 20, 2009, 8:18:35 AM10/20/09
to Php Object Generator
I am working on a LAMP stack previously I have had no problems with
capitalisation. Recently I have found that to run the setup I need a
class.database.php yet to make the application run I need a
class.Database.php.

Is this a known issue? I know it will not show on windows machines.

Crispy

unread,
Oct 21, 2009, 4:48:38 AM10/21/09
to Php Object Generator
I have not encountered this before.

What OS are you running and which versions of php and webserver?

I would check your files for an include class.Database... Somewhere
too. It may be a single typo in a source file that is causing your
grief.

On Oct 20, 5:18 am, "robert.morti...@gmail.com"

robert....@gmail.com

unread,
Oct 21, 2009, 11:58:58 AM10/21/09
to Php Object Generator


On Oct 21, 9:48 am, Crispy <marksle...@gmail.com> wrote:
> I have not encountered this before.
>
> What OS are you running and which versions of php and webserver?
>
> I would check your files for an include class.Database... Somewhere
> too. It may be a single typo in a source file that is causing your
> grief.
>

The problem is in the POG objects. They refer to Database:: this needs
to be database::
If the database needs to be capitalised then there should be a
strtolower in the autoloader.

The set-up explicitly loads class.database.php (lower case)

The file is shipped as a lower case file name

There are a number of ways to fix this

1 - Solve it at the autoloader
2 - Capitalise the download and alter the include in the test modules
3 - Change Database:: to database:: in the pog generated objects.

Note in class.database.php the class name is Database but php seems
to cope with this when asked to crate a database object

I have gone for 3 and it works for me

robert....@gmail.com

unread,
Oct 21, 2009, 11:23:06 AM10/21/09
to Php Object Generator


On Oct 21, 9:48 am, Crispy <marksle...@gmail.com> wrote:
> I have not encountered this before.
>
> What OS are you running and which versions of php and webserver?

LAMP (Linux Apache MySQL PHP) As it is a capitalisation issue I am
assuming the Linux bit is the significant one.
I can do full versions and vendors if required.

Joel

unread,
Oct 21, 2009, 12:54:15 PM10/21/09
to Php Object Generator
Makes sense Robert, but where is the autoload that you're referring
to? Can't find it.


On Oct 21, 9:23 am, "robert.morti...@gmail.com"

Robert Mortimer

unread,
Oct 21, 2009, 2:31:45 PM10/21/09
to php-object...@googlegroups.com
I was assuming that there was some sort of auto loading in among the
objects but I was wrong. I use the php magic method to load the
objects I can fix it there myself.

It may be useful to include the fix in the documentation I will
provide it once it is tested. A more elegemt solution would be to fix
the capitalisation issue. I have downloaded the POG source and am
having a bit osf a look at that too. My main issue is :- How fixed are
the team on their style rules, because if they are the fix is to
capitalise the object file names to match the class anes and fix the
one include in the set up.

Rob

2009/10/21 Joel <joe...@gmail.com>:

Crispy

unread,
Oct 23, 2009, 2:03:56 AM10/23/09
to Php Object Generator
Interesting... I take the blame for that design decision.

typing file names without caps is a whole lot safer from a human
perspective, but not so with a simple auto-loader.
What are you using for the auto loading? I seem to recall PHP 5 having
something somewhere for that, but that could be a delusion of mine...
If it is a small script, scanning for both class.Database.php and
lowercase(class.Database.php) would be a sensible fix.

-Mark

On Oct 21, 11:31 am, Robert Mortimer <robert.morti...@gmail.com>
wrote:
> I was assuming that there was some sort of auto loading in among the
> objects but I was wrong. I use the php magic method to load the
> objects I can fix it there myself.
>
> It may be useful to include the fix in the documentation I will
> provide it once it is tested. A more elegemt solution would be to fix
> the capitalisation issue. I have downloaded the POG source and am
> having a bit osf a look at that too. My main issue is :- How fixed are
> the team on their style rules, because if they are the fix is to
> capitalise the object file names to match the class anes and fix the
> one include in the set up.
>
> Rob
>
> 2009/10/21 Joel <joel...@gmail.com>:

robert....@gmail.com

unread,
Oct 23, 2009, 12:33:44 PM10/23/09
to Php Object Generator

On Oct 23, 7:03 am, Crispy <marksle...@gmail.com> wrote:
> Interesting... I take the blame for that design decision.
>
> typing file names without caps is a whole lot safer from a human
> perspective, but not so with a simple auto-loader.
> What are you using for the auto loading?

There is my new loader code.

function __autoload($class_name) {
$filename_lower = 'class.'.strtolower($class_name) . '.php';
$filename = 'class.'.$class_name . '.php';
if(file_exists('objects/'. $filename_lower))require_once 'objects/'.
$filename_lower ; #includes the POG class
if(file_exists('myObjects/'. $filename))require_once 'myObjects/'.
$filename ; #includes the CUSTOM classes
}

The autoload magic method is invoked if a class is not found. I am
still havving issues ignoreing classed in the normal object directory
so I keep mine apart!

Rob

Robert Mortimer

unread,
Oct 23, 2009, 1:45:31 PM10/23/09
to Php Object Generator
Paris Paraskeva also has the same strtolower in his auto loader.
See ODBc connect thread

PS that's having not havving in the last post

2009/10/23 robert....@gmail.com <robert....@gmail.com>:

Paris Paraskeva

unread,
Oct 24, 2009, 5:15:53 PM10/24/09
to php-object...@googlegroups.com
Yep, if I remember well it was working well in windows (test server) but was
having problems on my live server (redhat) so strtolower solved my problem
:)

I have now upgraded my test server to php 5.3 and I fixed all sort of
different problems to make everything work. Noting from POG or my code but
2-3 classes that I am using for all sorts of different stuff.

Auto loading classes is and excellent way of keeping you code clean from
includes while not loading unnecessary code.

I will be converting most of my CMS into classes just for the sake for auto
loading just the code that needs to run and nothing else!

Hell I am doing something similar with CSS and JavaScript in order to make
things faster.
> __________ Information from ESET NOD32 Antivirus, version of virus signature
> database 4537 (20091023) __________
>
> The message was checked by ESET NOD32 Antivirus.
>
> http://www.eset.com
>

mtb24

unread,
Nov 2, 2009, 12:38:12 AM11/2/09
to Php Object Generator
I am running into the same problem.
I have tried the autoloader that Paris posted, and also tried the 3
solutions posted by Robert Mortimer, but still can't find Class
Database (or database when renamed).

What else can I try? Any ideas?

Setup reports no errors. I can write/read from tables created by pog
setup with other scripts and I can even add a record from the Manage
Objects tab.

Linux server, PHP 5.2.6, POG generated with PHP 5.1+ and PDO/mySql

Paris Paraskeva

unread,
Nov 3, 2009, 3:20:47 AM11/3/09
to php-object...@googlegroups.com
My autoloader should work fine with no capitalization problem since I am converting class names to lowercase!
I have it running on both windows, mac and linux working fine!

You just need to replace $config['root-path'] with an absolute file path to your script root


Kindest Regards,

Paris Paraskeva
Managing Director
M.E. & E. United Worx Ltd
33, Apostolou Pavlou Avenue, Office 103, 8046 Paphos, Cyprus
Tel.: +357 26220707, +357 26221313, Mob.: +357 99575501
Fax.: +357 26221002
pa...@unitedworx.com
www.unitedworx.com

The information contained in this email message(and any attachments) is legally privileged and confidential information intended only for the use of the addressee(s) listed on this email. If the reader of this message is not the intended recipient you are hereby notified that any dissemination, distribution or copy of this email is strictly prohibited. If you have received this email in error, please notify us by telephone or email on the contact details shown on the end of this email. Thank you.
__________ Information from ESET NOD32 Antivirus, version of virus signature database 4565 (20091102) __________

The message was checked by ESET NOD32 Antivirus.

http://www.eset.com


__________ Information from ESET NOD32 Antivirus, version of virus signature database 4567 (20091102) __________

The message was checked by ESET NOD32 Antivirus.

http://www.eset.com



__________ Information from ESET NOD32 Antivirus, version of virus signature database 4567 (20091102) __________

Ken Downey

unread,
Nov 3, 2009, 11:21:40 AM11/3/09
to php-object...@googlegroups.com
Thanks Paris,
I have done that, I even tried just putting the absolute path in the autoload's $path statement. 
It still has fatal error in the object class where it says - '$connection = Database::Connect();'

How does the autoloader function get called? just by including it?

Not sure what else to try...

Joel

unread,
Nov 3, 2009, 6:36:09 PM11/3/09
to Php Object Generator
try including database.php using include() in your actual code.

Paris Paraskeva

unread,
Nov 4, 2009, 2:54:54 AM11/4/09
to php-object...@googlegroups.com

You simply need to include that function and it will be done automatically. Try and echo the path of the file that the loader tries to load

 

You don’t need to include the database file since the autoloader will do that!

 

Are you on php 5 ??? Auto load does not work on php 4 !!!

 

 

 

Kindest Regards,

 

Paris Paraskeva

Managing Director

M.E. & E. United Worx Ltd

33, Apostolou Pavlou Avenue, Office 103, 8046 Paphos, Cyprus

Tel.: +357 26220707, +357 26221313, Mob.: +357 99575501
Fax.: +357 26221002

pa...@unitedworx.com

www.unitedworx.com

 

The information contained in this email message(and any attachments) is legally privileged and confidential information intended only for the use of the addressee(s) listed on this email. If the reader of this message is not the intended recipient you are hereby notified that any dissemination, distribution or copy of this email is strictly prohibited. If you have received this email in error, please notify us by telephone or email on the contact details shown on the end of this email. Thank you.

 



 

__________ Information from ESET NOD32 Antivirus, version of virus signature database 4570 (20091103) __________

 

The message was checked by ESET NOD32 Antivirus.

 

http://www.eset.com

 

__________ Information from ESET NOD32 Antivirus, version of virus signature database 4571 (20091104) __________

 

The message was checked by ESET NOD32 Antivirus.

 

http://www.eset.com



__________ Information from ESET NOD32 Antivirus, version of virus signature database 4571 (20091104) __________
Reply all
Reply to author
Forward
0 new messages