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.
1 | <?php |
||||
2 | |||||
3 | namespace XoopsModules\Pedigree; |
||||
4 | |||||
5 | /* |
||||
6 | * You may not change or alter any portion of this comment or credits |
||||
7 | * of supporting developers from this source code or any supporting source code |
||||
8 | * which is considered copyrighted (c) material of the original comment or credit authors. |
||||
9 | * |
||||
10 | * This program is distributed in the hope that it will be useful, |
||||
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
||||
13 | */ |
||||
14 | |||||
15 | /** |
||||
16 | * @package XoopsModules\Pedigree |
||||
17 | * @copyright {@link https://xoops.org/ XOOPS Project} |
||||
18 | * @license {@link https://www.gnu.org/licenses/gpl-2.0.html GNU GPL 2 or later} |
||||
19 | * @author XOOPS Module Dev Team |
||||
20 | */ |
||||
21 | |||||
22 | use XoopsModules\Pedigree\{ |
||||
23 | Helper |
||||
0 ignored issues
–
show
|
|||||
24 | }; |
||||
25 | |||||
26 | \defined('XOOPS_ROOT_PATH') || die('Restricted access'); |
||||
27 | |||||
28 | /** |
||||
29 | * Class Pedigree\Temp |
||||
30 | */ |
||||
31 | class Temp extends \XoopsObject |
||||
32 | { |
||||
33 | //Constructor |
||||
34 | |||||
35 | public function __construct() |
||||
36 | { |
||||
37 | parent::__construct(); |
||||
38 | $this->initVar('id', \XOBJ_DTYPE_INT, null, false); |
||||
39 | $this->initVar('pname', \XOBJ_DTYPE_TXTAREA, null, true); |
||||
40 | $this->initVar('id_owner', \XOBJ_DTYPE_INT, null, false); |
||||
41 | $this->initVar('id_breeder', \XOBJ_DTYPE_INT, null, false); |
||||
42 | $this->initVar('user', \XOBJ_DTYPE_TXTBOX, null, false, 25); |
||||
43 | $this->initVar('roft', \XOBJ_DTYPE_TXTAREA, null, false); |
||||
44 | $this->initVar('mother', \XOBJ_DTYPE_INT, null, false); |
||||
45 | $this->initVar('father', \XOBJ_DTYPE_INT, null, false); |
||||
46 | $this->initVar('foto', \XOBJ_DTYPE_TXTBOX, null, false, 255); |
||||
47 | $this->initVar('coi', \XOBJ_DTYPE_TXTBOX, null, false, 10); |
||||
48 | } |
||||
49 | |||||
50 | /** |
||||
51 | * |
||||
52 | * @return string name |
||||
53 | */ |
||||
54 | public function __toString() |
||||
55 | { |
||||
56 | return $this->getVar('pname'); |
||||
0 ignored issues
–
show
|
|||||
57 | } |
||||
58 | |||||
59 | /** |
||||
60 | * @param bool $action |
||||
61 | * |
||||
62 | * @return \XoopsThemeForm |
||||
63 | */ |
||||
64 | public function getForm($action = false) |
||||
65 | { |
||||
66 | if (false === $action) { |
||||
67 | $action = $_SERVER['REQUEST_URI']; |
||||
68 | } |
||||
69 | |||||
70 | $title = $this->isNew() ? \sprintf(\_AM_PEDIGREE_PEDIGREE_TEMP_ADD) : \sprintf(\_AM_PEDIGREE_PEDIGREE_TEMP_EDIT); |
||||
71 | |||||
72 | require_once $GLOBALS['xoops']->path('class/xoopsformloader.php'); |
||||
73 | |||||
74 | $form = new \XoopsThemeForm($title, 'form', $action, 'post', true); |
||||
75 | $form->setExtra('enctype="multipart/form-data"'); |
||||
76 | $form->addElement(new \XoopsFormTextArea(\_AM_PEDIGREE_PEDIGREE_TEMP_PNAME, 'pname', $this->getVar('pname'), 10, 47), true); |
||||
0 ignored issues
–
show
It seems like
$this->getVar('pname') can also be of type array and array ; however, parameter $value of XoopsFormTextArea::__construct() does only seem to accept string , maybe add an additional type check?
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
![]() |
|||||
77 | $form->addElement(new \XoopsFormText(\_AM_PEDIGREE_PEDIGREE_TEMP_ID_OWNER, 'id_owner', 10, 11, $this->getVar('id_owner')), false); |
||||
0 ignored issues
–
show
It seems like
$this->getVar('id_owner') can also be of type array and array ; however, parameter $value of XoopsFormText::__construct() does only seem to accept string , maybe add an additional type check?
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
![]() |
|||||
78 | $form->addElement(new \XoopsFormText(\_AM_PEDIGREE_PEDIGREE_TEMP_ID_BREEDER, 'id_breeder', 10, 11, $this->getVar('id_breeder')), false); |
||||
79 | $form->addElement(new \XoopsFormText(\_AM_PEDIGREE_PEDIGREE_TEMP_USER, 'user', 25, 25, $this->getVar('user')), false); |
||||
80 | $form->addElement(new \XoopsFormText(\_AM_PEDIGREE_PEDIGREE_TEMP_ROFT, 'roft', 2, 1, $this->getVar('roft')), false); |
||||
81 | $form->addElement(new \XoopsFormText(\_AM_PEDIGREE_PEDIGREE_TEMP_MOTHER, 'mother', 5, 5, $this->getVar('mother')), false); |
||||
82 | $form->addElement(new \XoopsFormText(\_AM_PEDIGREE_PEDIGREE_TEMP_FATHER, 'father', 5, 5, $this->getVar('father')), false); |
||||
83 | $form->addElement(new \XoopsFormText(\_AM_PEDIGREE_PEDIGREE_TEMP_FOTO, 'foto', 25, 255, $this->getVar('foto')), false); |
||||
84 | |||||
85 | //$Handler = xoops_getModuleHandler("animal_", $xoopsModule->getVar("dirname")); |
||||
86 | $tempHandler = Helper::getInstance()->getHandler('Temp'); |
||||
87 | $criteria = new \Criteria(); |
||||
0 ignored issues
–
show
The call to
Criteria::__construct() has too few arguments starting with column .
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
This check compares calls to functions or methods with their respective definitions. If the call has less arguments than are defined, it raises an issue. If a function is defined several times with a different number of parameters, the check may pick up the wrong definition and report false positives. One codebase where this has been known to happen is Wordpress. Please note the @ignore annotation hint above. ![]() |
|||||
88 | $criteria->setSort('id'); |
||||
89 | $criteria->order = 'ASC'; |
||||
90 | $tempObjArr = $tempHandler->getAll(); |
||||
0 ignored issues
–
show
|
|||||
91 | //@todo - the keys below aren't right for XoopsObjectTree. _id should be id, then need to determine which lineage (father/mother) |
||||
92 | // and then use the appropriate key ('father', 'mother'). Can't really do a "combined" tree using XoopsObjectTree only. |
||||
93 | //$mytree = new \XoopsObjectTree($tmpObjArr, '_id', '_pid'); |
||||
94 | //$form->addElement(new \XoopsFormLabel(\_AM_PEDIGREE_PEDIGREE_TEMP_COI, $mytree->makeSelBox('_pid', '_title', '--', $this->getVar('_pid'), false))); |
||||
95 | $mytree = new \XoopsObjectTree($tmpObjArr, 'id', 'coi'); |
||||
96 | $form->addElement($mytree->makeSelectElement(\_AM_PEDIGREE_PEDIGREE_TEMP_COI, 'coi', '--', $this->getVar('coi'), false)); |
||||
0 ignored issues
–
show
It seems like
$this->getVar('coi') can also be of type array and array ; however, parameter $selected of XoopsObjectTree::makeSelectElement() does only seem to accept string , maybe add an additional type check?
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
![]() |
|||||
97 | |||||
98 | $form->addElement(new \XoopsFormHidden('op', 'save_pedigree_temp')); |
||||
99 | |||||
100 | //Submit buttons |
||||
101 | $buttonTray - new \XoopsFormButtonTray('submit', _SUBMIT, 'submit', null); |
||||
0 ignored issues
–
show
Comprehensibility
Best Practice
introduced
by
|
|||||
102 | /* |
||||
103 | $buttonTray = new \XoopsFormElementTray('', ''); |
||||
104 | $submit_button = new \XoopsFormButton('', 'submit', _SUBMIT, 'submit'); |
||||
105 | $buttonTray->addElement($submit_button); |
||||
106 | |||||
107 | $cancel_button = new \XoopsFormButton('', '', _CANCEL, 'cancel'); |
||||
108 | $cancel_button->setExtra('onclick="history.go(-1)"'); |
||||
109 | $buttonTray->addElement($cancel_button); |
||||
110 | */ |
||||
111 | $form->addElement($buttonTray); |
||||
112 | |||||
113 | return $form; |
||||
114 | } |
||||
115 | } |
||||
116 |
Let?s assume that you have a directory layout like this:
and let?s assume the following content of
Bar.php
:If both files
OtherDir/Foo.php
andSomeDir/Foo.php
are loaded in the same runtime, you will see a PHP error such as the following:PHP Fatal error: Cannot use SomeDir\Foo as Foo because the name is already in use in OtherDir/Foo.php
However, as
OtherDir/Foo.php
does not necessarily have to be loaded and the error is only triggered if it is loaded beforeOtherDir/Bar.php
, this problem might go unnoticed for a while. In order to prevent this error from surfacing, you must import the namespace with a different alias: