Private variable being added to the session automatically php

0

I'm going to try to explain the problem, but I've already found that I can not find words to search for what happened:

I have a user.php file

<?php

    class Usuario{

        private $grupoPermissao = array(
                'superAdmin' => array(
                    'rodrigo_segatto','tiago_silva'
                )
        );

        function __construct(){
            session_start();
        }

        public function getGrupoPermissao(){
            return $this->grupoPermissao;
        }

        public function verificaUsuario(){
            if (!$this->usuarioEstaLogado()){
                $flash = new Flash();
                $flash->setFlash('Você não deve fazer login antes de acessar a página!','alert-danger');
                header('Location:../../View/Sistema/login.php');
                die();
            }
        }

    }

The process-login.php file, which redirects to the index:

$flash = new Flash();
$flash->setFlash('Você efetuou login com sucesso!', 'alert-success');
header("Location:../../View/Sistema/index.php");

And the index.php file, with the following code start:

<?php 
    require_once '../../AutoLoad.php'; 
    $usuario = new Usuario(); $usuario->verificaUsuario(); 
?>

In index, if I log in before giving New to User, and print SESSION, will print:

Array
(
    (
        [usuario] => rodrigo_segatto
        [email] => rodrigo_segatto@...
        [nome] => RODRIGO SEGATTO
    )
)

Otherwise, if you print the SESSION after giving New to the user, you will create an object inside with my private variable Permission group , as shown below:

Array
(
    [usuario] => Usuario Object
        (
            [grupoPermissao:Usuario:private] => Array
                (
                    [superAdmin] => Array
                        (
                            [0] => rodrigo_segatto
                            [1] => tiago_silva
                        )
                )

        )

    [email] => [email protected]
    [nome] => RODRIGO SEGATTO
)

The strangest thing is that the same system works perfectly local , however, on the linux server this occurs.

    
asked by anonymous 25.07.2017 / 13:27

0 answers