From 8ff24e8728912c633bb389383bb2477badc9912b Mon Sep 17 00:00:00 2001 From: Dmitry Stogov Date: Fri, 29 Jun 2007 14:53:02 +0000 Subject: [PATCH] ord() must not convert binary data to unicode in unicode mode --- ext/standard/string.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/ext/standard/string.c b/ext/standard/string.c index a2715c412f..718a64b2ef 100644 --- a/ext/standard/string.c +++ b/ext/standard/string.c @@ -3613,7 +3613,9 @@ PHP_FUNCTION(ord) WRONG_PARAM_COUNT; } - convert_to_text_ex(str); + if (Z_TYPE_PP(str) != IS_UNICODE && Z_TYPE_PP(str) != IS_STRING) { + convert_to_text_ex(str); + } if (Z_TYPE_PP(str) == IS_UNICODE) { RETURN_LONG(zend_get_codepoint_at(Z_USTRVAL_PP(str), Z_USTRLEN_PP(str), 0)); } else { -- 2.50.1