Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:32949 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 14515 invoked by uid 1010); 24 Oct 2007 03:26:18 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 14500 invoked from network); 24 Oct 2007 03:26:18 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 24 Oct 2007 03:26:18 -0000 Authentication-Results: pb1.pair.com header.from=andrei@gravitonic.com; sender-id=unknown Authentication-Results: pb1.pair.com smtp.mail=andrei@gravitonic.com; spf=permerror; sender-id=unknown Received-SPF: error (pb1.pair.com: domain gravitonic.com from 204.11.219.139 cause and error) X-PHP-List-Original-Sender: andrei@gravitonic.com X-Host-Fingerprint: 204.11.219.139 mail.lerdorf.com Received: from [204.11.219.139] ([204.11.219.139:44847] helo=mail.lerdorf.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 8F/40-09947-85BBE174 for ; Tue, 23 Oct 2007 23:26:17 -0400 Received: from [192.168.11.21] (c-71-202-45-81.hsd1.ca.comcast.net [71.202.45.81]) (authenticated bits=0) by mail.lerdorf.com (8.14.1/8.14.1/Debian-11) with ESMTP id l9O3PoZl010079; Tue, 23 Oct 2007 20:26:13 -0700 In-Reply-To: <47152024.4010904@oracle.com> References: <47152024.4010904@oracle.com> Mime-Version: 1.0 (Apple Message framework v752.2) Content-Type: text/plain; charset=US-ASCII; delsp=yes; format=flowed Message-ID: <0769F289-1C79-4F89-A995-C1EAAB345968@gravitonic.com> Cc: PHP Internals List , Sara Golemon Content-Transfer-Encoding: 7bit Date: Tue, 23 Oct 2007 20:25:48 -0700 To: Christopher Jones X-Mailer: Apple Mail (2.752.2) X-Virus-Scanned: ClamAV 0.91.2/4580/Tue Oct 23 16:55:29 2007 on colo.lerdorf.com X-Virus-Status: Clean Subject: Re: [PHP-DEV] Using OnUpdateUTF8String in PHP 6 From: andrei@gravitonic.com (Andrei Zmievski) Seems fine to me. Sara? -Andrei http://10fathoms.org/vu - daily photoblog On Oct 16, 2007, at 1:33 PM, Christopher Jones wrote: > > With thanks to Sara we looked at OnUpdateUTF8String to access a > php.ini value in OCI8 in PHP 6. > > One of our engineers sent me a proposed patch for zend_ini.c in PHP6 > to allow OnUpdateUTF8String to work as he thought it should. Any > comments? > > Chris > > ------------ > > > The problems I faced when unicode.semantics=On were: > > > > 1) Any OnUpdateUTF8String php.ini variable is seen as NULL in > > oci_globals. > > > > 2) If the above is resolved, the memory of the variable is wiped > out, > > by the time we come to execution of the script, after module inits. > > > > 3) We still convert to UTF-16 when unicode.semantics=Off. > > PS. Patch is attached - if it gets through. > > -- > Christopher Jones, Oracle > Email: christopher.jones@oracle.com Tel: +1 650 506 8630 > Blog: http://blogs.oracle.com/opal/ Free PHP Book: http:// > tinyurl.com/f8jad > --- zend_ini.c 2007-10-02 11:07:32.000000000 -0700 > +++ zend_ini.c.new 2007-10-16 13:20:03.000000000 -0700 > @@ -640,7 +640,8 @@ > > ZEND_API ZEND_INI_MH(OnUpdateUTF8String) /* {{{ */ > { > - UChar **p; > + UChar **up; > + char **p; > UChar *ustr = NULL; > int32_t ustr_len, capacity; > UErrorCode status = U_ZERO_ERROR; > @@ -651,30 +652,37 @@ > > base = (char *) ts_resource(*((int *) mh_arg2)); > #endif > + /* Convert only if unicode semantics is on. Otherwise, same as > OnUpdateString */ > + if (UG(unicode)){ > + /* estimate capacity */ > + capacity = (new_value_length > 2) ? ((new_value_length >> 1) + > (new_value_length >> 3) + 2) : new_value_length; > + > + while (1) { > + ustr = peurealloc(ustr, capacity+1, 1); > + u_strFromUTF8(ustr, capacity+1, &ustr_len, new_value, > new_value_length, &status); > + if (status == U_BUFFER_OVERFLOW_ERROR || status == > U_STRING_NOT_TERMINATED_WARNING) { > + capacity = ustr_len; > + status = U_ZERO_ERROR; > + } else { > + break; > + } > + } > > - /* estimate capacity */ > - capacity = (new_value_length > 2) ? ((new_value_length >> 1) + > (new_value_length >> 3) + 2) : new_value_length; > - > - while (1) { > - ustr = eurealloc(ustr, capacity+1); > - u_strFromUTF8(ustr, capacity, &ustr_len, new_value, > new_value_length, &status); > - if (status == U_BUFFER_OVERFLOW_ERROR) { > - capacity = ustr_len; > - status = U_ZERO_ERROR; > - } else { > - break; > + if (U_FAILURE(status)) { > + zend_error(E_WARNING, "Could not convert UTF-8 INI value to > Unicode"); > + efree(ustr); > + return FAILURE; > } > - } > > - if (U_FAILURE(status)) { > - zend_error(E_WARNING, "Could not convert UTF-8 INI value to > Unicode"); > - efree(ustr); > - return FAILURE; > - } > + up = (UChar **) (base+(size_t) mh_arg1); > > - p = (UChar **) (base+(size_t) mh_arg1); > + *up = ustr; > + } > + else { /* Same as OnUpdateString */ > + p = (char **) (base+(size_t) mh_arg1); > > - *p = ustr; > + *p = new_value; > + } > return SUCCESS; > } > /* }}} */ > > -- > PHP Internals - PHP Runtime Development Mailing List > To unsubscribe, visit: http://www.php.net/unsub.php