You are not logged in.
Pages: 1
I came across a nasty bug earlier, severe enough to prevent logins:
If you delete all the ACLs from your system, then logout and back in again, you'll probably find that oneye crashes. The error message given in the Error Console is:
INVALID ARGUMENT FOR FOREACH() IN .../system/kernal/kernal.eyecode on line 398
On closer inspection, it appears that oneye can't cope if the file .../system/conf/ACL/acl.xml exists but has no ACL rules inside it. Deleting the file solves the problem - until you create and then delete new ACL rules in the future.
Hope you don't mind, but I took the liberty of working out a solution in code. Changing Lines 489-492 (or thereabouts) in the function loadACLTables() in kernal.eyecode from this...
if ($file{0} != '.') {
$found = 1;
$myArray = eyeXML('xml2array', array(file_get_contents($aclpath . $file)));
$ACL = array_merge($ACL,$myArray);
}
...to this...
if ($file{0} != '.') {
$myArray = eyeXML('xml2array', array(file_get_contents($aclpath . $file)));
if (is_array($myArray[GACL][0])) {
$found = 1;
$ACL = array_merge($ACL,$myArray);
}
}
...solves the issue. Essentially, it checks to see if any ACL rules are actually written and preventing $found from becoming '1' if not.
Offline
You're absolutely right. That's a problem in our XML implementation, that converts empty arrays into an empty string...
Just comitted your fix, thanks.
Best regards,
Lars Knickrehm
The oneye project.
Offline
Thanks, and I'm really sorry, but I'm going to have to disagree with line 491
if (is_array($myArray) === true) {
as this checks to see if $myArray is an array. Which it is whether there are ACL rules or not. I'm afraid line 491 really does need to be
if (is_array($myArray[GACL][0]) === true) {
If it helps, take a look at this print_r output of $myArray with no ACL rules:
Array
(
[GACL] => Array
(
[0] =>
)
)
The first Array is equivalent to $myArray, the second Array is equivalent to $myArray[GACL], it's $myArray[GACL][0] that isn't an array in this case.
My apologies for disagreeing, but as you refer to it as 'my' fix, I'd like to make sure it works
Edit: Ah, just noticed your change on line 384. I didn't think anything else but loadACLTables() wrote to the $ACL global? So checking if $myArray[GACL][0] is an array on line 384 is a little bit after the fact. And as that particular line will be run every time a call to a service is made...
Last edited by s0600204 (2012-01-24 02:33:59)
Offline
Pages: 1