Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:85716 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 52575 invoked from network); 3 Apr 2015 19:04:56 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 3 Apr 2015 19:04:56 -0000 Authentication-Results: pb1.pair.com header.from=dmitry@zend.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=dmitry@zend.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain zend.com designates 209.85.160.174 as permitted sender) X-PHP-List-Original-Sender: dmitry@zend.com X-Host-Fingerprint: 209.85.160.174 mail-yk0-f174.google.com Received: from [209.85.160.174] ([209.85.160.174:35426] helo=mail-yk0-f174.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id F5/43-23347-754EE155 for ; Fri, 03 Apr 2015 14:04:55 -0500 Received: by ykeg184 with SMTP id g184so31065245yke.2 for ; Fri, 03 Apr 2015 12:04:52 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:date:message-id:subject:from:to :content-type; bh=+nHObYMk/mFgFbcXUJBNO8293AQk58LnoRetxBXFbdc=; b=JfNS0RW6iZPApcpzu+p21iYvjeZKylrfCWCu4MKKLdecXeYaIUUalQwSoTfZ8WUo0m wK6INFPee1ZMaIQXV+wYv9W2bOXPUf5Jg5gr6/wSfdnWM1GMdYCCK0C99wTqqsUhO6Bl EiTfc7dGpN80rdS2aHZmEjd5nB12J+bT1SnHLiT4FYrg9PIwLzYH9mW8bnMQNVVh6nlM N7MzNVR2dxVph0qAgDEEmxa5TQZl31edePr/WLYFcMavoyHaAVxgR3aGdRXrvDfqVSk+ NDLWSHpM2Sbldd79TMALOV4WMcaLGDkiCdLkpzVVd67a9Pi7tFdpaUggaeK10OtoHRpp pWgQ== X-Gm-Message-State: ALoCoQkV9U74RAMRkQOyKYHRVSBrh9qYF/88cmohb+MKMrFo0KZVA4U+14wY1jw4kjTk4lea+omcca2wylWoFcBkOosQEY6Tbp4KchRW1pd34Fj8vqnxeoaZX/OD+/ydyfLRIWOgzYIwl/MOctihr4HQxrLuZX/HhQ== MIME-Version: 1.0 X-Received: by 10.52.165.65 with SMTP id yw1mr2076691vdb.51.1428087892521; Fri, 03 Apr 2015 12:04:52 -0700 (PDT) Received: by 10.52.248.36 with HTTP; Fri, 3 Apr 2015 12:04:52 -0700 (PDT) Date: Fri, 3 Apr 2015 22:04:52 +0300 Message-ID: To: PHP Internals , Nikita Popov , Andrea Faulds Content-Type: multipart/alternative; boundary=001a11c29cc08acc760512d69fa4 Subject: Fix division by zero to throw exception From: dmitry@zend.com (Dmitry Stogov) --001a11c29cc08acc760512d69fa4 Content-Type: text/plain; charset=UTF-8 1) Division by zero behavior in PHP is really inconsistent. It emits WARNING and returns FALLE. Note, that since PHP-5.6 division by zero may also occur in constant expressions. They are compiled and evaluated only once (on first request) and on next request WARNING is going to be hidden. $ cat div.php $ sapi/cgi/php-cgi -q -T 3 div.php PHP Warning: Division by zero in /home/dmitry/php/php-master/CGI-DEBUG/div.php on line 3 bool(false) bool(false) bool(false) I propose to change this into fatal error for division by zero at compile-time and exception a run-time. 2) Very similar weird behavior was introduced for shift with negative offsets. I also propose to change it in the same way (Fatal error at compile-time, Exception in run-time). Any thoughts? objections? Thanks. Dmitry. --001a11c29cc08acc760512d69fa4--