Bug #78336 [NEW]: Error compare zero with array[n]
| From: | lucastiagodemoraes at gmail dot com | Date: | Fri, 26 Jul 2019 16:10:17 +0000 |
| Subject: | Bug #78336 [NEW]: Error compare zero with array[n] | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-221943@lists.php.net to get a copy of this message | ||
From: lucastiagodemoraes at gmail dot com
Operating system: Ubuntu 18.04
PHP version: 7.2.20
Package: Arrays related
Bug Type: Bug
Bug description:Error compare zero with array[n]
Description:
------------
Hi guys,
See example of bug you will understand.
If this is normal in PHP is very strange. Thanks.
Test script:
---------------
<?php
$letters =
array('a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z');
print 0 == $letters[0] ? $letters[0] : 'false';
print 0 == $letters[1] ? $letters[1] : 'false';
print 0 == $letters[2] ? $letters[2] : 'false';
print 0 == $letters[3] ? $letters[3] : 'false';
print 0 == $letters[4] ? $letters[4] : 'false';
Expected result:
----------------
falsefalsefalsefalsefalse
Actual result:
--------------
abcde
--
Edit bug report at https://bugs.php.net/bug.php?id=78336&edit=1
--
Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=78336&r=trysnapshot54
Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=78336&r=trysnapshot55
Try a snapshot (trunk): https://bugs.php.net/fix.php?id=78336&r=trysnapshottrunk
Fixed in SVN: https://bugs.php.net/fix.php?id=78336&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=78336&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=78336&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=78336&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=78336&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=78336&r=support
Expected behavior: https://bugs.php.net/fix.php?id=78336&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=78336&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=78336&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=78336&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=78336&r=php4
Daylight Savings: https://bugs.php.net/fix.php?id=78336&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=78336&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=78336&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=78336&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=78336&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=78336&r=mysqlcfg