Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:84677 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 3012 invoked from network); 13 Mar 2015 12:00:09 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 13 Mar 2015 12:00:09 -0000 Received: from [127.0.0.1] ([127.0.0.1:19061]) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ECSTREAM id C4/C0-32208-941D2055 for ; Fri, 13 Mar 2015 07:00:09 -0500 Authentication-Results: pb1.pair.com header.from=kluev.andrew@gmail.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=kluev.andrew@gmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.217.177 as permitted sender) X-PHP-List-Original-Sender: kluev.andrew@gmail.com X-Host-Fingerprint: 209.85.217.177 mail-lb0-f177.google.com Received: from [209.85.217.177] ([209.85.217.177:43203] helo=mail-lb0-f177.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 76/60-32208-9AEC2055 for ; Fri, 13 Mar 2015 06:48:59 -0500 Received: by lbvp9 with SMTP id p9so22169899lbv.10 for ; Fri, 13 Mar 2015 04:48:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:date:message-id:subject:from:to:content-type; bh=Wu6kDaJOONxd0D30eRmzo/7Ie1vQ6N1phUwWgx9h7Y0=; b=QfToHvDpoOQ+/MCOvUb4BpZ0u0IxV6xqYJXOLqTOC+QaJdHbLVXNoLPjL/+DD8E8L/ c+wMCfxNSDSb2QXL+8VXm9aDuCIoxo9+7ccKivmIBobxv5MtrXmblDi1b6/F49fPg9wn 5MdSRupxvIoN57XmXevB6VH1G83Vd0WXY2usxK89UW6qe1Uz5ZvwLaSW+VoTz89JsuYc CTtsZs5U6QrlhumtVZlBrcSlGOtd7TfNPJ7U+6J3OVWb+MYBDYVHYNEsjLzC18eKUEL3 4QRaeUnWFUA2eJJFfS/fA6zGIk2MIxynpamC771+wfSGIgz+JE5p0Q0qdh2966QAH5zR 4JRQ== MIME-Version: 1.0 X-Received: by 10.153.7.69 with SMTP id da5mr43354572lad.108.1426247335414; Fri, 13 Mar 2015 04:48:55 -0700 (PDT) Received: by 10.114.70.39 with HTTP; Fri, 13 Mar 2015 04:48:55 -0700 (PDT) Date: Fri, 13 Mar 2015 14:48:55 +0300 Message-ID: To: internals@lists.php.net Content-Type: multipart/alternative; boundary=001a11345630ca11e805112a15ff Subject: [PHP-DEV] Behavior of classes type hinting together with the error handler From: kluev.andrew@gmail.com (=?UTF-8?B?0JDQvdC00YDQtdC5INCa0LvRjtC10LI=?=) --001a11345630ca11e805112a15ff Content-Type: text/plain; charset=UTF-8 Hello internals! My name is Andrew and I write php literally since childhood (something around 10 years), now PHP - is my profession. And today once again debugging foreign code, I was ready to go to the hospital to see a psychiatrist. First, some of the code: Do you think that can output this feature? function test(A $a) { var_dump(get_class($a)); } I always thought that only 'string (1) "A"', I have never been so wrong (c). The code below will display 'string (1) "B"' class A { } class B { public $id = 1; } set_error_handler(function () { return true; }); function test(A $a) { var_dump(get_class($a)); } test(new B()); I think this is very unexpected behavior, and suggest you to consider the possibility of removing this behavior in PHP7. Best regards. Andrew Kluev. --001a11345630ca11e805112a15ff--