Dynamically Typed: First Signs of a COM for PHP
470718
In a new posting from Harry on Dynamically Typed today, he talks about PHP showing the first signs of a COM for PHP.
469846
An exploit for PHP's COM objects on the 5.x series has been reported by shinnai - an issue that allows for a bypass of safe_mode and disable_function settings.   The exploit has been published as a PHP file for easy testing on your Windows/PHP installation (it was tested on WinXP Pro SP2 on both the CLI and Apache). No additional modules are needed for this exploit - only the COM functions and a Windows system.   The issue comes from an overflow in the str_repeat function allowing for the execution of whatever applications the developer wants on the remote Windows machine (including the ability to create and remove files and directories). There is no path for this issue currently (should be corrected in the next minor PHP release).
389521
Time for a little nostalgia today in this new post from Philip Olson looking back at a brief history of the PHP acronym - where it came from and how it evolved to mean "PHP: Hypertext Preprocessor".   While reminiscing what PHP was like back in the early early years, I stumbled upon a little historical nugget from the old website. Do you know what the acronym PHP stands for? Many of us do, or think we do. [...] But how was the definition chosen? For fun, here's a look back at the official vote that determined this new meaning way back in 1998. It might be worth mentioning that Rasmus, the father of PHP, did not vote for the eventual winner.   He also includes a few "notable quotes that could be taken out of context" from Rasmus Lerdorf concerning his opinions on the matter of the acronym's meaning as well as some other brief notes on the history of PHP and its name change.
217574
As mentioned by Ed Finkler, there's a list of signs your PHP needs refactoring from Soledad Penades.    I have had to go through a php application recently which has given me more than one headache and has required me to use all my possible patience. While working with it, I thought This is good material for an article, so that nobody else does the same in the future, and nobody else will need to experience the same displeasure as I have had to.   So here are the signs your PHP application needs a serious refactoring, right now    Included in the list are things like:   Uses global variables Everything's an array The neverending switch Interface inconsistency   It hits on one of the thing that bugs me too, the problem of "Brackets galore" - so many subarrays that you have to resort to three or more sets of bracketed keys to get to the value you want. It's bad enough trying to follow someone else's code without having to "trace down" an array to figure out which of the values they're talking about.
124693
Jared White has posted another Willowgarden highlight to his blog today, this time with a focus on the processing of form input.   In the bad old days of processing forms and saving each field to a column in a database row, you'd have to do a lot of manual gruntwork: accessing each field from the $_POST superglobal, checking the values, constructing the SQL query, connecting to the database and executing the query, and so forth. Wouldn't it be great if you could just import the form right into an object, and let it do the validation and the database saving based on just a few simple rules? Let's take a quick look at how that might work.   He shows how to make an instance of the WFFormCreator class in a simple script and add actions to it to handle the successful submission and the errors that might come up.
82198
Knut Urdalen shares a note about the latest issue of the International PHP Magazine - the December 2007 issue - that he has an article in.   The December issue of International PHP Magazine includes my latest article "Seamless AJAX with PRADO - An introduction to ActiveControls". In this article I discuss some AJAX design patterns and show you how to make use of them in AJAX enabled components that ships with the PRADO framework.   More information about this issue (and subscribing to the International PHP Magazine) can be found on this page of their site and details on the PRADO framework are over on the project's website.
14108
On the SitePoint PHP Blog today, Troels Knak-Nielsen has written up a post concerning the current state of functional programming in PHP.   With the rise of Javascript, and languages like Python and Ruby, functional programming is becoming more mainstream. Even Java seems to be getting closures in the next version, so does this leave PHP lacking behind or is there an unrealized potential hidden within?   He looks at a few different aspects of functional programming and sees how well PHP fits into them (like dynamic dispatch, binding a variable to a function and an implementation of currying for a function). This last option is the only "true" functional feature that PHP can realistically handle.
634435
Andrei Zmievski has posted something new to his blog today about a feature of PHP6 that's finally been hammered down - HTTP input (request) decoding.   There have been no fewer than 4 different proposals floated before, but this one combines flexibility, performance, intuitiveness, and minimal architectural changes, and has only a couple of small drawbacks. Let's take a closer look.   He details the functionality - what it is, what's been decided on, and the advantages of the method. The basic approach is a "lazy" one where PHP will only store the request when it comes in, no filtering or anything, until you want to do something with it (i.e. get it via $_GET, $_POST, etc). When the request for data is made, PHP looks at the encoding settings and formats the data accordingly.   Advantages he mentions for this method include removing the guess-work on PHP's part for which encoding the request is and that it removes some of the overhead by not processing the data until it's actually needed.
86204
From SitePoint.com today, there's a new piece entitled Introducing PHP 5's Standard Library. It goes into some detail about an extension that snuck in the back of the PHP world - the Standard PHP Library.
563255
Harry Fuecks is back today on the SitePoint PHP Blog with part two of his "joy of regular expressions" series, continuing on from this previous entry.   He jumps right in, summarizing the first part in a small section before getting back into the examples:  Hunting for .jp(e)gs Escaping Meta-Characters Search and Replace preg_quote() preg_replace() Word Boundaries, Word Characters...and everything else Sub patterns Spot the XSS Hole eval() is evil! preg_replace_callback()  As you can see, it's crammed with just as much infromation as the first part and covers a wide range of topics to help you get more in tune with your inner regular expression guru.
246976
On the SitePoint PHP blog, there's a quick tutorial from Troels Knak-Nielsen about the creation and use of dynamic global functions in your PHP application:   Like many others, I prefer to use procedural PHP as a template language. While PHP's syntax makes it a practical choice for this, there is a problem with embedding dynamic content. [...] A single letter, regular function is undoubtedly the simplest way to extend PHP's syntax. Thinking about it, it's fairly obvious, but it just never occurred to me. [...] There is a problem though; Since this is such a good name for a function, chances are that someone else would use it for something different, or perhaps even for the same.   As a more viable solution, he recommends going dynamic and creating fumctions (via the call_user_func_* functions) and an addition to the $GLOBALS superglobal to make calling the custom function simpler.
703914
On his blog, Stuart Herbert has a quick tip showing how to mimic a feature of Ruby on Rails:   I'm still working on the next article in my series looking at PHP on servers, so in the mean time, check out this simple way to emulate Ruby's nice way of handling separate getter, setter and state query methods in PHP.   He admits his example isn't as elegant as the Ruby method, but it does get the job done. Code for the method is included in his post ready for cut and pasting.
407104
If you've been looking for more information on the phpAspect project but have been sad to note it having fallen by the wayside, you'll be happy to know that Willliam Candillon is alive and well and so is the project!   The first news concerns the windows developers, the windows build of PHP_Parse_Tree is finally available (click here to download)! [...] The second news is that my proposal "phpAspect eclipse plugin" for the Google Summer of Code 2007 under the mentoring of Gilles Vanwormhoudt has been accepted!   Be sure to keep an eye on the project's website and their Summer of Code page to keep up with the latest.
148300
On Greg Beaver's blog today, there's his look at string comparison with the "equals equals" (==) operator in PHP and some issues he found around it.    Recently, an obscure detail in the way PHP processes strings came to my attention in the form of an endless loop occasionally found in phpDocumentor's parsing of a file.   This is processed by code that checks for simple lists (like 1. blah 2. blah, or - blah - blah, etc.). However, an innocent call to in_array($x, array('1.', '0.')) had surprising and unexpected results: our friendly PHP determined that '01' was in the array('1.', '0.')!! This is of course patently false, and made little to no sense until I realized that unlike my previous understanding (when comparing an integer to a string, the string is converted to an integer), PHP actually converts all numeric-like strings into integers when comparing them.    To help avoid these kinds of situations repeating themselves, he makes a few suggestions when comparing your values: "use === instead of ==", "use the third parameter in in_array, set to true", and "use strcmp() or one of its cousins". In his opinion, though, this kind of auto-conversion is a bit dangerous - bit it's all about perspective...
418285
Apparently PHP5 RC3 is going to be the last release candidate. This is supposed to be coming out at the end of this week, so PHP5 will probably be released next month.  It's a bit like looking through a window into a candy store. The sweetener I most look forward to is the improved object assignment semantics.
579233
Ed Finkler has pointed out a handy resource for those trying to cope with using the UTF-8 support included in several of PHP's functions - this page on the Web Application Component Toolkit wiki.   This page is intended as a reference for functionality PHP provides which can either help with handling UTF-8 or should be regarded as a risk when used in conjunction with UTF-8 encoded strings. Further information can be found on the Internationalization (I18N) and Character Sets / Character Encoding Issues pages.   It talks about the "dangerous" functionality PHP has (issues that the language has in current functions) when using things like the PCRE extension, the string extension, the array methods, handling variables, the XML extensions (DOM and SAX), image manipulation, and URL parsing functionality.
187716
This month's edition of PHP Magazine has been released!