Ask a Question related to PHP Development, Design and Development.
-
vesely at tana dot it #1
#25745 [Fbk->Opn]: Character type functions fail on negative chars
ID: 25745
User updated by: vesely at tana dot it
Reported By: vesely at tana dot it
-Status: Feedback
+Status: Open
Bug Type: *Languages/Translation
PHP Version: 4.3.2
Assigned To: moriyoshi
New Comment:
I got 817 compiling with gcc 3.2 on sun sparc solaris8,
depending on the __ctype table, results may vary.
Previous Comments:
------------------------------------------------------------------------
[2003-10-03 11:46:02] [email]moriyoshi@php.net[/email]
Hmm, please put the correct OS name you confirmed the bug with.
------------------------------------------------------------------------
[2003-10-03 11:43:40] [email]moriyoshi@php.net[/email]
Yet another casting problem :)
------------------------------------------------------------------------
[2003-10-03 11:41:03] vesely at tana dot it
Description:
------------
The upper half of the codes are badly reported, e.g
ctype_alpha("è") returns true even under C locale.
As a workaround one may call ctype_alpha(ord("è")),
which works correctly.
Alternatively, the following patch fixes that:
--- php-4.3.2/ext/ctype/ctype.c% 2003-10-03 13:13:46.870457000
+0200
+++ php-4.3.2/ext/ctype/ctype.c 2003-10-03 13:13:46.880455000 +0200
@@ -100,7 +100,7 @@
RETURN_BOOL(iswhat(Z_LVAL_P(c))); \
case IS_STRING: \
{ \
- char *p; \
+ unsigned char *p; \
int n, len; \
p=Z_STRVAL_P(c); \
len = Z_STRLEN_P(c); \
Ciao
Ale
---
below I list character type functions for
easing bug searches
ctype_alnum ctype_alpha ctype_cntrl ctype_digit
ctype_graph ctype_lower ctype_print ctype_punct
ctype_space ctype_upper ctype_xdigit
Reproduce code:
---------------
<?php
$ctype_funcs = array(
"alnum", "alpha", "cntrl", "digit",
"graph", "lower", "print", "punct",
"space", "upper", "xdigit");
$failed = 0;
reset($ctype_funcs);
while ($name = current($ctype_funcs)) {
$test = "\$failed += (
(ctype_$name(%d) ? 1 : 0) !=
(ctype_$name(chr(%d)) ? 1 : 0)
) ? 1 : 0;";
for ($i = 0; $i < 256; ++$i)
eval(sprintf($test, $i, $i));
next($ctype_funcs);
}
print "$failed";
?>
Expected result:
----------------
0
Actual result:
--------------
817
------------------------------------------------------------------------
--
Edit this bug report at [url]http://bugs.php.net/?id=25745&edit=1[/url]
vesely at tana dot it Guest
-
Problem with character palette and Tracking field: can't type zero after type is modified
System: Illustrator CS, Panther 10.3.3 Try this: Create a few characters of type. Select some letters and change their tracking (Option + Command... -
#25745 [Opn->Csd]: Character type functions fail on negative chars
ID: 25745 Updated by: moriyoshi@php.net Reported By: vesely at tana dot it -Status: Open +Status: ... -
#25745 [Asn->Fbk]: Character type functions fail on negative chars
ID: 25745 Updated by: moriyoshi@php.net Reported By: vesely at tana dot it -Status: Assigned +Status: Feedback Bug Type: ... -
#25745 [Opn->Asn]: Character type functions fail on negative chars
ID: 25745 Updated by: moriyoshi@php.net Reported By: vesely at tana dot it -Status: Open +Status: Assigned Bug Type: ... -
#25745 [NEW]: Character type functions fail on negative chars
From: vesely at tana dot it Operating system: PHP version: 4.3.2 PHP Bug Type: *Languages/Translation Bug description: ...



Reply With Quote

