This project does not seem to handle request data directly as such no vulnerable execution paths were found.
include
, or for example
via PHP's auto-loading mechanism.
These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
1 | <?php |
||
2 | |||
3 | require_once __DIR__ . '/../exceptions/FlightNotFoundException.php'; |
||
4 | require_once __DIR__ . '/../class/bbcvols.class.php'; |
||
5 | |||
6 | /** |
||
7 | * @author Laurent De Coninck <[email protected]> |
||
8 | */ |
||
9 | class CreateFlightCommandHandler implements CommandHandlerInterface |
||
10 | { |
||
11 | /** |
||
12 | * @var DoliDB |
||
13 | */ |
||
14 | private $db; |
||
15 | |||
16 | /** |
||
17 | * @var stdClass |
||
18 | */ |
||
19 | private $conf; |
||
20 | |||
21 | /** |
||
22 | * @var User |
||
23 | */ |
||
24 | private $user; |
||
25 | |||
26 | /** |
||
27 | * @var Translate |
||
28 | */ |
||
29 | private $langs; |
||
30 | |||
31 | /** |
||
32 | * @var |
||
33 | */ |
||
34 | private $validator; |
||
35 | |||
36 | /** |
||
37 | * @param DoliDB $db |
||
38 | * @param stdClass $conf |
||
39 | * @param User $user |
||
40 | * @param Translate $langs |
||
41 | * @param FlightValidator $validator |
||
42 | */ |
||
43 | public function __construct( |
||
44 | $db, |
||
45 | $conf, |
||
46 | $user, |
||
47 | $langs, |
||
48 | FlightValidator $validator |
||
49 | ) { |
||
50 | $this->db = $db; |
||
51 | $this->conf = $conf->global; |
||
52 | $this->user = $user; |
||
53 | $this->langs = $langs; |
||
54 | $this->validator = $validator; |
||
55 | } |
||
56 | |||
57 | /** |
||
58 | * @param CreateFlightCommand|CommandInterface $command |
||
59 | * |
||
60 | * @return Bbcvols |
||
61 | * @throws Exception |
||
62 | */ |
||
63 | public function handle(CommandInterface $command) |
||
64 | { |
||
65 | $vol = new Bbcvols($this->db); |
||
66 | $vol->date = $command->getDate(); |
||
0 ignored issues
–
show
|
|||
67 | $vol->lieuD = $command->getLieuD(); |
||
0 ignored issues
–
show
It seems like you code against a concrete implementation and not the interface
CommandInterface as the method getLieuD() does only exist in the following implementations of said interface: CreateFlightCommand .
Let’s take a look at an example: interface User
{
/** @return string */
public function getPassword();
}
class MyUser implements User
{
public function getPassword()
{
// return something
}
public function getDisplayName()
{
// return some name.
}
}
class AuthSystem
{
public function authenticate(User $user)
{
$this->logger->info(sprintf('Authenticating %s.', $user->getDisplayName()));
// do something.
}
}
In the above example, the authenticate() method works fine as long as you just pass instances of MyUser. However, if you now also want to pass a different implementation of User which does not have a getDisplayName() method, the code will break. Available Fixes
Note: PHP Analyzer uses reverse abstract interpretation to narrow down the types
inside the if block in such a case.
![]() |
|||
68 | $vol->lieuA =$command->getLieuA(); |
||
0 ignored issues
–
show
It seems like you code against a concrete implementation and not the interface
CommandInterface as the method getLieuA() does only exist in the following implementations of said interface: CreateFlightCommand .
Let’s take a look at an example: interface User
{
/** @return string */
public function getPassword();
}
class MyUser implements User
{
public function getPassword()
{
// return something
}
public function getDisplayName()
{
// return some name.
}
}
class AuthSystem
{
public function authenticate(User $user)
{
$this->logger->info(sprintf('Authenticating %s.', $user->getDisplayName()));
// do something.
}
}
In the above example, the authenticate() method works fine as long as you just pass instances of MyUser. However, if you now also want to pass a different implementation of User which does not have a getDisplayName() method, the code will break. Available Fixes
Note: PHP Analyzer uses reverse abstract interpretation to narrow down the types
inside the if block in such a case.
![]() |
|||
69 | $vol->heureD = $command->getHeureD(); |
||
0 ignored issues
–
show
It seems like you code against a concrete implementation and not the interface
CommandInterface as the method getHeureD() does only exist in the following implementations of said interface: CreateFlightCommand .
Let’s take a look at an example: interface User
{
/** @return string */
public function getPassword();
}
class MyUser implements User
{
public function getPassword()
{
// return something
}
public function getDisplayName()
{
// return some name.
}
}
class AuthSystem
{
public function authenticate(User $user)
{
$this->logger->info(sprintf('Authenticating %s.', $user->getDisplayName()));
// do something.
}
}
In the above example, the authenticate() method works fine as long as you just pass instances of MyUser. However, if you now also want to pass a different implementation of User which does not have a getDisplayName() method, the code will break. Available Fixes
Note: PHP Analyzer uses reverse abstract interpretation to narrow down the types
inside the if block in such a case.
![]() |
|||
70 | $vol->heureA = $command->getHeureA(); |
||
0 ignored issues
–
show
It seems like you code against a concrete implementation and not the interface
CommandInterface as the method getHeureA() does only exist in the following implementations of said interface: CreateFlightCommand .
Let’s take a look at an example: interface User
{
/** @return string */
public function getPassword();
}
class MyUser implements User
{
public function getPassword()
{
// return something
}
public function getDisplayName()
{
// return some name.
}
}
class AuthSystem
{
public function authenticate(User $user)
{
$this->logger->info(sprintf('Authenticating %s.', $user->getDisplayName()));
// do something.
}
}
In the above example, the authenticate() method works fine as long as you just pass instances of MyUser. However, if you now also want to pass a different implementation of User which does not have a getDisplayName() method, the code will break. Available Fixes
Note: PHP Analyzer uses reverse abstract interpretation to narrow down the types
inside the if block in such a case.
![]() |
|||
71 | $vol->BBC_ballons_idBBC_ballons = $command->getBBCBallonsIdBBCBallons(); |
||
0 ignored issues
–
show
It seems like you code against a concrete implementation and not the interface
CommandInterface as the method getBBCBallonsIdBBCBallons() does only exist in the following implementations of said interface: CreateFlightCommand .
Let’s take a look at an example: interface User
{
/** @return string */
public function getPassword();
}
class MyUser implements User
{
public function getPassword()
{
// return something
}
public function getDisplayName()
{
// return some name.
}
}
class AuthSystem
{
public function authenticate(User $user)
{
$this->logger->info(sprintf('Authenticating %s.', $user->getDisplayName()));
// do something.
}
}
In the above example, the authenticate() method works fine as long as you just pass instances of MyUser. However, if you now also want to pass a different implementation of User which does not have a getDisplayName() method, the code will break. Available Fixes
Note: PHP Analyzer uses reverse abstract interpretation to narrow down the types
inside the if block in such a case.
![]() |
|||
72 | $vol->nbrPax = $command->getNbrPax(); |
||
0 ignored issues
–
show
It seems like you code against a concrete implementation and not the interface
CommandInterface as the method getNbrPax() does only exist in the following implementations of said interface: CreateFlightCommand , CreateOrderCommand .
Let’s take a look at an example: interface User
{
/** @return string */
public function getPassword();
}
class MyUser implements User
{
public function getPassword()
{
// return something
}
public function getDisplayName()
{
// return some name.
}
}
class AuthSystem
{
public function authenticate(User $user)
{
$this->logger->info(sprintf('Authenticating %s.', $user->getDisplayName()));
// do something.
}
}
In the above example, the authenticate() method works fine as long as you just pass instances of MyUser. However, if you now also want to pass a different implementation of User which does not have a getDisplayName() method, the code will break. Available Fixes
Note: PHP Analyzer uses reverse abstract interpretation to narrow down the types
inside the if block in such a case.
![]() |
|||
73 | $vol->remarque = $command->getRemarque(); |
||
0 ignored issues
–
show
It seems like you code against a concrete implementation and not the interface
CommandInterface as the method getRemarque() does only exist in the following implementations of said interface: CreateFlightCommand .
Let’s take a look at an example: interface User
{
/** @return string */
public function getPassword();
}
class MyUser implements User
{
public function getPassword()
{
// return something
}
public function getDisplayName()
{
// return some name.
}
}
class AuthSystem
{
public function authenticate(User $user)
{
$this->logger->info(sprintf('Authenticating %s.', $user->getDisplayName()));
// do something.
}
}
In the above example, the authenticate() method works fine as long as you just pass instances of MyUser. However, if you now also want to pass a different implementation of User which does not have a getDisplayName() method, the code will break. Available Fixes
Note: PHP Analyzer uses reverse abstract interpretation to narrow down the types
inside the if block in such a case.
![]() |
|||
74 | $vol->incidents = $command->getIncidents(); |
||
0 ignored issues
–
show
It seems like you code against a concrete implementation and not the interface
CommandInterface as the method getIncidents() does only exist in the following implementations of said interface: CreateFlightCommand .
Let’s take a look at an example: interface User
{
/** @return string */
public function getPassword();
}
class MyUser implements User
{
public function getPassword()
{
// return something
}
public function getDisplayName()
{
// return some name.
}
}
class AuthSystem
{
public function authenticate(User $user)
{
$this->logger->info(sprintf('Authenticating %s.', $user->getDisplayName()));
// do something.
}
}
In the above example, the authenticate() method works fine as long as you just pass instances of MyUser. However, if you now also want to pass a different implementation of User which does not have a getDisplayName() method, the code will break. Available Fixes
Note: PHP Analyzer uses reverse abstract interpretation to narrow down the types
inside the if block in such a case.
![]() |
|||
75 | $vol->fk_type = $command->getFkType(); |
||
0 ignored issues
–
show
It seems like you code against a concrete implementation and not the interface
CommandInterface as the method getFkType() does only exist in the following implementations of said interface: CreateFlightCommand .
Let’s take a look at an example: interface User
{
/** @return string */
public function getPassword();
}
class MyUser implements User
{
public function getPassword()
{
// return something
}
public function getDisplayName()
{
// return some name.
}
}
class AuthSystem
{
public function authenticate(User $user)
{
$this->logger->info(sprintf('Authenticating %s.', $user->getDisplayName()));
// do something.
}
}
In the above example, the authenticate() method works fine as long as you just pass instances of MyUser. However, if you now also want to pass a different implementation of User which does not have a getDisplayName() method, the code will break. Available Fixes
Note: PHP Analyzer uses reverse abstract interpretation to narrow down the types
inside the if block in such a case.
![]() |
|||
76 | $vol->fk_pilot =$command->getFkPilot(); |
||
0 ignored issues
–
show
It seems like you code against a concrete implementation and not the interface
CommandInterface as the method getFkPilot() does only exist in the following implementations of said interface: CreateFlightCommand .
Let’s take a look at an example: interface User
{
/** @return string */
public function getPassword();
}
class MyUser implements User
{
public function getPassword()
{
// return something
}
public function getDisplayName()
{
// return some name.
}
}
class AuthSystem
{
public function authenticate(User $user)
{
$this->logger->info(sprintf('Authenticating %s.', $user->getDisplayName()));
// do something.
}
}
In the above example, the authenticate() method works fine as long as you just pass instances of MyUser. However, if you now also want to pass a different implementation of User which does not have a getDisplayName() method, the code will break. Available Fixes
Note: PHP Analyzer uses reverse abstract interpretation to narrow down the types
inside the if block in such a case.
![]() |
|||
77 | $vol->fk_organisateur = $command->getFkOrganisateur(); |
||
0 ignored issues
–
show
It seems like you code against a concrete implementation and not the interface
CommandInterface as the method getFkOrganisateur() does only exist in the following implementations of said interface: CreateFlightCommand .
Let’s take a look at an example: interface User
{
/** @return string */
public function getPassword();
}
class MyUser implements User
{
public function getPassword()
{
// return something
}
public function getDisplayName()
{
// return some name.
}
}
class AuthSystem
{
public function authenticate(User $user)
{
$this->logger->info(sprintf('Authenticating %s.', $user->getDisplayName()));
// do something.
}
}
In the above example, the authenticate() method works fine as long as you just pass instances of MyUser. However, if you now also want to pass a different implementation of User which does not have a getDisplayName() method, the code will break. Available Fixes
Note: PHP Analyzer uses reverse abstract interpretation to narrow down the types
inside the if block in such a case.
![]() |
|||
78 | $vol->kilometers = $command->getKilometers(); |
||
0 ignored issues
–
show
It seems like you code against a concrete implementation and not the interface
CommandInterface as the method getKilometers() does only exist in the following implementations of said interface: CreateFlightCommand .
Let’s take a look at an example: interface User
{
/** @return string */
public function getPassword();
}
class MyUser implements User
{
public function getPassword()
{
// return something
}
public function getDisplayName()
{
// return some name.
}
}
class AuthSystem
{
public function authenticate(User $user)
{
$this->logger->info(sprintf('Authenticating %s.', $user->getDisplayName()));
// do something.
}
}
In the above example, the authenticate() method works fine as long as you just pass instances of MyUser. However, if you now also want to pass a different implementation of User which does not have a getDisplayName() method, the code will break. Available Fixes
Note: PHP Analyzer uses reverse abstract interpretation to narrow down the types
inside the if block in such a case.
![]() |
|||
79 | $vol->cost = $command->getCost(); |
||
0 ignored issues
–
show
It seems like you code against a concrete implementation and not the interface
CommandInterface as the method getCost() does only exist in the following implementations of said interface: CreateFlightCommand , CreateOrderCommand .
Let’s take a look at an example: interface User
{
/** @return string */
public function getPassword();
}
class MyUser implements User
{
public function getPassword()
{
// return something
}
public function getDisplayName()
{
// return some name.
}
}
class AuthSystem
{
public function authenticate(User $user)
{
$this->logger->info(sprintf('Authenticating %s.', $user->getDisplayName()));
// do something.
}
}
In the above example, the authenticate() method works fine as long as you just pass instances of MyUser. However, if you now also want to pass a different implementation of User which does not have a getDisplayName() method, the code will break. Available Fixes
Note: PHP Analyzer uses reverse abstract interpretation to narrow down the types
inside the if block in such a case.
![]() |
|||
80 | $vol->fk_receiver = $command->getFkReceiver(); |
||
0 ignored issues
–
show
It seems like you code against a concrete implementation and not the interface
CommandInterface as the method getFkReceiver() does only exist in the following implementations of said interface: CreateFlightCommand .
Let’s take a look at an example: interface User
{
/** @return string */
public function getPassword();
}
class MyUser implements User
{
public function getPassword()
{
// return something
}
public function getDisplayName()
{
// return some name.
}
}
class AuthSystem
{
public function authenticate(User $user)
{
$this->logger->info(sprintf('Authenticating %s.', $user->getDisplayName()));
// do something.
}
}
In the above example, the authenticate() method works fine as long as you just pass instances of MyUser. However, if you now also want to pass a different implementation of User which does not have a getDisplayName() method, the code will break. Available Fixes
Note: PHP Analyzer uses reverse abstract interpretation to narrow down the types
inside the if block in such a case.
![]() |
|||
81 | $vol->justif_kilometers = $command->getJustifKilometers(); |
||
0 ignored issues
–
show
It seems like you code against a concrete implementation and not the interface
CommandInterface as the method getJustifKilometers() does only exist in the following implementations of said interface: CreateFlightCommand .
Let’s take a look at an example: interface User
{
/** @return string */
public function getPassword();
}
class MyUser implements User
{
public function getPassword()
{
// return something
}
public function getDisplayName()
{
// return some name.
}
}
class AuthSystem
{
public function authenticate(User $user)
{
$this->logger->info(sprintf('Authenticating %s.', $user->getDisplayName()));
// do something.
}
}
In the above example, the authenticate() method works fine as long as you just pass instances of MyUser. However, if you now also want to pass a different implementation of User which does not have a getDisplayName() method, the code will break. Available Fixes
Note: PHP Analyzer uses reverse abstract interpretation to narrow down the types
inside the if block in such a case.
![]() |
|||
82 | $vol->setPassengerNames($command->getPassengerNames()); |
||
0 ignored issues
–
show
It seems like you code against a concrete implementation and not the interface
CommandInterface as the method getPassengerNames() does only exist in the following implementations of said interface: CreateFlightCommand .
Let’s take a look at an example: interface User
{
/** @return string */
public function getPassword();
}
class MyUser implements User
{
public function getPassword()
{
// return something
}
public function getDisplayName()
{
// return some name.
}
}
class AuthSystem
{
public function authenticate(User $user)
{
$this->logger->info(sprintf('Authenticating %s.', $user->getDisplayName()));
// do something.
}
}
In the above example, the authenticate() method works fine as long as you just pass instances of MyUser. However, if you now also want to pass a different implementation of User which does not have a getDisplayName() method, the code will break. Available Fixes
Note: PHP Analyzer uses reverse abstract interpretation to narrow down the types
inside the if block in such a case.
![]() |
|||
83 | $vol->setOrderId($command->getOrderId()); |
||
0 ignored issues
–
show
It seems like you code against a concrete implementation and not the interface
CommandInterface as the method getOrderId() does only exist in the following implementations of said interface: CreateFlightCommand .
Let’s take a look at an example: interface User
{
/** @return string */
public function getPassword();
}
class MyUser implements User
{
public function getPassword()
{
// return something
}
public function getDisplayName()
{
// return some name.
}
}
class AuthSystem
{
public function authenticate(User $user)
{
$this->logger->info(sprintf('Authenticating %s.', $user->getDisplayName()));
// do something.
}
}
In the above example, the authenticate() method works fine as long as you just pass instances of MyUser. However, if you now also want to pass a different implementation of User which does not have a getDisplayName() method, the code will break. Available Fixes
Note: PHP Analyzer uses reverse abstract interpretation to narrow down the types
inside the if block in such a case.
![]() |
|||
84 | |||
85 | if (!$this->validator->isValid($vol, $_REQUEST)) { |
||
86 | throw new Exception(); |
||
87 | } |
||
88 | |||
89 | if(!$vol->getFlightType()->isBillingRequired() || $vol->isLinkedToOrder()){ |
||
90 | $vol->is_facture = true; |
||
91 | } |
||
92 | |||
93 | $result = $vol->create($this->user); |
||
94 | if($result <= 0){ |
||
95 | throw new Exception(); |
||
96 | } |
||
97 | |||
98 | $this->handleOrder($vol); |
||
99 | |||
100 | return $vol; |
||
101 | } |
||
102 | |||
103 | /** |
||
104 | * Handles the order of a flight. |
||
105 | * |
||
106 | * @param Bbcvols $flight |
||
107 | * |
||
108 | * @throws Exception |
||
109 | */ |
||
110 | private function handleOrder($flight) |
||
111 | { |
||
112 | $flight->fetch($flight->id); |
||
113 | |||
114 | if(!$flight->isLinkedToOrder()){ |
||
115 | return; |
||
116 | } |
||
117 | |||
118 | $order = $this->getOrderFromFlight($flight); |
||
119 | $order->add_object_linked('flightlog_bbcvols', $flight->getId()); |
||
120 | |||
121 | $order->fetch_lines(); |
||
122 | |||
123 | $qtyOrder = 0; |
||
124 | /** @var OrderLine $currentOrderLine */ |
||
125 | foreach($order->lines as $currentOrderLine){ |
||
126 | $qtyOrder += (int)$currentOrderLine->qty; |
||
127 | } |
||
128 | |||
129 | $passangersCount = $this->numberOfPassengersLinkedToOrder($order->id); |
||
130 | |||
131 | if($passangersCount != $qtyOrder){ |
||
132 | return; |
||
133 | } |
||
134 | |||
135 | if($order->statut == Commande::STATUS_VALIDATED){ |
||
136 | $order->cloture($this->user); |
||
137 | } |
||
138 | } |
||
139 | |||
140 | /** |
||
141 | * @param Bbcvols $flight |
||
142 | * |
||
143 | * @return Commande |
||
144 | * @throws Exception |
||
145 | */ |
||
146 | private function getOrderFromFlight($flight) |
||
147 | { |
||
148 | $flight->fetchOrder(); |
||
149 | return $flight->getOrder(); |
||
150 | } |
||
151 | |||
152 | /** |
||
153 | * @param int $orderId |
||
154 | * |
||
155 | * @return int |
||
156 | */ |
||
157 | private function numberOfPassengersLinkedToOrder($orderId) |
||
158 | { |
||
159 | $sql = sprintf('SELECT SUM(nbrPax) as total FROM `llx_bbc_vols` WHERE order_id = %s', $orderId); |
||
160 | |||
161 | $resql = $this->db->query($sql); |
||
162 | |||
163 | if ($resql) { |
||
164 | $num = $this->db->num_rows($resql); |
||
165 | $i = 0; |
||
166 | if ($num) { |
||
167 | while ($i < $num) { |
||
168 | $result = $this->db->fetch_array($resql); |
||
169 | return $result['total']; |
||
170 | } |
||
171 | } |
||
172 | } |
||
173 | |||
174 | return 0; |
||
175 | } |
||
176 | } |
Let’s take a look at an example:
In the above example, the authenticate() method works fine as long as you just pass instances of MyUser. However, if you now also want to pass a different implementation of User which does not have a getDisplayName() method, the code will break.
Available Fixes
Change the type-hint for the parameter:
Add an additional type-check:
Add the method to the interface: