Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:66905 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 35036 invoked from network); 3 Apr 2013 08:10:36 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 3 Apr 2013 08:10:36 -0000 Authentication-Results: pb1.pair.com header.from=smalyshev@sugarcrm.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=smalyshev@sugarcrm.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain sugarcrm.com designates 108.166.43.91 as permitted sender) X-PHP-List-Original-Sender: smalyshev@sugarcrm.com X-Host-Fingerprint: 108.166.43.91 smtp91.ord1c.emailsrvr.com Linux 2.6 Received: from [108.166.43.91] ([108.166.43.91:46932] helo=smtp91.ord1c.emailsrvr.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 85/BA-07534-9F3EB515 for ; Wed, 03 Apr 2013 03:10:34 -0500 Received: from localhost (localhost.localdomain [127.0.0.1]) by smtp4.relay.ord1c.emailsrvr.com (SMTP Server) with ESMTP id A59C81400A7; Wed, 3 Apr 2013 04:10:31 -0400 (EDT) X-Virus-Scanned: OK Received: by smtp4.relay.ord1c.emailsrvr.com (Authenticated sender: smalyshev-AT-sugarcrm.com) with ESMTPSA id 44A031400DF; Wed, 3 Apr 2013 04:10:31 -0400 (EDT) Message-ID: <515BE3F6.4010304@sugarcrm.com> Date: Wed, 03 Apr 2013 01:10:30 -0700 Organization: SugarCRM User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.7; rv:17.0) Gecko/20130307 Thunderbird/17.0.4 MIME-Version: 1.0 To: Sara Golemon CC: PHP internals References: In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Subject: Re: [PHP-DEV] [RFC] Simplified Array API for extensions From: smalyshev@sugarcrm.com (Stas Malyshev) Hi! > https://wiki.php.net/rfc/php-array-api Nice API, I am a bit worried though about conversion routines. Specifically, php_array_zval_to_double() uses different conversion algorithm than PHP's standard zval to double conversion, which may result in different results in edge cases. Also, these functions seem to duplicate existing conversions - we already have code that converts zvals to anything, couldn't we reuse it? BTW, it's not completely clear what these conversion functions have to do with arrays - why they are prefixed with php_array_*? If they aren't meant to be used directly, maybe prefix them with __ or something? And if they are, maybe we need better names for them... In php_array_zval_to_array() the comment says "If the value is an array, then that zval is returned, otherwise NULL is returned." but the code says (zarr && (Z_TYPE_P(zarr))) ? zarr : NULL; which means if zarr is anything but NULL, it would be returned, regardless if it's array or not. There are a lot of functions that do: char *k = estrndup(key, key_len); Wouldn't it be more efficient to try to use alloca if it's available? "c" functions can be a bit dangerous, since they assume the argument is a constant supplied directly in the macro, but there's no way to catch it if somebody does something like name="foo"; php_array_fetchc(bar, foo); Thanks, -- Stanislav Malyshev, Software Architect SugarCRM: http://www.sugarcrm.com/ (408)454-6900 ext. 227