Skip to content
This repository has been archived by the owner on Jan 8, 2020. It is now read-only.

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

Closed
weierophinney opened this issue May 31, 2013 · 8 comments
Closed
Assignees
Milestone

Comments

@weierophinney
Copy link
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.

@ghost ghost assigned DASPRiD May 31, 2013
@DASPRiD
Copy link
Member

DASPRiD commented May 31, 2013

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
Copy link
Member Author

@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
Copy link
Member

DASPRiD commented May 31, 2013

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
Copy link
Member

DASPRiD commented May 31, 2013

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

@DASPRiD
Copy link
Member

DASPRiD commented May 31, 2013

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
Copy link
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
Copy link
Member

DASPRiD commented Jun 1, 2013

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

@weierophinney
Copy link
Member Author

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

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants