[RESOLVED] JTable::addIncludePath bug, and clarification... - Joomla! Forum - community, help and support
first, thought forum being closed down? no?
second, have located believe bug in jtable::addincludepath.
there usage of method designed retrieve $paths variables. invoked not supplying parameter (i.e. jtable::addincludepath()).
the default value assigned ''.
then there check:
this add specified path array if $path variable not empty, , if value not in array already.
if $path '', should automatically fail our condition because $path should empty.
but... before have:
this line force $path array (because $path should array directory elements).
the problem forcing $path array, becomes non empty.
i recommend 1 of 2 possible solutions:
1. change default value null. in case, forced array empty.
2. move settype inside of if statement, $path gets checked beforehand , gets forced array.
imo, important fix, because everytime addincludepath called without parameter being passed, empty entry added array. problem machines have open basedir restrictions because means / added list of directories search using (e.g. jmodel::_createtable), , produce warning. (see http://forum.joomla.org/index.php/topic,142746.0.html)
the other problem noticed method haven't checked out, more experienced might able confirm whether or not problem.
i put print_r inside component so:
this produced following:
notice there 2 empty entries.
this suggests not working properly. i'm guessing because method adding strings array $paths, $path array. method foreach through array $path , add individual elements $paths, check array in $paths. doesn't work, it?
i suggest move in_array check inside of foreach each individual path checked see if in array.
if more helpful me submit patch, let me know, there level of developer intelligence required beyond confident about, think better 1 of devs implement him/her self.
ian
second, have located believe bug in jtable::addincludepath.
there usage of method designed retrieve $paths variables. invoked not supplying parameter (i.e. jtable::addincludepath()).
the default value assigned ''.
then there check:
code: select all
if (!empty( $path ) && !in_array( $path, $paths ))
this add specified path array if $path variable not empty, , if value not in array already.
if $path '', should automatically fail our condition because $path should empty.
but... before have:
code: select all
settype($path, 'array');
this line force $path array (because $path should array directory elements).
the problem forcing $path array, becomes non empty.
i recommend 1 of 2 possible solutions:
1. change default value null. in case, forced array empty.
2. move settype inside of if statement, $path gets checked beforehand , gets forced array.
imo, important fix, because everytime addincludepath called without parameter being passed, empty entry added array. problem machines have open basedir restrictions because means / added list of directories search using (e.g. jmodel::_createtable), , produce warning. (see http://forum.joomla.org/index.php/topic,142746.0.html)
the other problem noticed method haven't checked out, more experienced might able confirm whether or not problem.
i put print_r inside component so:
code: select all
print_r( jtable::addincludepath() );
this produced following:
code: select all
array ( [0] => /var/www/trunk/libraries/joomla/database/table [1] => [2] => )
notice there 2 empty entries.
this suggests
code: select all
!in_array( $path, $paths )
i suggest move in_array check inside of foreach each individual path checked see if in array.
if more helpful me submit patch, let me know, there level of developer intelligence required beyond confident about, think better 1 of devs implement him/her self.
ian
thanks ian. changed default value of $path null , seems resolve problem.
updated in rev 6761. let me know how works.
tcp
code: select all
array ( [0] => /private/var/www/domains/joomla/html/libraries/joomla/database/table [1] => /private/var/www/domains/joomla/html/administrator/components/com_lqm/tables )
updated in rev 6761. let me know how works.
tcp
Comments
Post a Comment