MMcache Is Incompatible With PHP 4.3.10

  • After an upgrade of PHP to 4.3.10 and a recompile of mmcache it appears that mmcache no longer functions correctly.  I tried this on 2 Linux computers with the same results.

    A simple foreach on an associative array returns the correct number of elements but both the key and the value are empty.  For example:

      $my_array = array (
        'fruit' => 'banana',
        'meat'  => 'beef',
        'nut'   => 'peacan'

      foreach ($my_array as $k => $v) {
        echo ("key=$k, value=$v<br>");

    Should return:
    key=fruit, value=banana
    key=meat, value=beef
    key=nut, value=peacan

    But once encoded it returns:
    key=, value=
    key=, value=
    key=, value=

    I've tried with and without the new Zend Optimizer 2.5.7 and it has no impact.

    I guess this had to happen one day. PHP changes something internal that impacts mmcache. Is it now the end of mmcache? :-( Say it isn't so.

    • Thomas Seifert
      Thomas Seifert

      yeah, there were some changes which even broke older zend-optimizer versions.

      maybe you should try this without the optimizer in mmcache enabled.

      mmcache will not die. active development is being done there -> .
      maybe you should report this as a bug in this project too

    • mcog fan
      mcog fan

      Just tried that on our server with PHP 4.3.10 and it works as expected.

      • Mike Bowers
        Mike Bowers

        Yes, this and the dirname test work fine on my Apache 1.3.31 / PHP 4.3.10 / Turck MMCache 2.4.6 setup.  (I don't use 2.4.7 CVS - could that be the problem people are running into?)

    • I turned off the optimizer and restarted apache and got the same results.

      Also, tried re-encoding the script after turning off the optimizer and got a slightly different encoded  string.  Still got the same results again.  Arrays all appear empty when using a foreach loop.

      • shin seung woo
        shin seung woo

        Ok. I will check it. It's because php4 back-ported php5's foreach for performance reason.
        mmcache can work with php4/5. so, I think that's simple. but, It will take time because I'm busy.
        and, I joined eAccelerator team, so If we release
        new version for php 4.3.10, we will announce on eaccelerator's page on

        please wait a week or two.

    • Lyle Arnot
      Lyle Arnot

      That is not the only problem try:

      echo dirname(__FILE__) . "my php";

      you always get a dot: .

      that should return for my:


      any idea??

    • I'm using apache 1.3.33 / PHP 4.10 / Turck 2.4.6 on Linux (tried Gentoo and Fedora Core 2). dirname works fine on the Gentoo box (didn't try Fedora) but the foreach is broken on both.