Discussion Forums  >  Self Hosted Control Panels

Replies: 3    Views: 82

Rishav
Code is Art
Profile
Posts: 153
Reg: Jan 26, 2012
Dubai
8,780
04/15/13 05:02 AM (12 years ago)

PHP error while sending push

Three days ago i had posted about the issue i am facing in self hosted..Did't got any solution in that thread..Now its lost in the forum so posting again.. Please help.. Here is the error i am facing when sending push to Android users. Oops, a PHP error was trapped. File: /home/user/bt_v15/bt_app/bt_pushNotifications_AJAX.php Line: 323 Message: Undefined property: stdClass::$error
 
David @ buzztouch
buzztouch Evangelist
Profile
Posts: 6866
Reg: Jan 01, 2010
Monterey, CA
78,840
like
04/15/13 12:39 PM (12 years ago)
Hi Rishav: This is for sure a PHP thing. It's hard to know what's causing it without actually seeing your install and doing a little debugging. It's also hard to know how much of this you understand, in terms of debugging yourself. PHP ninja? Newcomer? Etc, etc. In most cases a stdClass error is related to PHP not being able to instantiate a class it's trying to instantiate. In this case, this error message is happening inside the fnProcessGCMResults method. This method begins on line 262 of this file (bt_pushNotifications_AJAX.php). The first line of this method looks like this: function fnProcessGCMResults($appGuid, $gcmData, $tokens, $useDev = true) So, that's the method that is failing. Why it's failing is hard to know. You can see that it's taking a few paramaters...the appGuid, the gcmData, etc. Maybe try adding some debug statements in PHP until you figure out where it's failing. The methods is called on line 650 where the code does: $gcmData = fnSendGCMMessage($googleProjectApiKey, $batchTokens, $messageParts); It's important to figure out what the value of $gcmData is after that call. This should be the results from the Google server after trying to send the push. You'll need to "echo" the value of the $gcmData variable somewhere to determine it's value. If this is beyond your level of understanding, or something you're intimidated by, I can try to log into your server to lend a hand. I'm not sure when I can do this but I'll do my best to get to it soon. If you want me to try this you'll need to send me an email to david 'at' buzztouch.com Include in the email: 1) A login to the control panel. You'll need to make me one. 2) An FTP login so I can access the PHP files. Send me FTP host, user, pass. I think you can figure this out :-)
 
Rishav
Code is Art
Profile
Posts: 153
Reg: Jan 26, 2012
Dubai
8,780
like
04/16/13 04:19 AM (12 years ago)
Thanks David for the idea to see what is in $gcmData first...using the isset function in the else block in fnProcessGCMResults solved the issue I just used if(isset($device_response->error)) condition after the else block began as i noticed in the while dumping the data of $gcmData that some java objects didn't contained the error field in the them. And i event noticed the invalidregistration and NotRegistered entries were not being deleted from my database then using var_dump i found out that instead of Design mode it was trying to delete the entry with Live Mode so it was unable to to find the entry in the sql so i just removed the condition to check whether design or live while deleting and now it works great. And more thing, i saw many people in the forum are not getting the notification sent message shown in their panel for android users. I even faced this issue earlier. It occurs if the server's php version is not greater then equal to 5.3, as i had php 5.2 earlier so i had upgrade the php in my vps. This error occurs as the method json_last_error used in our push code was introduced in php 5.3 onward releases only.
 
Rachelle-Joanne
Aspiring developer
Profile
Posts: 65
Reg: Jan 15, 2013
Lagos
650
like
12/23/13 08:21 AM (12 years ago)
please does anyone know how to set up push notifications on BT 3.0
 

Login + Screen Name Required to Post

pointerLogin to participate so you can start earning points. Once you're logged in (and have a screen name entered in your profile), you can subscribe to topics, follow users, and start learning how to make apps like the pros.