INI reader breaks when mbstring function overloading is in place #4571

Closed
weierophinney opened this Issue May 31, 2013 · 8 comments

Projects

None yet

3 participants

@weierophinney
Zend Framework member

Given an INI file like the following:

[example]

foo = bar

If the mbstring function overloading (http://us3.php.net/manual/en/mbstring.overload.php) is enabled, Zend\Config\Reader\Ini will raise an error in the method processKey() at some point, indicating that the third argument, $config expects an array but was passed a string. Most likely, this is from the last line of the if conditional in processKey(), which passes what should be a sub-array of configuration.

@DASPRiD DASPRiD was assigned May 31, 2013
@DASPRiD
Zend Framework member

I'm 99% certain that we don't support mbstring overloading for ZF2 (basically as it breaks any kind of strlen() where the byte length is expected).

@weierophinney
Zend Framework member

@DASPRiD We've never stated that fact, however, and for many, this is their approach to unicode. I'm curious if it's something we can fix easily or not; if it means a rewrite, however, we can make a note in the README or elsewhere.

@DASPRiD
Zend Framework member

we'd have to replace all strlen() calls in ZF2 with iconv_strlen() (or the wrapper of it), telling it to use the ASCII-charset. Surely, this would be a huge slowdown.

@DASPRiD
Zend Framework member

By the way, this is also valid for substr(), which can be overloaded as well.

@DASPRiD
Zend Framework member

Just for the record, the following functions are affected as well and would have to be exchanged when byte-work is required (which surely is in all used places, else iconv/mbstring would have been used there):

  • strlen()
  • strpos()
  • strrpos()
  • substr()
  • strtolower()
  • strtoupper()
  • stripos()
  • strripos()
  • strstr()
  • stristr()
  • strrchr()
  • substr_count()

Disclaimer: I didn't list deprecated or unused functions.

@marc-mabe
Zend Framework member

we already disused it here http://zend-framework-community.634137.n4.nabble.com/Environment-amp-StringUtils-td4559272.html
-> no support for overloaded functions

@DASPRiD
Zend Framework member

@marc-mabe Thanks for the link, I couldn't remember where we discussed that.

@weierophinney
Zend Framework member

Excellent -- now we have the full record, I can close this as "won't fix."

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment