my life

day to day

PHP Lesson Learned

October 11th, 2006

PHP’s reference implementation is flat out broke. Running their latest release 5.1.6, my server application segfaults randomly all over the place. Using references seemed like the best way to accomplish C/C++ style pointers (think Search Trees, DLinkedLists/LRU Cache, etc..), but at a cost way to high. As previous posts indicate, I’ve spent a great deal of time trying to resolve these conflicts. Ultimately, my solution has been to rely on the implicit refrence-like properties of objects. Objects are passed in a way similar to PBR, but not identical. That is, you can access the object and modify properties of the object, but you can’t modify the object itself. What I mean by that is you can’t change an object of type Foo to an object of type Bar. Using explicit & style references, however, you can….. but you can also blow your leg off like I found out.

add to del.icio.us    add to technorati favs    email this

Leave a Reply