ID: 11244
Updated by: [EMAIL PROTECTED]
Reported By: [EMAIL PROTECTED]
-Status: Open
+Status: Closed
Bug Type: *Languages/Translation
PHP Version: 4.0.5
New Comment:
Fixed in CVS.
Previous Comments:
------------------------------------------------------------------------
[2001-06-01 16:30:08] [EMAIL PROTECTED]
There's a problem with the hebrev() and hebrevc() functions (PHP 4.0.5
and earlier).
These functions convert logical Hebrew text to visual Hebrew text
(generally by byte-reversing the blocks of Hebrew letters but not of
English letters but there are a lot of gotchas).
There's a problem in the handling of the characters '[', ']','{', '}',
'<', '>': they come out reversed when they appear in a Hebrew block,
compared to the logical-to-visual algorithm used in MSIE (tested: v5
and v5.5). Specifically, text entered using MSIE edit boxes and then
hebrev()ed will have the reversal problem. Since MSIE is by far the
most popular browser for Hebrew users (due to deficient Hebrew support
in alternatives), this should be considered a bug.
The problem would occur for the normal parenthesis '(' and ')' as well,
but the current implementation of hebrev() handles this case
specifically by exchanging these characters when in a Hebrew block. The
same method will work for the '[]{}<>' characters. Note that since
exchanging should be done only in Hebrew blocks, it cannot be easily
done using the PHP code that calls hebrev() with guaranteed
consistency.
hebrev() and hebrevc() are implemented in php_hebrev in
ext/standard/string.c. The following simple patch does the character
exchanging described above. I've tested it extensively and it seems
compatible with the MSIE algorithm. However, for backward compatibility
it would be prudent to make this change in behavior only when
instructed so via an optional parameter (sorry, I don't know how to
implement this).
---------------------------------------------
*** string.c.org Fri Jun 1 22:55:21 2001
--- string.c Fri Jun 1 22:56:38 2001
***************
*** 2387,2392 ****
--- 2387,2410 ----
case ')':
*target = '(';
break;
+ case '[':
+ *target = ']';
+ break;
+ case ']':
+ *target = '[';
+ break;
+ case '<':
+ *target = '>';
+ break;
+ case '>':
+ *target = '<';
+ break;
+ case '{':
+ *target = '}';
+ break;
+ case '}':
+ *target = '{';
+ break;
default:
break;
}
---------------------------------------------
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=11244&edit=1