Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:38470 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 84404 invoked from network); 20 Jun 2008 15:18:55 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 20 Jun 2008 15:18:55 -0000 Authentication-Results: pb1.pair.com smtp.mail=david.coallier@gmail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=david.coallier@gmail.com; sender-id=pass; domainkeys=bad Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.200.168 as permitted sender) DomainKey-Status: bad X-DomainKeys: Ecelerity dk_validate implementing draft-delany-domainkeys-base-01 X-PHP-List-Original-Sender: david.coallier@gmail.com X-Host-Fingerprint: 209.85.200.168 wf-out-1314.google.com Received: from [209.85.200.168] ([209.85.200.168:46861] helo=wf-out-1314.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id A2/60-16112-D5ACB584 for ; Fri, 20 Jun 2008 11:18:54 -0400 Received: by wf-out-1314.google.com with SMTP id 26so956534wfd.26 for ; Fri, 20 Jun 2008 08:18:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from:sender :to:subject:cc:in-reply-to:mime-version:content-type:references :x-google-sender-auth; bh=0vLdeh5UqAdmAt6d7D8eTqpBMT4UqvdpLzAc3BgaBUc=; b=Hx3sh3J8004i+kKoaH2/4K7KqBQYhrmWO+47DA1XQHPi9VkVWylz6W6mAGxmILS58A UfqIgGuwiADFTlTjJzENA9rsZw3y7cxAGhYLiGJRcAb6mCuzhDxuSrrLTmgTMZOvrAJm 87RqcMDp6d4/0LzLQe/2mZ2GKGgXKgVrzHLIs= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:sender:to:subject:cc:in-reply-to:mime-version :content-type:references:x-google-sender-auth; b=DQXISVhqvYbBDDBpacl96SPXwXfHFBjuYXTnkbJ4xBEV5n1d+Z5aE4O9+gpXq+idQw LbjVVic2zaElf/UiaYaSJ/ZANg6Oa7WxCWo0VW06mdfGbDfdd/rCJrSf1HQT9QXekEV+ unK0ozjscag5akUN6dy3MQwv9xrtabgcSsp68= Received: by 10.143.3.4 with SMTP id f4mr1342933wfi.233.1213975130283; Fri, 20 Jun 2008 08:18:50 -0700 (PDT) Received: by 10.142.80.10 with HTTP; Fri, 20 Jun 2008 08:18:50 -0700 (PDT) Message-ID: Date: Fri, 20 Jun 2008 16:18:50 +0100 Sender: david.coallier@gmail.com To: "Stanislav Malyshev" Cc: "PHP Internals" In-Reply-To: <485AE658.3050204@zend.com> MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_Part_7487_5273323.1213975130281" References: <485AE658.3050204@zend.com> X-Google-Sender-Auth: fe857a3f31f9150e Subject: Re: [PHP-DEV] cleaning up the functions - any volunteers? From: davidc@php.net ("David Coallier") ------=_Part_7487_5273323.1213975130281 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Content-Disposition: inline I'll take a few 2008/6/20 Stanislav Malyshev : > Hi! > > While we nearing the release of 5.3 (hopefully?), there are many functions > in the PHP code which still use old parameter parsing API > (zend_get_parameters_ex) instead of the new one (zend_parse_parameters). > > I have cleaned up Zend engine functions, converting them to the new API, > but there are about 1000 instances throughout PHP code (especially > ext/standard) which still use the old way. This way is less correct, > inconsistent with the new code, gives worse error messages, more prone to > various bugs, etc. All new extensions and functions use the new way, and the > only reason for keeping the old way in the code seems to be that nobody > cleaned it up. Somebody has to bring the old ones into sync, and I don't > think I personally will have time to do it in near timeframe. So if anybody > could step up to that - by doing at least part of the work - that'd be > great. The work is pretty simple, taking something like: > > zval **data; > > if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &data) == FAILURE) { > WRONG_PARAM_COUNT; > } > convert_to_string_ex(data); > > and move it into: > > char *str; > int str_len; > > if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &str, &str_len) > == FAILURE) { > return; > } > > and of course convert use of data zval into use of str. > > This needs to be done carefully as not to break things on some more tricky > functions which may get arguments of multiple types, etc. Also, some tests > which check error messages may need to be fixed since new API gives more > detailed messages. > zend_parse_parameters documented here: > http://www.php.net/manual/en/internals2.ze1.zendapi.php > though some of the newer parameters aren't (C, h, f, Z) so one may need to > look at the code at zend_API.c. > > P.S. if some genius would invent a script to automate that - it'd be > awesome, but I don't have very high hopes on that. :) > -- > Stanislav Malyshev, Zend Software Architect > stas@zend.com http://www.zend.com/ > (408)253-8829 MSN: stas@zend.com > > -- > PHP Internals - PHP Runtime Development Mailing List > To unsubscribe, visit: http://www.php.net/unsub.php > > -- Slan, David ------=_Part_7487_5273323.1213975130281--