Bug #69825 [Opn->Asn]: Comparison syntax change?

From: Date: Sat, 13 Jun 2015 23:36:41 +0000
Subject: Bug #69825 [Opn->Asn]: Comparison syntax change?
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-193437@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=69825&edit=1 ID: 69825 Updated by: bwoebi@php.net Reported by: michael dot babker at gmail dot com Summary: Comparison syntax change? -Status: Open +Status: Assigned Type: Bug Package: Unknown/Other Function Operating System: Debian PHP Version: 7.0Git-2015-06-13 (Git) -Assigned To: +Assigned To: bwoebi Block user comment: N Private report: N New Comment: Simpler reproduce case var_dump(0 && 1); // bool(true) Going to fix that... Previous Comments: ------------------------------------------------------------------------ [2015-06-13 23:22:31] michael dot babker at gmail dot com Description: ------------ Through a change made between June 09 and June 13, it appears a B/C breaking change in comparison syntax was made. On PHP 7 builds from June 09 and earlier, the following if statement correctly evaluated: // $options['driver'] is set to 'sqlite' in the test environment if ($options['driver'] === 'mysql' && PHP_MAJOR_VERSION >= 7) As of today, if either condition in this statement evaluates to true it is being interpreted as true and the code inside the conditional being executed. Test script: --------------- The snippet above comes from Joomla's 3.5 development branch, specifically the JDatabaseDriver::getInstance() method (https://github.com/joomla/joomla-cms/blob/3.5-dev/libraries/joomla/database/driver.php#L251). From a Travis-CI build using PHP 7 built on May 25, there is no issue with this method (see https://travis-ci.org/joomla/joomla-cms/jobs/64725678). With a build from today (see https://travis-ci.org/joomla/joomla-cms/jobs/66699284), there are numerous failures relating to code attempting to fetch a database driver. Our unit tests are configured to default to a SQLite in-memory database and should not be reaching the MySQL driver. I also tested with the following modification to getInstance on the current Git build and this change passes without an issue - https://gist.github.com/mbabker/f7f87195b31c597bd92e Expected result: ---------------- When $options['driver'] === 'sqlite' and executed on a PHP 7 build, this if conditional should evaluate to false: if ($options['driver'] === 'mysql' && PHP_MAJOR_VERSION >= 7) Actual result: -------------- When $options['driver'] === 'sqlite' and executed on a PHP 7 build, this if conditional is evaluating to true: if ($options['driver'] === 'mysql' && PHP_MAJOR_VERSION >= 7) ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=69825&edit=1

« previous php.bugs (#193437) next »