php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #78682 wrong executed if-else
Submitted: 2019-10-17 22:08 UTC Modified: 2019-12-24 10:38 UTC
From: bugreports at gmail dot com Assigned: cmb (profile)
Status: Closed Package: opcache
PHP Version: master-Git-2019-10-17 (Git) OS: Linux
Private report: No CVE-ID: None
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
MUST BE VALID
Solve the problem:
2 + 29 = ?
Subscribe to this entry?

 
 [2019-10-17 22:08 UTC] bugreports at gmail dot com
Description:
------------
it's impossiblöe that $ml is undefined in that if-else statement

opcache.jit_buffer_size          = 50000000 
opcache.jit                      = 1235

Warning: Undefined variable: ml in global_mysql_ext.inc.php on line 581

   switch($extended)
   {
    default:
      $arr[$row['Field']] = $x_type;
      break;
    case 1:
      if($maxlength)
      {
       $rw = mysqli_fetch_row($this->parent->query("select max(length(`{$row['Field']}`)) from `$table`", 1));
       $ml = (int)$rw[0];
      }
      else
      {
       $ml = 0;
      }
      $arr[$row['Field']] = ['type'=>$x_type, 'null'=>$null, 'length'=>$length, 'maxlength'=>$ml]; /** this is line 581 */
      break;
   }


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2019-10-17 22:43 UTC] bugreports at gmail dot com
it is for sure the jit

$null is also undefined in the same line no matter if it write it with a swicth or if-else while it's impossible that $null is later in this loop is undefined

comment out that two lines from php.ini and the code works as before

#opcache.jit_buffer_size          = 50000000
#opcache.jit                      = 1235

  foreach($this->parent->query_fetch_all("describe `$table`") as $row)
  {
   $null = 0;
   if(strtolower($row['Null']) === 'yes')
   {
    $null = 1;
   }
   ..............
  }
 [2019-12-24 09:21 UTC] laruence@php.net
-Status: Open +Status: Feedback
 [2019-12-24 09:21 UTC] laruence@php.net
Thank you for this bug report. To properly diagnose the problem, we
need a short but complete example script to be able to reproduce
this bug ourselves.

A proper reproducing script starts with <?php and ends with ?>,
is max. 10-20 lines long and does not require any external
resources such as databases, etc. If the script requires a
database to demonstrate the issue, please make sure it creates
all necessary tables, stored procedures etc.

Please avoid embedding huge scripts into the report.


 [2019-12-24 09:51 UTC] bugreports at gmail dot com
seems to be fixed in the current PHP 8 HEAD and for https://bugs.php.net/bug.php?id=78790 i worked around by refcator my database layer to use mysqli in object style

BTW: benchmarks with 100& identical environment thrown against 7.2/7.3/7.4/8.0-jit HEAD

7.2: 3119,30
7.3: 3250,43 - +131,13
7.4: 3294,71 -  +44,28 - versus 7.2: +175,41
8.0: 3347,46 -  +52,75 - versus 7.2: +228,16
 [2019-12-24 10:38 UTC] cmb@php.net
-Status: Feedback +Status: Closed -Assigned To: +Assigned To: cmb
 [2019-12-24 10:38 UTC] cmb@php.net
> seems to be fixed in the current PHP 8 HEAD

Then this ticket can be closed.  Thanks.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Wed Apr 24 15:01:30 2024 UTC