Zend Framework

Zend_Cache::factory() denies creation of Zend_Cache_Backend_TwoLevels backend on Linux

Details

  • Type: Docs:  Problem Docs: Problem
  • Status: Resolved Resolved
  • Priority: Minor Minor
  • Resolution: Fixed
  • Affects Version/s: None
  • Fix Version/s: 1.9.2
  • Component/s: Zend_Cache
  • Labels:
    None
  • Fix Version Priority:
    Should Have

Description

Due to its name sanitation in Zend_Cache::_normalizeName() Zend_Cache::factory() does not allow the creation of a Zend_Cache_Backend_TwoLevels backend on Linux systems (case-sensitive filenames) as Zend_Cache::_normalizeName() normalizes the string "TwoLevels" into "Twolevels" resulting in an include of "Zend/Cache/Backend/Twolevels.php" which fails on case-sensitive operating systems.

The currect hack is to set $customBackendNaming to true and use "Zend_Cache_Backend_TwoLevels" as the $backendName.

The fix should be no problem because the strtolower()-call in line 219 of Zend/Cache.php is not really necessary - although I suspect that this change will break backwards-compatibility.

Activity

Hide
Fabien MARTY added a comment -

as said in the online manual for ZendPlatform or ZendServer backend, you have to add a separator in the backend name (for example "Two Levels" instead of "TwoLevels")

so I change the issue into a documentation improvement (it's not explicitly said for this this particular backend)

Show
Fabien MARTY added a comment - as said in the online manual for ZendPlatform or ZendServer backend, you have to add a separator in the backend name (for example "Two Levels" instead of "TwoLevels") so I change the issue into a documentation improvement (it's not explicitly said for this this particular backend)
Hide
Stefan Gehrig added a comment -

Thanks Fabien.

Even if this is mentioned in the documentation, I'll consider this a "dirty" hack just to circumvent the real problem with the strtolower(). I actually can not think of a use-case where this strtolower() will be of any benefit at all besides compensating for sloppy coding. If I didn't break BC, I wouldn't see any problem removing this function-call.

Show
Stefan Gehrig added a comment - Thanks Fabien. Even if this is mentioned in the documentation, I'll consider this a "dirty" hack just to circumvent the real problem with the strtolower(). I actually can not think of a use-case where this strtolower() will be of any benefit at all besides compensating for sloppy coding. If I didn't break BC, I wouldn't see any problem removing this function-call.
Hide
Ilya Gruzinov added a comment -

I use "Two_Levels" as backend name for Zend_Cache::factory(). All works fine.

Show
Ilya Gruzinov added a comment - I use "Two_Levels" as backend name for Zend_Cache::factory(). All works fine.
Hide
Fabien MARTY added a comment -

change Assignee because I'm inactive now

Show
Fabien MARTY added a comment - change Assignee because I'm inactive now
Hide
Satoru Yoshida added a comment -

Is this only document issue now?
if so, I can add an example how to use into the document.
But if needs modify code, sadly ,I could not.

$cache = Zend_Cache::factory('Core', 'Two Levels');
Show
Satoru Yoshida added a comment - Is this only document issue now? if so, I can add an example how to use into the document. But if needs modify code, sadly ,I could not.
$cache = Zend_Cache::factory('Core', 'Two Levels');
Hide
Stefan Gehrig added a comment -

Currently I'd say we could live with an explicit remark in the manual.

Generally I think this is rather a code-issue. I'd be nice if you could at least change the manual to include an appropriate remark.

Show
Stefan Gehrig added a comment - Currently I'd say we could live with an explicit remark in the manual. Generally I think this is rather a code-issue. I'd be nice if you could at least change the manual to include an appropriate remark.
Hide
Satoru Yoshida added a comment -

Hi, Stefan, thank You for comment.

I added the example to document at SVN r 17717, so I change the issue type from the Docs: Improvement to bug.

Show
Satoru Yoshida added a comment - Hi, Stefan, thank You for comment. I added the example to document at SVN r 17717, so I change the issue type from the Docs: Improvement to bug.
Hide
Satoru Yoshida added a comment -

Hi, Stefan.

I tried step by step debugging over Zend_Cache_Backend class.

If we would use words that contains space mark or another mark like as ""Two Levels",
I find we could get TwoLevels.php.

So, I close it as solved in next mini release, Docs:problem.

Show
Satoru Yoshida added a comment - Hi, Stefan. I tried step by step debugging over Zend_Cache_Backend class. If we would use words that contains space mark or another mark like as ""Two Levels", I find we could get TwoLevels.php. So, I close it as solved in next mini release, Docs:problem.

People

Vote (0)
Watch (0)

Dates

  • Created:
    Updated:
    Resolved: