6.0.0-beta1
7/7/25

[#7959] Patch to make File_PDF work with mbstring.func_overload
Summary Patch to make File_PDF work with mbstring.func_overload
Queue Horde Framework Packages
Queue Version FRAMEWORK_3
Type Bug
State Not A Bug
Priority 2. Medium
Owners
Requester mike (at) silverorange (dot) com
Created 02/06/2009 (5995 days ago)
Due
Updated 02/06/2009 (5995 days ago)
Assigned 02/06/2009 (5995 days ago)
Resolved 02/06/2009 (5995 days ago)
Github Issue Link
Github Pull Request
Milestone
Patch Yes

History
02/06/2009 11:21:54 PM Jan Schneider Comment #5
State ⇒ Not A Bug
Reply to this comment
The mbstring extension allows working with multi-byte string
encodings. Pragmatically, using mbstring.func_overloading is the best
way to develop a UTF-8 application in PHP.
Wrong, it's an unreliable hack.
When this is not desired is when you are working with binary files or
streams. Usually in this case you want to work with bytes and not
characters. The attached patch explicitly uses bytes (the '8bit'
encoding) for string calculations in a binary context if mbstring
function overloading is enabled.
That's exactly one of the reasons why you shouldn't use overloading. 
Undesired side-effects, and yet more hacks to work around stuff being 
broken by the hack called overloading.
02/06/2009 06:17:21 PM mike (at) silverorange (dot) com Comment #4 Reply to this comment
The mbstring extension allows working with multi-byte string 
encodings. Pragmatically, using mbstring.func_overloading is the best 
way to develop a UTF-8 application in PHP.



When mbstring.func_overloading is enabled, the string functions treat 
strings a sequence of characters, not bytes. Usually, this is desired, 
as you wouldn't want to truncate a string part way through a 
multi-byte character.



When this is not desired is when you are working with binary files or 
streams. Usually in this case you want to work with bytes and not 
characters. The attached patch explicitly uses bytes (the '8bit' 
encoding) for string calculations in a binary context if mbstring 
function overloading is enabled.
02/06/2009 05:55:13 PM Jan Schneider Comment #3
State ⇒ Feedback
Reply to this comment
That doesn't make any sense. If you use function overloading, the 
string functions are already replaced by the mbstring variants. That's 
the whole purpose of that functionality, so there is no need to do 
this explicitly in wrapper methods.

Beside that, mbstring function overloading is evil and should be 
removed from the face of this earth completely.
02/06/2009 05:47:23 PM mike (at) silverorange (dot) com Comment #2
New Attachment: file-pdf-mbstring.diff Download
Reply to this comment
Patch to make File_PDF work when mbstring.func_overload is enabled.
02/06/2009 05:46:06 PM mike (at) silverorange (dot) com Comment #1
Priority ⇒ 2. Medium
Type ⇒ Bug
Summary ⇒ Patch to make File_PDF work with mbstring.func_overload
Queue ⇒ Horde Framework Packages
Milestone ⇒
Patch ⇒ Yes
State ⇒ Unconfirmed
Reply to this comment
When mbstring.func_overload is enabled, the strlen, substr and strpos 
functions get overloaded with multi-byte character versions. Since 
these functions are used to do byte calculations in File_PDF, using 
mbstring.func_overload breaks File_PDF. The attached patch makes 
File_PDF work even with mbstring.func_overload is used.

Saved Queries