Love Fuel?    Donate

FuelPHP Forums

Ask your question about FuelPHP in the appropriate forum, or help others by answering their questions.
Redis class name conflict with PHP extension in 1.5.x
  • So as the title states, it's to do with Redis, Fuel 1.5 (I know it's 1.5, I can't upgrade just yet :( ) and Redis PHP extension. The issue occurs when Redis is called globally, i.e. \Redis, as that calls the PHP extension instead of the core class. That's not really the issue though as I can simply alias it to \Fuel\Core\Redis.

    The issue I'm encountering is with extending the Redis class. The method stated here http://fuelphp.com/docs/general/extending_core.html#/extend_and_replace simply doesn't work for that particular class. I'm guessing it is because it's extending the PHP extension instead of the core class.

    Anyone stumbled upon this before? Any idea how to fix it?

    NB: I'm in no position to upgrade to Fuel 1.7 where Redis is renamed to Redis_Db, at least for now.
  • HarroHarro
    Accepted Answer
    There are two options left if you can't upgrade to 1.7:

    - disable the Redis PECL package, so you don't have a conflict anymore
    - implement the change in your 1.5 core (see https://github.com/fuel/core/commit/03a235be4ec8dfb54eb0b55c8c7fa8f9e302c821, only a few changes needed).

    It is no problem extending \Fuel\Core\Redis, as that class doesn't have any conflict. Fuel aliases the class to global, and that is where the conflict is. So you can use "\RedisMine extends \Fuel\Core\Redis" without problems, but that doesn't make the core use your RedisMine class...
  • Yeah my first thought was to implement it my self in the 1.5 core as I need the core to be using it but wondered if I there was any better solutions (other than disabling the PECL pack). I'll go with https://github.com/fuel/core/commit/03a235be4ec8dfb54eb0b55c8c7fa8f9e302c821 then.

    Thanks for the quick reply! :)

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

In this Discussion