Archive for July 2007

CakeBaker: Use components from the Zend Framework with CakePHP

The PHP Geek points out an older article concerning the combination of two of the major PHP frameworks - CakePHP and the Zend Framework.

I am sure you already heard about the Zend framework. It provides some nice components (don’t confuse them with Cake components) for which there are no equivalents in the core of CakePHP. Due to the flexibility of CakePHP it is relatively easy to use these Zend components within a CakePHP application (be aware that the Zend Framework requires PHP5).

The tutorial is a simple five step process where the only difficult part is adding in the correct include path information in the Zend_Feed component.

Internet Super Hero: PHP: mysqlnd and its tests

The Internet Super Hero blog has posted some new tests using the mysqlnd driver for PHP and shows you how it’s all done for you to follow along at home.

PHP extensions can test their userland (PHP) functionality using so called “phpt Tests”. phpt Tests consist of several parts with their main part being regular PHP code to test PHP. On the website of the PHP Quality Assurance Team you can find a documentation of the phpt Tests syntax on the page Writing Tests, if your are interested in the details. Most extensions contain a tests/ subdirectory in the PHP source code to ship the tests together with C code of the extensions. So do ext/mysql and ext/mysqli.

They show the testing structure they used and some of the stats they found from their runs. The rest of the post is dedicated to how it was all set up:

  • implemented as phpt Tests
  • which need new settings
  • Using run-tests.php to run the tests
  • Failing tests
  • Useful run-tests.php options and features

They also briefly mention what a typical set of test results are (for the time the post was made).

Fernando Bassani’s Blog: Avoiding the usage of global variables

Fernando Bassani has posted an alternative to using globals in your scripts - creating “global objects” with the help of the Registry design pattern.

For a long time, the “programming good practices” tell us to avoid globals. In fact, this is a point of a large criticism in languages such as PHP. A nice solution to our global’s “needs” is the Registry design pattern. With it, we can have a repository with the data that has to be accessible, removing them from the global scope.

Included in the post is all the code you’ll need to get it to work. It uses a Singleton to grab the latest object and allows you to store values and define namespaces to keep data separate.

Mike Willbanks’ Blog: E-Commerce Frameworks?

While frameworks seem to be popping out of the woodwork, Mike Willbanks has noticed something lacking - a good e-commerce framework that helps the developer do simple things like work with shopping carts or connect with payment APIs.

So here is my question, besides the really shitty shopping cart objects out there is there any true components for a framework that utilizes this functionality? I say shitty shopping cart objects because just about every single open source PHP shopping cart has some of the worst design aspects I have ever seen.

His complaint is that most of the shopping cart software out there is really just procedural (or bad) code shoved into classes and called good. He suggests a more patterned approach - maybe using a Factory on top of a base abstract model.

The Bakery: Setting up Eclipse to work with Cake

From The Bakery today, there’s a new tutorial that steps you through the process of getting the Eclipse software set up and working happily with a CakePHP installation.

So you’re on a noob on the quest for painless PHP development? You’ve started using Cake and now you’re considering the Eclipse Integrated Development Environment. These are two great first steps. All you need now is a little help getting to know Eclipse and configuring it for maximum effect with CakePHP. This tutorial gathers lots of information already out there, adds a bit of my own, and puts in all in one place.

They work through the installation, how to define a workspace for your project and getting the “bake” command to work directly from the local software.

Zend Developer Zone: OSCON ‘07 Wrapup

In the wake of this year’s OSCON, Cal Evans has posted his PHP-centric wrapup over on the Zend Developer Zone:

The echoes from the last OSCON parties haven’t even stopped reverberating though the halls as the next convention moves in. The vendors are all long gone and the attendees are all shoved in tiny seats on their express flight back to the real world. Let’s take a quick look over our shoulder at the party that was OSCON ‘07 before answering the call of the road and heading off to the next event.

Some of his items of note included the PHP tutorials (specifically the “PHP and MySQL Best Practices” from Luke Welling and Laura Thomson) and the many talks including one given by Andi Gutmans covering the Zend Framework and its role in a mashup involving Yahoo’s Term Extractor and Flickr.

Secunia.com: Joomla! Multiple Vulnerabilities

Secunia.com reports that multiple vulnerabilities have been found in the Joomla! content management system:

Some vulnerabilities have been reported in Joomla!, which can be exploited by malicious people to conduct session fixation attacks, cross-site scripting attacks or HTTP response splitting attacks.

The issues are marked as “less critical” but users should still update to the latest version to avoid these issues:

  • Certain unspecified input passed in com_search, com_content and mod_login is not properly sanitised before being returned to a user
  • Input passed to the “url” parameter is not properly sanitised before being returned to the user. This can be exploited to insert arbitrary HTTP headers.
  • An error exists in the handling of sessions and can be exploited to hijack another user’s session by tricking the user into logging in after following a specially crafted link.

See the original advisory post here.

Sebastian Bergmann’s Blog: Wanted: PHP Implementation of Unified Diff

Sebastian Bergmann has posted a “wanted” sign over on his blog - he’s looking for a PHP function to do two things:

  • takes two strings as its input and
  • returns a string with the differences between the two string in the same format as GNU diff would return for diff -u for two files that contain the respective strings.

Think you can help him out? Drop him a line

Sara Golemon’s Blog: Fun with unicode

Sara Golemon, being interested in Unicode as she is, decided to investigate further when she saw a recent post about issues with Unicode math symbols:

Being a whimsical sort, I decided that actually implementing his request would be more fun than simply pish-poshing it. I’m not suggesting this be part of PHP6 (I still don’t personally think it’s a good idea), but it’s a fun exercise and good for a conversation starter…

There’s several things she can now do with the special characters including dumping out the results of divisions, comparisons and fractions natively.

An Epilogue to Cryptography

This is the last part of a three-part series covering encryption and decryption with a focus on the algorithms used. If you have missed either the first or second part I encourage you to check them out before reading this part….

Refurbished and Used Networking Equipment Network Liquidators sells refurbished and used networking equipment for up to 95% off list, with a 1 year warranty. We buy and sell top brands like Cisco, Extreme, Foundry, and more. Call us for best pricing.