Strange Error: Trying to get property of non-object

Hi there,
i try to send Apple Push Notification with a control form.
I works quite good, PN to APNS Server and to iPhone.
But I always get an error message.

[SIZE=12px]Trying to get property of non-object[/SIZE]

If i change code, the error message ‘moves’ form one to another line.
Very strange.

Does anybody has an idea??

Can I stop displaying the error (bad solution, but a solution :frowning: )

Kind regards
Rainer


Here is the code in onValidate

// ******************************************************************************************
// Script dient dazu, Push-Nachrichten an alle Kunden zu senden
// ******************************************************************************************
define(“LIB_DIR” , “…(code deleted)…”);

$msg = {nachricht};

// **************************************************************************************************
// Fragt die Token alle Kunden eines Optikers ab,
// **************************************************************************************************
$check_sql = "SELECT
DeviceName,Token
FROM
(code deleted)
WHERE
System = ‘Apple’ ";

sc_lookup(dataset, $check_sql);

if (false == {dataset}) {
sc_error_message({dataset_erro});
}
elseif ({dataset}->EOF) {
sc_alert(“Leider ist kein Ger?t f?r diesen Kunden registriert”);
}
else
{
$mySound = ‘default’;
$fehlerfrei = TRUE;
$starttoken = 0;

$pushArray = array('alert' => {Nachricht},'sound' => $mySound);
$pl['aps'] = $pushArray;
$payload=json_encode($pl);

**** ERROR IS at THIS LINE ********
$apnsHost = ‘gateway.push.apple.com’;
$apnsPort = 2195;
$apnsCert = LIB_DIR.’/xxxx-prod.pem’;

if (!file_exists($apnsCert)) {
    sc_alert("Zertifikat nicht gefunden");
}
else 
{ .......

Here is the code from …_apl.php file on server

elseif ($this->dataset->EOF) {
$this->nm_mens_alert[] = “Leider ist kein Ger?t f?r diesen Kunden registriert”; if ($this->NM_ajax_flag) { $this->sc_ajax_alert(“Leider ist kein Ger?t f?r diesen Kunden registriert”); }}
else {
$mySound = ‘default’;
$fehlerfrei = TRUE;
$starttoken = 0;
$pushArray = array(‘alert’ => $this->nachricht ,‘sound’ => $mySound);
$pl[‘aps’] = $pushArray;
$payload=json_encode($pl);
$apnsHost = ‘gateway.push.apple.com’;
$apnsPort = 2195;
$apnsCert = LIB_DIR.’/xxxx-prod.pem’;
if (!file_exists($apnsCert)) {
$this->nm_mens_alert[] = “Zertifikat nicht gefunden”; if ($this->NM_ajax_flag) { $this->sc_ajax_alert(“Zertifikat nicht gefunden”); }}
else {$i = 0;
$open = false;
$datanumber = count($this->dataset );
while($i < $datanumber){
if($i>=$starttoken){
if($open==FALSE){

Found the error

=> elseif ({dataset}->EOF)

Strange was, that the error was shown in other codelines

changed to

$check_sql = “SELECT
DeviceName,
Token
FROM

WHERE
System = ‘Apple’”;
sc_lookup(dataset, $check_sql);

if (isset({dataset[0][0]})) // Row found
{
}
else {

}

Works well now.

Regards
Rainer