Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:38436 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 37604 invoked from network); 19 Jun 2008 23:08:55 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 19 Jun 2008 23:08:55 -0000 Authentication-Results: pb1.pair.com smtp.mail=stas@zend.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=stas@zend.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain zend.com designates 212.25.124.162 as permitted sender) X-PHP-List-Original-Sender: stas@zend.com X-Host-Fingerprint: 212.25.124.162 mail.zend.com Windows 2000 SP4, XP SP1 Received: from [212.25.124.162] ([212.25.124.162:49918] helo=mx1.zend.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id C5/1F-57468-507EA584 for ; Thu, 19 Jun 2008 19:08:54 -0400 Received: from us-ex1.zend.com ([192.168.16.5]) by mx1.zend.com with Microsoft SMTPSVC(6.0.3790.3959); Fri, 20 Jun 2008 02:09:01 +0300 Received: from [192.168.16.110] ([192.168.16.110]) by us-ex1.zend.com with Microsoft SMTPSVC(6.0.3790.3959); Thu, 19 Jun 2008 16:06:13 -0700 Message-ID: <485AE658.3050204@zend.com> Date: Thu, 19 Jun 2008 16:06:00 -0700 Organization: Zend Technologies User-Agent: Thunderbird 2.0.0.14 (Windows/20080421) MIME-Version: 1.0 To: 'PHP Internals' Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-OriginalArrivalTime: 19 Jun 2008 23:06:13.0323 (UTC) FILETIME=[11DA29B0:01C8D261] Subject: cleaning up the functions - any volunteers? From: stas@zend.com (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