derick          Thu Sep  8 10:07:42 2005 EDT

  Modified files:              
    /php-src/ext/standard       string.c 
  Log:
  - Make ord() work on binary strings too.
  
  
http://cvs.php.net/diff.php/php-src/ext/standard/string.c?r1=1.480&r2=1.481&ty=u
Index: php-src/ext/standard/string.c
diff -u php-src/ext/standard/string.c:1.480 php-src/ext/standard/string.c:1.481
--- php-src/ext/standard/string.c:1.480 Thu Sep  8 08:40:00 2005
+++ php-src/ext/standard/string.c       Thu Sep  8 10:07:40 2005
@@ -18,7 +18,7 @@
    +----------------------------------------------------------------------+
  */
 
-/* $Id: string.c,v 1.480 2005/09/08 12:40:00 dmitry Exp $ */
+/* $Id: string.c,v 1.481 2005/09/08 14:07:40 derick Exp $ */
 
 /* Synced with php 3.0 revision 1.193 1999-06-16 [ssb] */
 
@@ -2902,8 +2902,12 @@
        if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &str) == FAILURE) 
{
                WRONG_PARAM_COUNT;
        }
-       convert_to_text_ex(str);
 
+       if (Z_TYPE_PP(str) == IS_BINARY) {
+               RETURN_LONG((unsigned char) Z_STRVAL_PP(str)[0]);
+       }
+
+       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 {

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to