this is an exemple of my code , that might help for diagnostic my problem.
class Toto :
<?php
/**
 * This is the model class for table "toto".
 *
 * The followings are the available columns in table 'toto':
 * @property integer $id
 .
 .
 .
 * @property TotoEatStuf[] $totoEatStufs
 .
 .
 .
 */
class Toto extends CActiveRecord
{
	/**
	 * Returns the static model of the specified AR class.
	 * @return Toto the static model class
	 */
	public static function model($className=__CLASS__)
	{
		return parent::model($className);
	}
	/**
	 * @return string the associated database table name
	 */
	public function tableName()
	{
		return 'toto';
	}
			.
			.
			.
	/**
	 * @return array relational rules.
	 */
	public function relations()
	{
		// NOTE: you may need to adjust the relation name and the related
		// class name for the relations automatically generated below.
		return array(
			.
			.
			'totoEatStufs' => array(self::HAS_MANY, 'TotoEatStuf', 'toto_id'),
			.
			.
		);
	}
			.
			.
			.
}
class stuf
<?php
/**
 * This is the model class for table "stuf".
 *
 * The followings are the available columns in table 'stuf':
 * @property integer $id
 .
 .
 * @property TotoEatStuf[] $totoEatStufs
 .
 .
 */
class Stuf extends CActiveRecord
{
	/**
	 * Returns the static model of the specified AR class.
	 * @return Stuf the static model class
	 */
	public static function model($className=__CLASS__)
	{
		return parent::model($className);
	}
	/**
	 * @return string the associated database table name
	 */
	public function tableName()
	{
		return 'stuf';
	}
			.
			.
			.
	/**
	 * @return array relational rules.
	 */
	public function relations()
	{
		// NOTE: you may need to adjust the relation name and the related
		// class name for the relations automatically generated below.
		return array(
			'totoEatStufs' => array(self::HAS_MANY, 'TotoEatStuf', 'stuf_id'),
			.
			.
		);
	}
			.
			.
			.
}
class TotoEatStuf
<?php
/**
 * This is the model class for table "toto_eat_stuf".
 *
 * The followings are the available columns in table 'toto_eat_stuf':
 * @property integer $toto_id
 * @property integer $stuf_id
 * @property string $date
 * @property integer $quantity
 *
 * The followings are the available model relations:
 * @property Stuf $stuf
 * @property Toto $toto
 */
class TotoEatStuf extends CActiveRecord
{
	/**
	 * Returns the static model of the specified AR class.
	 * @return TotoEatStuf the static model class
	 */
	public static function model($className=__CLASS__)
	{
		return parent::model($className);
	}
	/**
	 * @return string the associated database table name
	 */
	public function tableName()
	{
		return 'toto_eat_stuf';
	}
	/**
	 * @return array validation rules for model attributes.
	 */
	public function rules()
	{
		// NOTE: you should only define rules for those attributes that
		// will receive user inputs.
		return array(
			array('toto_id, stuf_id, date, quantity', 'required'),
			array('toto_id, stuf_id, quantity', 'numerical', 'integerOnly'=>true),
			// The following rule is used by search().
			// Please remove those attributes that should not be searched.
			array('toto_id, stuf_id, date, quantity', 'safe', 'on'=>'search'),
		);
	}
	/**
	 * @return array relational rules.
	 */
	public function relations()
	{
		// NOTE: you may need to adjust the relation name and the related
		// class name for the relations automatically generated below.
		return array(
			'stuf' => array(self::BELONGS_TO, 'Stuf', 'stuf_id'),
			'toto' => array(self::BELONGS_TO, 'Toto', 'toto_id'),
		);
	}
	/**
	 * @return array customized attribute labels (name=>label)
	 */
	public function attributeLabels()
	{
		return array(
			'toto_id' => 'Toto',
			'stuf_id' => 'Stuf',
			'date' => 'Date',
			'quantity' => 'Quantity',
		);
	}
	/**
	 * Retrieves a list of models based on the current search/filter conditions.
	 * @return CActiveDataProvider the data provider that can return the models based on the search/filter conditions.
	 */
	public function search()
	{
		// Warning: Please modify the following code to remove attributes that
		// should not be searched.
		$criteria=new CDbCriteria;
		$criteria->compare('toto_id',$this->toto_id);
		$criteria->compare('stuf_id',$this->stuf_id);
		$criteria->compare('date',$this->date,true);
		$criteria->compare('quantity',$this->quantity);
		return new CActiveDataProvider($this, array(
			'criteria'=>$criteria,
		));
	}
}
in action :
$totos = Toto::model()->findAll();
$i=0;
foreach ($totos as $toto) {
	$toto->totoEatStufs = TotoConsommeAliment::model()->findAllByAttributes(array('toto_id' => $toto->id));
 }
$this->render('index', array(
	'totos' => $totos,
));
and the code that work in windows and not work in ubuntu is :
foreach ($totos as $toto) {
   foreach ($toto->totoEatStufs as $eatStuf) {
		if (in_array($eatStuf->stuf->name, $stufs)) {
			
			$stufs[] = $eatStuf->stuf->name;
			$sommeAliments[$eatStuf->stuf->name] = $eatStuf->quantite;
		} else {
			
			$sommeAliments[$eatStuf->stuf->name]+=$eatStuf->quantite;
		}
	}
}
it’s tell me invalid forech in the second foreach loop