angular length php 5.5

gallifrey

Grünschnabel
Hallo zusammen
Ich habe ein kleines Problem das ich irgend wie nicht lösen kann.

Ich habe eine Application die mir über ein Angular script den HD verbrauch eines Users ausliest.
Nach einem Update auf php 5.5 kann ich die Gruppen nicht mehr anwählen.
Das komisch es wenn ich das groups.php file aufrufe erhalte ich alle nötigen infos in einem Array.
Das selber über du.php dort erhalte ich alle infos über die User die in dieser Gruppe sind.

Wenn ich aber das view script aufrufe erhalte ich immer
PHP:
angular.js:11655 TypeError: Cannot read property 'length' of undefined
    at app.js:14
    at angular-resource.js:627
    at processQueue (angular.js:13248)
    at angular.js:13264
    at Scope.$eval (angular.js:14466)
    at Scope.$digest (angular.js:14282)
    at Scope.$apply (angular.js:14571)
    at done (angular.js:9698)
    at completeRequest (angular.js:9888)
    at XMLHttpRequest.requestLoaded (angular.js:9829)

Hier noch das app.js script

PHP:
angular.module('owncloud', [ 'ngResource' ])
            .controller('QuotaController', function QuotaController($scope, $resource, $location) {
                var Groups = $resource('groups.php');
                var DiskUsage = $resource('du.php?group=:groupId', {groupId:'@id'});
                var initializing = true;
                $scope.groups = [];
                $scope.groupSummary = {};
                $scope.diskUsage = [];
                $scope.loading = true;
                $scope.orderByField = 'userid';
                $scope.reverseSort = false;
                $scope.selectedGroup = $location.search().group;
                Groups.get({}, function(data) {
                    for(var i = 0; i < data.groups.length; i++) {
                        $scope.groups.push({
                            id: data.groups[i],
                            label: data.groups[i]
                        });
                    }
                });

                $scope.$watch('selectedGroup', function() {
                    if(initializing) {
                        initializing = false;
                    } else {
                        update();
                    }
                });

                function update() {
                    if($scope.selectedGroup) {
                        $location.search('group', $scope.selectedGroup);
                        $scope.loading = true;
                        $scope.groupSummary = {};
                        DiskUsage.get({groupId: $scope.selectedGroup}, function(data) {
                            $scope.diskUsage = data.diskUsage;
                            for(var i in data.diskUsage) {
                                for(var j in data.diskUsage[i].groups) {
                                    var gid = data.diskUsage[i].groups[j];

                                    if(gid !== 'sus' && gid !== 'lp') {
                                        continue;
                                    }

                                    if(typeof $scope.groupSummary[gid] === 'undefined') {
                                        $scope.groupSummary[gid] = {
                                            id: gid,
                                            userCount: 0,
                                            usage: 0,
                                            quota: 0,
                                            percent: 0,
                                            planedQuota: gid === 'sus' ? 1073741824 /* 1GB */ : (gid === 'lp' ? 21474836480 /* 20GB*/ : false)
                                        };
                                    }
                                    $scope.groupSummary[gid].userCount = $scope.groupSummary[gid].userCount + 1;
                                    $scope.groupSummary[gid].usage = $scope.groupSummary[gid].usage + data.diskUsage[i].usage;
                                    $scope.groupSummary[gid].quota = $scope.groupSummary[gid].quota + data.diskUsage[i].quota;
                                    $scope.groupSummary[gid].precent = 100 / $scope.groupSummary[gid].quota * $scope.groupSummary[gid].usage;
                                    $scope.groupSummary[gid].planedQuotaTotal = $scope.groupSummary[gid].userCount * $scope.groupSummary[gid].planedQuota;
                                }
                            }
                            $scope.loading = false;
                        });
                    }
                }

                update();

                $scope.getTotal = function getTotal(key) {
                    var total = 0;
                    for(var i = 0; i < $scope.diskUsage.length; i++) {
                    /*for(var i  in $scoep.diskUsage) {*/
                        total += parseInt($scope.diskUsage[i][key]);
                    }
                    return total;
                };

                $scope.getGroupTotal = function getGroupTotal(key) {
                    var total = 0;
                    for(var i in $scope.groupSummary) {
                        total += parseInt($scope.groupSummary[i][key]);
                    }
                    return total;
                };
            })
            .filter('bytes', function() {
                return function(bytes, precision) {
                    if (bytes == 0) return '0';
                    if (isNaN(parseFloat(bytes)) || !isFinite(bytes)) return '-';
                    if (typeof precision === 'undefined') precision = 1;
                    var units = ['bytes', 'kB', 'MB', 'GB', 'TB', 'PB'],
                        number = Math.floor(Math.log(bytes) / Math.log(1024));
                    return (bytes / Math.pow(1024, Math.floor(number))).toFixed(precision) +  ' ' + units[number];
                }
            });

Ich hoffe jemand kann mir helfen.

Besten Dank
 
Zurück