Damn Buggy Software!

Well, Thats that, Over the last few weeks i’m sure some people have noticed nice large lovely 500 Error messages on my blog, And i’ve finally fixed it.

Well, Sort of.

It appears to have been caused by a conflict between the Buggy PHP 5.0.5 which my Host runs, and the new HTTP API in WordPress 2.7, The solution? Well, for the past few weeks its been to manually modify some of the source to remove statements which would blow up PHP (ie. replace SITEURL with  get_option(‘siteurl’), which actually just returns SITEURL…. – Note: Thats mearly an example, and not the actual changes i’ve made)’

..Until it happened again today. Finally had enough, I fired up SSH and took a look into it:

me@host:~/www/wordpress$ php index.php
FATAL: emalloc(): Unable to allocate 3768593271 bytes
me@host:~/www/wordpress$ php index.php
Segmentation fault
me@host:~/www/wordpress$ php index.php
Segmentation fault
me@host:~/www/wordpress$ php index.php
FATAL: emalloc(): Unable to allocate 3260808055 bytes
me@host:~/www/wordpress$ php index.php
Segmentation fault

(Oh yeah.. Trying to allocate 3.2GB? I’m not supprised its failing..)

Yep.. I’ve had enough, I have switched from PHP 5.0.5 to PHP 4.4.0 and it appears to now be working.. For now.

I guess the time has come to consider moving to a new Host, I’ve been thinking about a VPS solution, At least that way i can keep up with the version of the software i *want* to use.

Any suggestions from anyone? SliceHost has been mentioned to me, And their base package would probably do for me,  Heck, Find someone else to go halves would end up paying about the same as a el-cheapo shared hosting plan each!. But other host suggestions would be good (or hey, Even a hosting offer or 2 ;) heh)

GSoC2008: “Plugin Installation via Web interface” Proposal

Following on from the Plugin upgrader, I feel it would be beneficial to also allow plugins to be installed from the wordpress web interface directly from WordPress.org

I propose to extend the API on wordpress.org to allow for plugin querying(select a list of plugins based upon tags, plugin name, and/or search term, as well as select featured, popular, or recently updated which are currently availale via a RSS feed)

As well as adding a “Plugin Install” tab on the Plugins page of WordPress.

Part of the work has been quickly scratched together on the Trac ticket by myself: http://trac.wordpress.org/ticket/6015 however was only Proof of concept, and only works with plugins which are currently delivered by a RSS Feed.

I intend on working on the ticket and submitting patches to the WordPress core code for 2.6.

I invision the plugin installation page having a set of tabbed headings accross the page(Or as a side menu) to select the area to grab plugins from, Eg:
| Featured | Popular | Recently Updated | Tagged | Search |

And a table similar to the plugins page listing a page of plugins which matches the criteria.
I would expect the page to be Paged to 50 items or so to a page to allow quick skimming of lists, as well as not having too many pages to filter through.

The Tabs would be hookable, So a plugin can add an extra plugin source, or remove a source depending on the blogs intended uses.

See Also:

Wp-hackers: Idea for a GSoC project http://groups.google.com/group/wp-hackers/browse_thread/thread/c759db798b244121/b8451c1d7b670085?lnk=gst

What new functions are in PHP x.x?

A Question was asked on the wp-hackers mailing list:

Does a map of PHP versions to available functions exist? I can look up the
PHP function reference to see which version a function appeared in, but I’m
not aware of a reverse mapping (and I must be Googling very badly today).

Posting by Jeff Waugh

Well.. I couldnt find one either, So i created a hacked-together list very quickly: http://dd32.id.au/php-functions-by-version.htm

It simply allows you to view what functions were added to a specific PHP version, This was prompted by WordPress moving to PHP 4.3+ for version 2.5 which is due out later this year.

Hopefully its of use to someone.

PHP: SimpleXML + SOAP

Recently after getting into XML parsing with PHP and realising how hard most of the functions were to use, I decided to put it down and that i was going to require PHP5 for all my projects. Great i thought, SOAP, PHP’s got a SOAPClient class!

Personally i didnt like the Soap class, I’m happy to hardcode the values i send to the server,  But i want to read the returned XML easily.

I looked around, and found SimpleXML, And i like it!, It  worked well with all the sniplets of XML i gave it.. Well, Until i actually used it on some live data!

Suddenly SimpleXML refuses to parse the SOAP reply…

Heres a example of XML SimpleXML didnt like:

[sourcecode language=”xml”]<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
<GetProviders xmlns="http://hostname/" />
</soap:Body>
</soap:Envelope>[/sourcecode]

See any problem? Looks valid to me!

The cause of it not parsing though? SimpleXML doesnt like any colons(:) in tagnames or attribute names! If its contained within the value of the tag or attribute its ok though.

So, What can i do? A Mass-replace of all colons? That’d potentially destroy my source data..

I came up with this short snipplet of PHP regular expressions to strip out any colons in the tags/attributes:

[sourcecode language=”php”]$out = preg_replace(‘|<([/\w]+)(:)|m’,’<$1′,$in);
$out = preg_replace(‘|(\w+)(:)(\w+=\")|m’,’$1$3′,$out);[/sourcecode]

The result after this has been done:

[sourcecode language=”xml”]<?xml version="1.0" encoding="utf-8"?>
<soapEnvelope xmlnsxsi="http://www.w3.org/2001/XMLSchema-instance" xmlnsxsd="http://www.w3.org/2001/XMLSchema" xmlnssoap="http://schemas.xmlsoap.org/soap/envelope/">
<soapBody>
<GetProviders xmlns="http://hostname/" />
</soapBody>
</soapEnvelope>
[/sourcecode]

As you can see, the general gyst of the document is there, and its parsable,  just without the colons where simpleXML cant handle them.