Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:27206 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 61983 invoked by uid 1010); 27 Dec 2006 21:12:50 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 61968 invoked from network); 27 Dec 2006 21:12:50 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 27 Dec 2006 21:12:50 -0000 Authentication-Results: pb1.pair.com header.from=andrei@gravitonic.com; sender-id=unknown Authentication-Results: pb1.pair.com smtp.mail=andrei@gravitonic.com; spf=permerror; sender-id=unknown Received-SPF: error (pb1.pair.com: domain gravitonic.com from 204.11.219.139 cause and error) X-PHP-List-Original-Sender: andrei@gravitonic.com X-Host-Fingerprint: 204.11.219.139 lerdorf.com Linux 2.5 (sometimes 2.4) (4) Received: from [204.11.219.139] ([204.11.219.139:59085] helo=lerdorf.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id D3/D5-20830-FA1E2954 for ; Wed, 27 Dec 2006 16:12:50 -0500 Received: from [192.168.11.2] (c-24-6-96-18.hsd1.ca.comcast.net [24.6.96.18]) (authenticated bits=0) by lerdorf.com (8.13.8/8.13.8/Debian-3) with ESMTP id kBRLCAMo027881; Wed, 27 Dec 2006 13:12:11 -0800 In-Reply-To: <4592D62F.7070701@zend.com> References: <4592D62F.7070701@zend.com> Mime-Version: 1.0 (Apple Message framework v752.2) Content-Type: text/plain; charset=US-ASCII; delsp=yes; format=flowed Message-ID: <674C0731-D508-4AB7-93ED-7ECC60E6ECE0@gravitonic.com> Cc: php-dev Internals Content-Transfer-Encoding: 7bit Date: Wed, 27 Dec 2006 13:12:10 -0800 To: Antony Dovgal X-Mailer: Apple Mail (2.752.2) Subject: Re: [PHP-DEV] Return value of convert_to_*() From: andrei@gravitonic.com (Andrei Zmievski) > Why do you want that? > "Bad" conversion is failed conversion, that's the case when you get > E_RECOVERABLE_ERROR and it bails out. Yes, I want that function to return FAILURE when we issue E_RECOVERABLE_ERROR. Exactly what I was talking about. > >> One such place is zend_parse_parameters(). If you say zpp(..., >> "s", &str, &str_len) and the user passes an object without >> __toString() method, zpp() should issue an error saying that it >> expected a string and got an object instead, even if we "forced" >> the conversion result to be a string in convert_to_string(). > > An error? You mean this one: > zend_error(E_NOTICE, "Object of class %v to string conversion", > Z_OBJCE_P(op)->name); > ? > We already have it, no need for a new error. I want zend_parse_parameters() to issue a warning, saying "foo() expects parameter 1 to be string, object given". I do not consider "Object" to be a valid conversion for this purpose. > It's perfectly legal to do it in 5.2 and I don't see why PHP6 is > different. > IMO it's same as changing the E_RECOVERABLE to E_ERROR - users > won't have any way to "workaround" it, even though this was the > original intention of E_RECOVERABLE. It is not the same. E_ERROR stops execution. Returning FAILURE from convert_to_string() is simply a flag that lets calling code know what happened. -Andrei