This is a discussion on Maintaining large scale PHP applications within the alt.comp.lang.php forums, part of the PHP Programming Forums category; Hi all, Last night I was in the pub listening to a friend recount the problems of building / releasing java ...
|
|||||||
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
|
|||
|
Hi all,
Last night I was in the pub listening to a friend recount the problems of building / releasing java code. This morning I got into work to stumble across a bug in my PHP application due to two different files containing a function with the same name (came about because the function was added to an include file, and not all the files which included it were tested). It struck me that this would not happen with a compiled language - either the linker would deal with the problem, or more likely, it would throw up an error. But with only 'php -l' to check individual files combined with manual checking this is bound to be a limiting factor in building large PHP applications. Is the only option for me to build a black box test environment for my code (rather tricky as it has a lot of integration with external systems) or does someone have a better way of solving the problem? (anyone grousing about the lack of namespaces in PHP will be flamed) TIA, C. |
|
|||
|
Colin McKinnon wrote:
> Hi all, > > Last night I was in the pub listening to a friend recount the problems of > building / releasing java code. This morning I got into work to stumble > across a bug in my PHP application due to two different files containing a > function with the same name (came about because the function was added to > an include file, and not all the files which included it were tested). > > It struck me that this would not happen with a compiled language - either > the linker would deal with the problem, or more likely, it would throw up > an error. But with only 'php -l' to check individual files combined with > manual checking this is bound to be a limiting factor in building large > PHP applications. > > Is the only option for me to build a black box test environment for my > code (rather tricky as it has a lot of integration with external systems) > or does someone have a better way of solving the problem? > > (anyone grousing about the lack of namespaces in PHP will be flamed) The only way I can see of getting around the namespace issue is to prefix your functions and classes with something eg foo_ for project "foo", similar to what they do with the various library functions eg mysql_* Of course, this still doesn't solve your problem with functions being declared with the same name... -- Chris Hope - The Electric Toolbox - http://www.electrictoolbox.com/ |