Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:46030 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 76635 invoked from network); 12 Nov 2009 12:34:12 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 12 Nov 2009 12:34:12 -0000 Authentication-Results: pb1.pair.com smtp.mail=yoarvi@gmail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=yoarvi@gmail.com; sender-id=pass; domainkeys=bad Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.216.179 as permitted sender) DomainKey-Status: bad X-DomainKeys: Ecelerity dk_validate implementing draft-delany-domainkeys-base-01 X-PHP-List-Original-Sender: yoarvi@gmail.com X-Host-Fingerprint: 209.85.216.179 mail-px0-f179.google.com Received: from [209.85.216.179] ([209.85.216.179:64069] helo=mail-px0-f179.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 99/E9-08668-2C00CFA4 for ; Thu, 12 Nov 2009 07:34:11 -0500 Received: by pxi9 with SMTP id 9so428473pxi.16 for ; Thu, 12 Nov 2009 04:34:08 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:date:message-id:subject :from:to:content-type:content-transfer-encoding; bh=X0RSw/XvyZrjNE0YZufRJiRkivZJFIaXf/JCI+oMyHs=; b=Pzlv/4SqYs05k6tFiNcJ7IsRZjxQM23wM9h9hPz95QG9ucNfgfWV0XbwuIO62IG5l7 75wqLt9i6M+83kTndTBV8/UOUxQ7M2t4bmqs3SJNBBmzm16storIxzfhEwPX48KZUlma YeQDFt5nA8pcB5zM0WZ3zMlgpbsOyNLlCNDPc= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:date:message-id:subject:from:to:content-type :content-transfer-encoding; b=tZvWhw6yHcDZyMKDyOBgXnYvUMCAia1NmmiEOgBE0rqjyWXOH7alSeZPx7Em3ieXyI yUKlLt2zvUg4h5CjLmoT50JNYFKwUy0RKq0Oa0TJeoMFf0FmIEzAG2Rcq0A/VVsCHHy/ 0XB20HWVAFzheEX9IBIZ17gqjNI3maQrvDSI8= MIME-Version: 1.0 Received: by 10.142.75.16 with SMTP id x16mr308787wfa.155.1258029248082; Thu, 12 Nov 2009 04:34:08 -0800 (PST) Date: Thu, 12 Nov 2009 18:04:08 +0530 Message-ID: To: internals@lists.php.net Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Subject: [PATCH] - Change how zstr values are passed to varags functions that use %v/%R (for PHP6) From: yoarvi@gmail.com (Arvind Srinivasan) When running 'gmake test' on my PHP6 tree on Solaris 10 (SPARC), I noticed that a number of test failures were caused by the presence of non-ASCII characters in function names etc. For example: sapi/cli/php tests/classes/__set__get_001.php Setting [a] to 100 OK! Getting [a] Returning: 100 Setting [a] to 101 OK! Getting [z] Nothing! Setting [z] to 1 Not OK! object(=EF=BF=BD=EF=BF=BD=EF=BF=BD=EF=BF=BD=EF=BF=BDf=EF=BF=BD=EF=BF=BD=EF= =BF=BD)#1 (2) { [u"n"]=3D> int(1) [u"x"]=3D> array(3) { [u"a"]=3D> int(101) [u"b"]=3D> int(2) [u"c"]=3D> int(3) } } The problem seems to be with how zstr values are passed to varargs function= s. Taking the above example, the following code in ext/standard/var.c is what prints the line that is supposed to contain "object(setter)#1 (2) {". php_printf("%sobject(%v)#%d (%d) {\n", COMMON, class_name, Z_OBJ_HANDLE_PP(struc), myht ? zend_hash_num_elements(myht) : 0); where class_name is declared as zstr class_name; php_printf calls vspprintf which calls xbuf_format_converter which retrieves the value of class_name using UChar *u; u =3D va_arg(ap, UChar *); The Sun Studio compilers don't seem to like it when a vararg is passed as a zstr union and then retrieved as a (UChar *). Specifying class_name.v instead of class_name to php_printf fixes the problem. This doesn't seem to be a problem on Ubuntu/gcc. I searched for all occurrences of %v and %R in the PHP6 tree and added a .v to all the zstr values passed to those functions. The patch is here - http://bitbucket.org/arvi/arviq/src/tip/svn-zstr-varargs-patch.txt Please could someone take a look and let me know if this is correct. If so, then I'll do the same for %r as well. Thanks, Arvi