Re: [PHP] is there a static constructor?

2011-03-31 Thread Darren Karstens
class Daz_Config { private static $instance; private function __construct(){ $this-load(); } private function load() { ... } public function get($key) { ... } public static getInstance(){ if (!self::$instance) self::$instance = new Daz_Config();

[PHP] PHP can't find OCI.dll

2010-04-23 Thread Darren Karstens
Hi, I have just installed PHP and Oracle 11.2 on a new server but I get an error message when I try to run php from the command line saying This application has failed to start because OCI.dll was not found. I have checked that the ORACLE_HOME environment variable is set correctly and have

Re: [PHP] Enforce a constant in a class.

2010-01-22 Thread Darren Karstens
One way to do it would be to use getter functions in your interface that return the value of the constant (or a member variable) in your implemented class. For example: interface SetKillSwitch { public function getKillSwitchNotes(); } Then in your class implement your getKillSwitchNotes

Re: [PHP] Call to undefined method on class property!?

2010-01-07 Thread Darren Karstens
Do you have a method in your Database class called affected_rows() ? From the code you have shown you only have a member variable called affected_rows and so your call $db-fetch_array($result) is falling over. On Thu, Jan 7, 2010 at 8:47 AM, Allen McCabe allenmcc...@gmail.com wrote: I have a

[PHP] ZipArchive doesnt work for large files

2009-05-05 Thread Darren Karstens
Hi, I am having problems using any of the ZipArchive functions for files above a certain size. For example creating a new zip and adding 1 file works fine for files that are only a few kb, but when I tried a slightly large one (about 60k) the zip became corrupt. Here is the code im using: $zip =

[PHP] Renaming archive entries doesnt work

2009-04-30 Thread Darren Karstens
Hi, I am trying to add a prefix to all of the entries in a zip file using the ZipArchive::renameIndex function which is corrupting the files when I try to extract them. I was wondering if anyone else has used this method successfully? Here is the code im using: $client='TEST'; $zip = new

Re: [PHP] Re: Unit Testing

2009-04-29 Thread Darren Karstens
You are right, when doing unit tests you only want to test the functionality of the current class and so if there are errors its easier to track down which class is causing the problem. I personally use an api called SimpleTest for my php testing and what you can do with this is create Mock