PHP_Incomplete_Class Object / Different responses from print_r - serialization

When I issue a print_r ($_SESSION) on my local server I receive the following
Array
(
[group] => Rich Primosch
[ok] => 1
[golfer] => Fritz Davis
[uniq] => 38
[fname] => Fritz
[lname] => Davis
[hphone] => 352-487-0597
[cphone] => 352-487-6189
[email] => fritz#hadleyvillage.org
[vid] => 527571
[handicap] => 23
[admin] => 0
[page] => signup.php
)
However when I issue the same print_r ($_SESSION) on the webhost's server I get this response
Array
(
[group] => __PHP_Incomplete_Class Object
(
[__PHP_Incomplete_Class_Name] => window
[curdate] => 1293771600
[datetime] => 1293813211
[monplay] => 1294030800
[wedplay] => 1294203600
[friplay] => 1294376400
[monclose] => 1293750000
[wedclose] => 1293922800
[friclose] => 1294030740
[monopen] => 1293426000
[wedopen] => 1293426000
[friopen] => 1293426000
[ismonopen] =>
[iswedopen] => 1
[isfriopen] => 1
)
[ok] => 1
[golfer] => mysqli_result Object
(
)
[uniq] => 175
[fname] => Fritz
[lname] => Davis
[hphone] => 352-487-0597
[cphone] => 352-487-6189
[email] => fritz#hadleyvillage.org
[vid] => 723234
[handicap] => 23
[admin] => 0
[page] => signup.php
)
Why I even see the incomplete class object, I have no idea. It is never assigned to a $_SESSION variable and yes, the class definition is included before session_start().
There are several differences in the two responses. My question is why? Is there a difference in settings somewhere or is there a programming error.
I have seen many references to the PHP_Incomplete_Class Object but they all say make sure that the class definition proceeds session_start. In my case it does but that should be inconsequential because I only use the object on one page and do not store it in a session.
Suggestions are appreciated.
-dmd-

try var_dump instead in both machines, it may say something interesting, "group" value seems to be an object, of what type? does it have a __sleep() magic method?
ensure your test machine and production server has the same php version to better understand the issue.
#see http://www.php.net/manual/en/language.oop5.serialization.php

Related

How to change database

I am currently on a vps from ovh with prestashop 1.7.5. I ordered a CloudDB database.
I would like to know the handling to follow to be able to change the database because I do not find a solution to my problem.
thank you so much
PS: I'm a beginner with PrestaShop.
Using your FTP client or file manager open this file:
/app/config/parameters.php
Find the lines with database_host, database_name, database_user and
database_password parameters.
Replace existing values of that params with the new ones.
Save the file and upload it back to the server.
All done! Open your site in the browser and check whether it works.
<?php return array (
'parameters' =>
array (
'database_host' => '127.0.0.1',
'database_port' => '',
'database_name' => 'your_database_name',
'database_user' => 'your_database_user',
'database_password' => 'your_database_password',
'database_prefix' => 'ps_',
'database_engine' => 'InnoDB',
'mailer_transport' => 'smtp',
'mailer_host' => '127.0.0.1',
'mailer_user' => NULL,
'mailer_password' => NULL,
'secret' => 'Vz6rVXVYNWYt7E6Fvfvdfvg34MCdc97h3IttReewVIxNOu7wHAoS',
'ps_caching' => 'CacheMemcache',
'ps_cache_enable' => false,
'ps_creation_date' => '2017-05-22',
'locale' => 'en-US',
'cookie_key' => 'xduROM3yvjDSym43CvfdvFDVD47YG8zCrVruNFjjZ3NUb7Ut9',
'cookie_iv' => '7kBvdfvgh',
'new_cookie_key' => 'def00000766ffa61aae49b279evfsdvsdfvsfdvfdvwerr324r3frdfveb1afedc8702a964f0a1f6828bf1623ca54efad10ed4bbfb289beec62b01a3062d4c3ce78254157',
),
);

How can I get the Author info from CKAN?

I'm looking for all the information that ckan api can provide.
This is one of my result
[5] => stdClass Object
(
[cache_last_updated] =>
[package_id] => 86dc2555-0e06-45be-aa2f-911d9431d29a
[webstore_last_updated] =>
[id] => 054d4e12-d07f-41bc-a7d3-3c2d8b2882fe
[size] =>
[state] => active
[last_modified] => 2016-08-15T18:30:53.146250
[hash] =>
[description] => Lista das 4.617 espécies nativas brasileiras avaliadas quanto ao risco de extinção - recorte temporal de 2012.
[format] => PDF
[mimetype_inner] =>
[url_type] => upload
[mimetype] =>
[cache_url] =>
[name] => Lista de espécies avaliadas - Livro Vermelho - 2013 - PDF
[created] => 2016-01-29T11:43:50.555625
[url] => http://ckan.jbrj.gov.br/dataset/86dc2555-0e06-45be-aa2f-911d9431d29a/resource/054d4e12-d07f-41bc-a7d3-3c2d8b2882fe/download/especiesavaliadaslv2013.pdf
[webstore_url] =>
[position] => 0
[revision_id] => c2903e9a-4587-4a1b-9b7f-1702e91d01f3
[resource_type] =>
)
I could not see the author field there, does someone knows how can I get it?
Your data seems to come from a resource. In CKAN, resources don't carry ownership information. Instead, resources are attached to packages (see the package_id field), which in turn are linked to organizations (via their organization field). A package's organization is usually the source of the data, but a package also has information about its maintainer and possibly other people related to the data.

omnipay payment wall integration -Error

I tried to implement paymentwall payment gateway integration with Laravel using omnipay library.After setting setApiType, setPublicKey and setPrivateKey and trying to call the API, its getting the response "Public key is missed or invalid" from payment wall gateway.
Actually this error is happened due to passing parameter public key as public_Key instead of public_key from the omnipay library.
The following is the response
[request:protected] => Omnipay\PaymentWall\Message\PurchaseRequest Object
(
[endPoint:protected] => https://api.paymentwall.com/api
[parameters:protected] => Symfony\Component\HttpFoundation\ParameterBag Object
(
[parameters:protected] => Array
(
[apiType] => 0
[publicKey] => hjghjghsdfsc5464564564e56456
[privateKey] => gfh4567686786787hfjfhgfgfgh
[amount] => 10.00
[currency] => USD
[accountId] =>
[description] => test Pay
[email] => test#gmail.com
[clientIp] => 112.133.236.158
[browserDomain] => test.com
[card] => Omnipay\Common\CreditCard Object
[response:protected] => Omnipay\PaymentWall\Message\Response Object
*RECURSION*
[zeroAmountAllowed:protected] => 1
[negativeAmountAllowed:protected] =>
)
[data:protected] => Array
(
[type] => Error
[object] => Error
[error] => Public key is missed or invalid
[code] => 2111
[log] =>
)
)
Public key is missed or invalid
As I commented in the issue that you raised on github:
This is working for everyone else. Are you sure there isn't really an issue with your keys? Can you check that there are no spurious newlines, etc, in your key as provided to the library?
The correct name for the public key parameter within Omnipay is publicKey. The correct name within the paymentwall library is public_key. A check of the code appears to indicate that the parameter naming is correct. The Omnipay publicKey parameter is correctly passed to the paymentwall library as public_key.

PayPal ExpressCheckout CreateRecurringPaymentsProfile : PROFILESTATUS PendingProfile

I'm having a problem with CreateRecurringPaymentsProfile call - when I send a request using:
[TOKEN] => EC-0HX47934KS3525414
[DESC] => Enrolment title
[PROFILESTARTDATE] => 2014-08-05T19:20:42+01:00
[AMT] => 98.16
[BILLINGPERIOD] => Month
[BILLINGFREQUENCY] => 1
[TOTALBILLINGCYCLES] => 2
[INITAMT] => 98.16
I get the response:
[PROFILEID] => I-VBR32KNHNXWN
[PROFILESTATUS] => PendingProfile
[TIMESTAMP] => 2014-08-05T18:20:45Z
[CORRELATIONID] => 853de87c95475
[ACK] => Success
[VERSION] => 72.0
[BUILD] => 12194268
Any idea why am I getting PendingProfile instead of ActiveProfile?
EDIT
The solution was to take the initial payment with SetExpressCheckout method - using L_PAYMENTREQUEST_0_NAME0 and L_PAYMENTREQUEST_0_AMT0 instead of INITAMT with CreateRecurringPaymentsProfile - once I've done that - everything works just fine.

CakePHP Auth->login not generating query for request data

I have the Auth component working perfectly for an application running Cake 2.4.1, and I need to copy it to another application that is also running Cake 2.4.1. I copied over everything I could think of that has to do with Auth stuff, but it just does not work in the second application. It refuses to log me in. The call to $this->Auth->login() fails even though it gets exactly the same data as the application that works.
Both applications are using exactly the same database and user login.
Both applications get exactly the same request data in the POST request.
First of all, here is my setup.
In AppController.php:
public $uses = array ('User');
public $components = array ( 'Session',
'CPRACL.CPRACL' => array (),
'Auth' => array (
// 'loginAction' => array ('controller' => 'users', 'action' => 'login'),
// 'logoutRedirect' => '/users/login',
// 'loginRedirect' => '/',
'authenticate' => array (
'Form' => array (
'fields' => array ('username' => 'email_address'),
'scope' => array ('User.active' => 1)
)
),
'authorize' => array ('Controller'),
// 'unauthorizedRedirect' => '/' // when going to a page the user is not authorized to go to
)
);
The commented out lines use the defaults, but they are included for reference to their default values. This is exactly the same in both applications. CPRACL is a plugin component that I am using instead of Cake's ACL component, but it fails long before it gets to any of that.
Also in AppController.php:
public function beforeFilter ()
{
$login_user = $this->User->find ('first', array ('conditions' => array ('id' => $this->Auth->user ('id'))));
if (!empty ($login_user))
$this->set ('login_user', $login_user ['User']);
}
public function isAuthorized ($user = null)
{
// This never gets called in the application that does not work, but it does get called in the one that works.
}
In both applications, it sets up the Auth component as defined in AppController.php, then it calls beforeFilter to check to see if the user is already logged in. This is a convenience so that when they get redirected to a different page, the application can display the username of the user who is logged in. It works fine and I don't think it is causing any problems.
The next thing that happens is it calls UsersController::login()
public function login ()
{
$redirect_url = $this->Auth->redirectUrl ();
if ($this->Auth->loggedIn ())
return $this->redirect ($redirect_url);
//die (print_r ($this->request->data, true));
if ($this->request->is ('post'))
{
//die (Debugger::dump ($this->Auth));
if ($this->Auth->login ())
return $this->redirect ($redirect_url);
else
return $this->redirect ($this->Auth->loginAction);
}
}
I used the two commented out lines to compare what is happening between the two applications. The two applications get exactly the same data in the post. For the dump of the Auth object, here is what I get:
object(AuthComponent) {
components => array(
(int) 0 => 'Session',
(int) 1 => 'RequestHandler'
)
authenticate => array(
'Form' => array(
[maximum depth reached]
)
)
authorize => array(
(int) 0 => 'Controller'
)
ajaxLogin => null
flash => array(
'element' => 'default',
'key' => 'auth',
'params' => array([maximum depth reached])
)
loginAction => array(
'controller' => 'users',
'action' => 'login',
'plugin' => null
)
loginRedirect => null
logoutRedirect => array(
'controller' => 'users',
'action' => 'login',
'plugin' => null
)
authError => 'You are not authorized to access that location.'
unauthorizedRedirect => true
allowedActions => array(
(int) 0 => 'register',
(int) 1 => 'login',
(int) 2 => 'logout'
)
request => object(CakeRequest) {}
response => object(CakeResponse) {}
settings => array(
'authenticate' => array(
[maximum depth reached]
),
'authorize' => array(
[maximum depth reached]
)
)
Session => object(SessionComponent) {}
[protected] _authenticateObjects => array()
[protected] _authorizeObjects => array()
[protected] _user => array()
[protected] _methods => array(
(int) 0 => 'index',
(int) 1 => 'view',
(int) 2 => 'add',
(int) 3 => 'register',
(int) 4 => 'login',
(int) 5 => 'logout',
(int) 6 => 'toggleactive',
(int) 7 => 'changePassword',
(int) 8 => 'passwordHash',
(int) 10 => 'edit_pwd',
(int) 11 => 'edit_your_pwd',
(int) 12 => 'isAuthorized'
)
[protected] _Collection => object(ComponentCollection) {}
[protected] _componentMap => array(
'Session' => array(
[maximum depth reached]
),
'RequestHandler' => array(
[maximum depth reached]
)
)
}
That is what both applications return from the Auth object dump when I send the login request. It says the user is not authorized to access that location, but I think that is because it hasn't actually logged the user in yet, so I don't think the dump of that Auth object is of much value, but I included it here anyway.
But here is the most important part because it is the only thing that is obviously different between the two applications. When I perform the login on the working application, it logs me in successfully and my layout (which displays the most recent query) shows this query. Notice the id field. The id field is correct in the query and it works.
SELECT `User`.`id`, `User`.`user_id`, `User`.`email_address`, `User`.`first_name`, `User`.`last_name`, `User`.`password`, `User`.`active`, `User`.`created`, `User`.`modified` FROM `brian_cake_test`.`users` AS `User` WHERE `id` = '529f9a8c-3460-46a2-a97c-6a6242a26b88' LIMIT 1
But when I do exactly the same thing for the application that does not work, everything happens exactly the same way except that it redirects me back to the login page, which it should do if it fails to login, and it displays this query in my layout.
SELECT `User`.`id`, `User`.`user_id`, `User`.`email_address`, `User`.`first_name`, `User`.`last_name`, `User`.`password`, `User`.`active`, `User`.`created`, `User`.`modified` FROM `brian_cake_test`.`users` AS `User` WHERE `id` IS NULL LIMIT 1
Notice how the id is NULL in the second query. I have no idea why this is happening.
My User.php model is just an empty class, exactly the same in both application, but one works perfectly and the other does not.
<?php
App::uses ('AppModel', 'Model');
class User extends AppModel
{
public $name = 'User';
}
I have racked my brain trying to figure out what is different between these two applications, and I can't think of anything, and nothing I try will make it work. I don't want to post hundreds of lines of code when I know that 99% of it has nothing to do with this problem, but I have no idea why it works in one but not the other. I will gladly post more information if you think you might know what the problem is. Any help would be much appreciated. This is very important to me.
Actually if its exactly the same code and DB it shouldn't be a reason not to work.
Have you tried clearing the cache folders? Those files sometimes mess up the app.