PHP class variable not assigned -


i having strange issue php code. php version using php 5.3.2-1ubuntu4.30 suhosin-patch.

the issue having cannot assign variable part of class

namespace stats\potsportstats;   use pdo; use stats\port; use stats\potsportstats\iphosts\iphosts;  class portstats extends port {      public $vcportonhookstatus;     public $vcportimpedance;     public $iphosts;      /**      * @param $secretvalue int      * @param $pdo_conn pdo      * @return portstats[]      */     public static function getall($secretvalue, $pdo_conn){         try {             $query =                 "select * secrettable secretcolumn = :secretvalue";             $pdo_stmt = $pdo_conn->prepare($query);             $pdo_stmt->bindvalue(":secretvalue", $secretvalue, pdo::param_int);             $pdo_stmt->execute();              /** @var portstats $result */ //this works right             $result = $pdo_stmt->fetchall(pdo::fetch_class, __class__);              //other assigned array of iphosts classes             $other = iphosts::getall($secretvalue, $pdo_conn);             echo json_encode($other);             //checked result, there.             $result->iphosts = $other;              //check assigned value             var_dump($result->iphosts);             //value null         } catch (\pdoexception $e) {             //nothing here             var_dump($e);         }         //the rest of result returned correctly         return $result;     } 

is there wrong code overlooking? there kind of bug inside of version of php did not find when looked? appreciated. please ask if need more clarification.

i think problem in line:

$result = $pdo_stmt->fetchall(pdo::fetch_class, __class__); 

are sure pdo_stmt->fetchall(...) returns object of type portstats? don't think does. returns array. , more so, don't think can implicitly cast class portstats.

try:

$results=$pdo_stmt->fetchall(pdo::fetch_class, __class__); foreach($results $result){     var_dump($result); } 

Comments

Popular posts from this blog

sql - invalid in the select list because it is not contained in either an aggregate function -

Angularjs unit testing - ng-disabled not working when adding text to textarea -

How to start daemon on android by adb -