SWX: SWF Data Format

Icon

SWX is the native data format for Adobe Flash. This blog is about all things SWX, SWX RPC, SWX PHP and the SWX APIs (Flickr, Twitter, etc.)

PHP versions

It looks like the only reason the current release is PHP 5-only is because I'm using a single PHP 5 method (str_split, if you're interested in SWX trivia!) Unfortunately, simply replacing that with the Pear Compat version wasn't a plug-and-play solution for PHP 4 compatibility. Apparently that's wasn't the only difference. There is also a bug in how unpack() works in PHP 4 (and some versions of PHP 5) that is causing my tests to fail.

I'm looking into this now and I will post a new release (v0.1b) once I have SWX running on both PHP 4 and 5. For the moment, please test it out on a current version of PHP 5.

7 Responses

  1. I don’t fully grok SWX yet, but it should be fairly trivial to check for the availably of str_split (using function_exists) and define it yourself if it’s not there.

  2. Folkert says:

    maybe something like this will help on the str_split workaround for php4:

    if (!function_exists('str_split')) {
    function str_split($str) {
    $arr = array();
    if (is_string($str)) {
    for ($i = 0; $i

  3. Folkert says:

    hum breaks, i mail it to you

  4. Don’t forget the second optional $split_length argument. Something like this should probably do it:

    http://drewmclellan.net/code/samples/str_split.phps

  5. aral says:

    Hi guys,

    Thanks for your feedback. The problem is not with the PHP4 version str_split. The Pear Compat library has a version and there are several on the PHP man pages. The problem is the bug with unpack() not working correctly. I’m looking into that now. The str_split side of it isn’t a problem. :)

  6. Ah ok, so SWX isn’t PHP 5-only because you’re using a single PHP 5 method, it’s PHP 5 because of a bug in PHP4. Why didn’t you say so! ;)
    Sod PHP 4. Are flashers all retro PHP junkies or something? :)

  7. aral says:

    LOL! Yeah, I just updated the post to try and make it clearer. Apologies for the confusion! :)