3v4l.org

run code in 300+ PHP versions simultaneously
<?php echo 'start'; function recuperation_info_product_et_decrementation($reference, $stock_fichier, $isDeclinaison){ /* Fonction de récupèration et décrementation produit */ global $version_sup_egale_1531; $product_infos = array(); $tables = array('product_attribute'); if($isDeclinaison === false) { array_unshift($tables, 'product'); } foreach($tables as $table) { $query = 'SELECT * FROM `'._DB_PREFIX_.$table.'` WHERE `reference` = "'.$reference.'";'; $result = Db::getInstance()->executeS($query); if($result !== false) { $product_infos = $result[0]; decremente_stock($product_infos['id_product'], $qty, $reference, $table); break; } } return $product_infos; } /* fonction qui retourne l'IdProduct et l'IdProductAttribute du produit commandé */ function recuperation_idProduct_idProductAttribute($reference_fichier){ $product_infos = array(); $query = 'SELECT * FROM `'._DB_PREFIX_.'product` WHERE `reference` = "'.pSQL($reference).'";'; $result = Db::getInstance()->executeS($query); $product_infos['id_product'] = $result[0]['id_product']; $query = 'SELECT * FROM `'._DB_PREFIX_.'product_attribute` WHERE `reference` = "'.pSQL($reference).'";'; $result = Db::getInstance()->executeS($query); $product_infos['id_product_attribute'] = $result[0]['id_product_attribute']; return $product_infos; } function decremente_stock($id_product, $qty, $reference, $table) { switch ($GLOBALS['versionPourSwitch']){ case '1.5.4.0': // [-] Core: Hook actionUpdateQuantity was not called for product without attributes which depends on the physical stock $query = ' UPDATE `'._DB_PREFIX_.'stock_available` SET quantity = (quantity - "'.$qty.'") WHERE id_product = "'.$id_product.'" AND `reference` = "'.$reference.'";'; Db::getInstance()->execute($query); $query2 = ' UPDATE `'._DB_PREFIX_.'stock` SET physical_quantity = (physical_quantity - "'.$qty.'") WHERE id_product = "'.$id_product.'" AND `reference` = "'.$reference.'";'; Db::getInstance()->execute($query2); break; default: if($version_sup_egale_1531) { $query = ' UPDATE `'._DB_PREFIX_.'stock_available` SET quantity = (quantity - "'.$qty.'") WHERE id_product = "'.$id_product.'" AND `reference` = "'.$reference.'";'; } else { $query = ' UPDATE `'._DB_PREFIX_.$table.'` SET quantity = (quantity - "'.$qty.'") WHERE id_product = "'.$id_product.'" AND `reference` = "'.$reference.'";'; } Db::getInstance()->execute($query); break; } } echo 'done';
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/COcFH
function name:  (null)
number of ops:  3
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   ECHO                                                     'start'
   73     1        ECHO                                                     'done'
          2      > RETURN                                                   1

Function recuperation_info_product_et_decrementation:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 8, Position 2 = 12
Branch analysis from position: 8
2 jumps found. (Code = 77) Position 1 = 13, Position 2 = 41
Branch analysis from position: 13
2 jumps found. (Code = 78) Position 1 = 14, Position 2 = 41
Branch analysis from position: 14
2 jumps found. (Code = 43) Position 1 = 29, Position 2 = 40
Branch analysis from position: 29
1 jumps found. (Code = 42) Position 1 = 41
Branch analysis from position: 41
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 40
1 jumps found. (Code = 42) Position 1 = 13
Branch analysis from position: 13
Branch analysis from position: 41
Branch analysis from position: 41
Branch analysis from position: 12
filename:       /in/COcFH
function name:  recuperation_info_product_et_decrementation
number of ops:  44
compiled vars:  !0 = $reference, !1 = $stock_fichier, !2 = $isDeclinaison, !3 = $version_sup_egale_1531, !4 = $product_infos, !5 = $tables, !6 = $table, !7 = $query, !8 = $result, !9 = $qty
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   RECV                                             !0      
          1        RECV                                             !1      
          2        RECV                                             !2      
    4     3        BIND_GLOBAL                                              !3, 'version_sup_egale_1531'
    5     4        ASSIGN                                                   !4, <array>
    6     5        ASSIGN                                                   !5, <array>
    8     6        TYPE_CHECK                                    4          !2
          7      > JMPZ                                                     ~12, ->12
    9     8    >   INIT_FCALL                                               'array_unshift'
          9        SEND_REF                                                 !5
         10        SEND_VAL                                                 'product'
         11        DO_ICALL                                                 
   12    12    > > FE_RESET_R                                       $14     !5, ->41
         13    > > FE_FETCH_R                                               $14, !6, ->41
   13    14    >   FETCH_CONSTANT                                   ~15     '_DB_PREFIX_'
         15        CONCAT                                           ~16     'SELECT+%2A+FROM+%60', ~15
         16        CONCAT                                           ~17     ~16, !6
         17        CONCAT                                           ~18     ~17, '%60+WHERE+%60reference%60+%3D+%22'
         18        CONCAT                                           ~19     ~18, !0
         19        CONCAT                                           ~20     ~19, '%22%3B'
         20        ASSIGN                                                   !7, ~20
   14    21        INIT_STATIC_METHOD_CALL                                  'Db', 'getInstance'
         22        DO_FCALL                                      0  $22     
         23        INIT_METHOD_CALL                                         $22, 'executeS'
         24        SEND_VAR_EX                                              !7
         25        DO_FCALL                                      0  $23     
         26        ASSIGN                                                   !8, $23
   15    27        TYPE_CHECK                                  1018          !8
         28      > JMPZ                                                     ~25, ->40
   16    29    >   FETCH_DIM_R                                      ~26     !8, 0
         30        ASSIGN                                                   !4, ~26
   17    31        INIT_FCALL_BY_NAME                                       'decremente_stock'
         32        CHECK_FUNC_ARG                                           
         33        FETCH_DIM_FUNC_ARG                               $28     !4, 'id_product'
         34        SEND_FUNC_ARG                                            $28
         35        SEND_VAR_EX                                              !9
         36        SEND_VAR_EX                                              !0
         37        SEND_VAR_EX                                              !6
         38        DO_FCALL                                      0          
   18    39      > JMP                                                      ->41
   12    40    > > JMP                                                      ->13
         41    >   FE_FREE                                                  $14
   22    42      > RETURN                                                   !4
   23    43*     > RETURN                                                   null

End of function recuperation_info_product_et_decrementation

Function recuperation_idproduct_idproductattribute:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/COcFH
function name:  recuperation_idProduct_idProductAttribute
number of ops:  42
compiled vars:  !0 = $reference_fichier, !1 = $product_infos, !2 = $query, !3 = $reference, !4 = $result
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   26     0  E >   RECV                                             !0      
   27     1        ASSIGN                                                   !1, <array>
   29     2        FETCH_CONSTANT                                   ~6      '_DB_PREFIX_'
          3        CONCAT                                           ~7      'SELECT+%2A+FROM+%60', ~6
          4        CONCAT                                           ~8      ~7, 'product%60+WHERE+%60reference%60+%3D+%22'
          5        INIT_FCALL_BY_NAME                                       'pSQL'
          6        SEND_VAR_EX                                              !3
          7        DO_FCALL                                      0  $9      
          8        CONCAT                                           ~10     ~8, $9
          9        CONCAT                                           ~11     ~10, '%22%3B'
         10        ASSIGN                                                   !2, ~11
   30    11        INIT_STATIC_METHOD_CALL                                  'Db', 'getInstance'
         12        DO_FCALL                                      0  $13     
         13        INIT_METHOD_CALL                                         $13, 'executeS'
         14        SEND_VAR_EX                                              !2
         15        DO_FCALL                                      0  $14     
         16        ASSIGN                                                   !4, $14
   31    17        FETCH_DIM_R                                      ~17     !4, 0
         18        FETCH_DIM_R                                      ~18     ~17, 'id_product'
         19        ASSIGN_DIM                                               !1, 'id_product'
         20        OP_DATA                                                  ~18
   33    21        FETCH_CONSTANT                                   ~19     '_DB_PREFIX_'
         22        CONCAT                                           ~20     'SELECT+%2A+FROM+%60', ~19
         23        CONCAT                                           ~21     ~20, 'product_attribute%60+WHERE+%60reference%60+%3D+%22'
         24        INIT_FCALL_BY_NAME                                       'pSQL'
         25        SEND_VAR_EX                                              !3
         26        DO_FCALL                                      0  $22     
         27        CONCAT                                           ~23     ~21, $22
         28        CONCAT                                           ~24     ~23, '%22%3B'
         29        ASSIGN                                                   !2, ~24
   34    30        INIT_STATIC_METHOD_CALL                                  'Db', 'getInstance'
         31        DO_FCALL                                      0  $26     
         32        INIT_METHOD_CALL                                         $26, 'executeS'
         33        SEND_VAR_EX                                              !2
         34        DO_FCALL                                      0  $27     
         35        ASSIGN                                                   !4, $27
   35    36        FETCH_DIM_R                                      ~30     !4, 0
         37        FETCH_DIM_R                                      ~31     ~30, 'id_product_attribute'
         38        ASSIGN_DIM                                               !1, 'id_product_attribute'
         39        OP_DATA                                                  ~31
   37    40      > RETURN                                                   !1
   38    41*     > RETURN                                                   null

End of function recuperation_idproduct_idproductattribute

Function decremente_stock:
Finding entry points
Branch analysis from position: 0
3 jumps found. (Code = 188) Position 1 = 10, Position 2 = 41, Position 3 = 7
Branch analysis from position: 10
1 jumps found. (Code = 42) Position 1 = 70
Branch analysis from position: 70
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 41
2 jumps found. (Code = 43) Position 1 = 42, Position 2 = 53
Branch analysis from position: 42
1 jumps found. (Code = 42) Position 1 = 64
Branch analysis from position: 64
1 jumps found. (Code = 42) Position 1 = 70
Branch analysis from position: 70
Branch analysis from position: 53
1 jumps found. (Code = 42) Position 1 = 70
Branch analysis from position: 70
Branch analysis from position: 7
2 jumps found. (Code = 44) Position 1 = 9, Position 2 = 10
Branch analysis from position: 9
1 jumps found. (Code = 42) Position 1 = 41
Branch analysis from position: 41
Branch analysis from position: 10
filename:       /in/COcFH
function name:  decremente_stock
number of ops:  72
compiled vars:  !0 = $id_product, !1 = $qty, !2 = $reference, !3 = $table, !4 = $query, !5 = $query2, !6 = $version_sup_egale_1531
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   40     0  E >   RECV                                             !0      
          1        RECV                                             !1      
          2        RECV                                             !2      
          3        RECV                                             !3      
   42     4        FETCH_R                      global              ~7      'GLOBALS'
          5        FETCH_DIM_R                                      ~8      ~7, 'versionPourSwitch'
          6      > SWITCH_STRING                                            ~8, [ '1.5.4.0':->10, ], ->41
   43     7    >   CASE                                                     ~8, '1.5.4.0'
          8      > JMPNZ                                                    ~9, ->10
          9    > > JMP                                                      ->41
   44    10    >   FETCH_CONSTANT                                   ~10     '_DB_PREFIX_'
         11        CONCAT                                           ~11     '%09UPDATE+%60', ~10
         12        CONCAT                                           ~12     ~11, 'stock_available%60+%0A%09%09%09%09%09%09SET+quantity+%3D+%28quantity+-+%22'
   45    13        CONCAT                                           ~13     ~12, !1
         14        CONCAT                                           ~14     ~13, '%22%29+%0A%09%09%09%09%09%09WHERE+id_product+%3D+%22'
   46    15        CONCAT                                           ~15     ~14, !0
         16        CONCAT                                           ~16     ~15, '%22+%0A%09%09%09%09%09%09AND+%60reference%60+%3D+%22'
   47    17        CONCAT                                           ~17     ~16, !2
         18        CONCAT                                           ~18     ~17, '%22%3B'
   44    19        ASSIGN                                                   !4, ~18
   48    20        INIT_STATIC_METHOD_CALL                                  'Db', 'getInstance'
         21        DO_FCALL                                      0  $20     
         22        INIT_METHOD_CALL                                         $20, 'execute'
         23        SEND_VAR_EX                                              !4
         24        DO_FCALL                                      0          
   49    25        FETCH_CONSTANT                                   ~22     '_DB_PREFIX_'
         26        CONCAT                                           ~23     '%09UPDATE+%60', ~22
         27        CONCAT                                           ~24     ~23, 'stock%60+%0A%09%09%09%09%09%09SET+physical_quantity+%3D+%28physical_quantity+-+%22'
   50    28        CONCAT                                           ~25     ~24, !1
         29        CONCAT                                           ~26     ~25, '%22%29+%0A%09%09%09%09%09%09WHERE+id_product+%3D+%22'
   51    30        CONCAT                                           ~27     ~26, !0
         31        CONCAT                                           ~28     ~27, '%22+%0A%09%09%09%09%09%09AND+%60reference%60+%3D+%22'
   52    32        CONCAT                                           ~29     ~28, !2
         33        CONCAT                                           ~30     ~29, '%22%3B'
   49    34        ASSIGN                                                   !5, ~30
   53    35        INIT_STATIC_METHOD_CALL                                  'Db', 'getInstance'
         36        DO_FCALL                                      0  $32     
         37        INIT_METHOD_CALL                                         $32, 'execute'
         38        SEND_VAR_EX                                              !5
         39        DO_FCALL                                      0          
   54    40      > JMP                                                      ->70
   56    41    > > JMPZ                                                     !6, ->53
   57    42    >   FETCH_CONSTANT                                   ~34     '_DB_PREFIX_'
         43        CONCAT                                           ~35     '%09UPDATE+%60', ~34
         44        CONCAT                                           ~36     ~35, 'stock_available%60+%0A%09%09%09%09%09%09%09SET+quantity+%3D+%28quantity+-+%22'
   58    45        CONCAT                                           ~37     ~36, !1
         46        CONCAT                                           ~38     ~37, '%22%29+%0A%09%09%09%09%09%09%09WHERE+id_product+%3D+%22'
   59    47        CONCAT                                           ~39     ~38, !0
         48        CONCAT                                           ~40     ~39, '%22+%0A%09%09%09%09%09%09%09AND+%60reference%60+%3D+%22'
   60    49        CONCAT                                           ~41     ~40, !2
         50        CONCAT                                           ~42     ~41, '%22%3B'
   57    51        ASSIGN                                                   !4, ~42
         52      > JMP                                                      ->64
   63    53    >   FETCH_CONSTANT                                   ~44     '_DB_PREFIX_'
         54        CONCAT                                           ~45     '%09UPDATE+%60', ~44
         55        CONCAT                                           ~46     ~45, !3
         56        CONCAT                                           ~47     ~46, '%60+%0A%09%09%09%09%09%09%09SET+quantity+%3D+%28quantity+-+%22'
   64    57        CONCAT                                           ~48     ~47, !1
         58        CONCAT                                           ~49     ~48, '%22%29+%0A%09%09%09%09%09%09%09WHERE+id_product+%3D+%22'
   65    59        CONCAT                                           ~50     ~49, !0
         60        CONCAT                                           ~51     ~50, '%22+%0A%09%09%09%09%09%09%09AND+%60reference%60+%3D+%22'
   66    61        CONCAT                                           ~52     ~51, !2
         62        CONCAT                                           ~53     ~52, '%22%3B'
   63    63        ASSIGN                                                   !4, ~53
   68    64    >   INIT_STATIC_METHOD_CALL                                  'Db', 'getInstance'
         65        DO_FCALL                                      0  $55     
         66        INIT_METHOD_CALL                                         $55, 'execute'
         67        SEND_VAR_EX                                              !4
         68        DO_FCALL                                      0          
   69    69      > JMP                                                      ->70
         70    >   FREE                                                     ~8
   72    71      > RETURN                                                   null

End of function decremente_stock

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
151.83 ms | 1412 KiB | 15 Q