Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:39485 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 26004 invoked from network); 30 Jul 2008 20:20:58 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 30 Jul 2008 20:20:58 -0000 Authentication-Results: pb1.pair.com smtp.mail=steph@php.net; spf=unknown; sender-id=unknown Authentication-Results: pb1.pair.com header.from=steph@php.net; sender-id=unknown Received-SPF: unknown (pb1.pair.com: domain php.net does not designate 64.99.136.144 as permitted sender) X-PHP-List-Original-Sender: steph@php.net X-Host-Fingerprint: 64.99.136.144 smtprelay-virgin0144.hostedemail.com Linux 2.5 (sometimes 2.4) (4) Received: from [64.99.136.144] ([64.99.136.144:48933] helo=smtprelay-virgin.hostedemail.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id D2/B3-60483-82DC0984 for ; Wed, 30 Jul 2008 16:20:57 -0400 Received: from filter.hostedemail.com (ff-bigip1 [10.5.19.254]) by smtprelay05.hostedemail.com (Postfix) with SMTP id 8523F35E8F6; Wed, 30 Jul 2008 20:20:54 +0000 (UTC) X-SpamScore: 1 X-Spam-Summary: 2,0,0,3d209e35e7444891,8ff5da02447e6ede,steph@php.net,,RULES_HIT:355:379:539:540:541:542:543:567:599:601:871:946:973:982:988:989:1000:1155:1156:1260:1308:1309:1313:1314:1345:1437:1515:1516:1518:1535:1539:1575:1587:1594:1683:1711:1730:1747:1764:1766:1792:2073:2075:2078:2393:2559:2562:3027:3352:3622:3865:3866:3867:3869:3870:3871:3872:3874:4250:5007:6261:7281:7653:7862:7875:7903,0,RBL:none,CacheIP:none,Bayesian:0.5,0.5,0.5,Netcheck:none,DomainCache:0,MSF:not bulk,SPF:,MSBL:none,DNSBL:none X-session-marker: 73746570682E666F78 Received: from foxbox (77-97-189-167.cable.ubr07.shef.blueyonder.co.uk [77.97.189.167]) (Authenticated sender: steph.fox) by omf11.hostedemail.com (Postfix) with ESMTP; Wed, 30 Jul 2008 20:20:53 +0000 (UTC) Message-ID: <034001c8f281$f75624e0$a7bd614d@foxbox> To: =?Windows-1252?Q?Johannes_Schl=FCter?= Cc: "internals" References: <01fc01c8f244$6215c170$a7bd614d@foxbox> <1217427242.5408.11.camel@goldfinger.johannes.nop> <024501c8f25c$1e7c6140$a7bd614d@foxbox> Date: Wed, 30 Jul 2008 21:22:16 +0100 MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="----=_NextPart_000_033D_01C8F28A.57796000" X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 6.00.2900.2180 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2180 Subject: Re: [PHP-DEV] env vars in HEAD/proc_open() issue? From: steph@php.net ("Steph Fox") ------=_NextPart_000_033D_01C8F28A.57796000 Content-Type: text/plain; format=flowed; charset="Windows-1252"; reply-type=response Content-Transfer-Encoding: 7bit Hi again, > I have it working here now, but whether that's just because the test suite > script's set to ISO-8859-1/UTF-8 I don't know... Patch attached in case anyone wants to mess about with it (nb 'ware DOS). It's nothing like commit-able, I was just fiddling, since having a third of our tests failing in HEAD poses a major problem when trying to maintain cross-version compatibility. I found a problem with running zend_hash_find() on the env vars resulting from this patch. I think this is probably because the returned keys are unicode but the data is binary? Outside of that issue, which *might* not be related anyway, 'it works on my box'. - Steph ------=_NextPart_000_033D_01C8F28A.57796000 Content-Type: text/plain; format=flowed; name="dubious_patch.txt"; reply-type=response Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename="dubious_patch.txt" Index: ext/standard/proc_open.c =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D RCS file: /repository/php-src/ext/standard/proc_open.c,v retrieving revision 1.63 diff -u -r1.63 proc_open.c --- ext/standard/proc_open.c 23 Jul 2008 11:24:35 -0000 1.63 +++ ext/standard/proc_open.c 30 Jul 2008 19:02:53 -0000 @@ -75,13 +75,12 @@ { zval **element; php_process_env_t env; - zstr string_key; - char *data; + zstr zstr_key; + char *string_key, *data, *p; #ifndef PHP_WIN32 char **ep; #endif - char *p; - uint string_length, cnt, l, sizeenv=3D0, el_len; + uint zstr_length, cnt, l, sizeenv=3D0, el_len; ulong num_key; HashTable *target_hash; HashPosition pos; @@ -120,12 +119,20 @@ =09 sizeenv +=3D el_len+1; =09 - switch (zend_hash_get_current_key_ex(target_hash, &string_key, = &string_length, &num_key, 0, &pos)) { + switch (zend_hash_get_current_key_ex(target_hash, &zstr_key, = &zstr_length, &num_key, 0, &pos)) { + case HASH_KEY_IS_UNICODE: + if (zstr_length =3D=3D 0) { + continue; + } + spprintf(&string_key, 0, "%v", zstr_key); + sizeenv +=3D strlen(string_key)+1; + break; case HASH_KEY_IS_STRING: - if (string_length =3D=3D 0) { + if (zstr_length =3D=3D 0) { continue; } - sizeenv +=3D string_length+1; + string_key =3D zstr_key.s; + sizeenv +=3D strlen(string_key)+1; break; } } @@ -138,8 +145,13 @@ for (zend_hash_internal_pointer_reset_ex(target_hash, &pos); zend_hash_get_current_data_ex(target_hash, (void **) &element, &pos) = =3D=3D SUCCESS; zend_hash_move_forward_ex(target_hash, &pos)) { - =09 - convert_to_string_ex(element); + + if (Z_TYPE_PP(element) =3D=3D IS_UNICODE) { + zval_unicode_to_string(*(element) TSRMLS_CC); + } else { + convert_to_string_ex(element); + } + el_len =3D Z_STRLEN_PP(element); =09 if (el_len =3D=3D 0) { @@ -147,16 +159,31 @@ } =09 data =3D Z_STRVAL_PP(element); - switch (zend_hash_get_current_key_ex(target_hash, &string_key, = &string_length, &num_key, 0, &pos)) { + + switch (zend_hash_get_current_key_ex(target_hash, &zstr_key, = &zstr_length, &num_key, 0, &pos)) { + case HASH_KEY_IS_UNICODE: + if (zstr_length =3D=3D 0) { + continue; + } + spprintf(&string_key, 0, "%v", zstr_key); + l =3D zstr_length + el_len + 1; + memcpy(p, string_key, zstr_length + 1); + strcat(p, "=3D"); + strcat(p, data); +#ifndef PHP_WIN32 + *ep =3D p; + ++ep; +#endif + p +=3D l; + break; case HASH_KEY_IS_STRING: - if (string_length =3D=3D 0) { + if (zstr_length =3D=3D 0) { continue; } - l =3D string_length + el_len + 1; - memcpy(p, string_key.s, string_length); + l =3D zstr_length + el_len + 1; + memcpy(p, zstr_key.s, zstr_length); strcat(p, "=3D"); strcat(p, data); - =09 #ifndef PHP_WIN32 *ep =3D p; ++ep; @@ -174,10 +201,9 @@ case HASH_KEY_NON_EXISTANT: break; } - }=09 + } =20 assert(p - env.envp <=3D sizeenv); -=09 zend_hash_internal_pointer_reset_ex(target_hash, &pos); =20 return env; ------=_NextPart_000_033D_01C8F28A.57796000--