I'm using PHP class from https://github.com/constantcontact/Constant-Contact-PHP-Sample-Contact-Forms to add new contacts to Constant Contact list, but recently I have got PHP error messages:
A PHP Error was encountered
Severity: Notice
Message: Undefined offset: 1
Filename: cc_class.php
Line Number: 248
A PHP Error was encountered
Severity: Notice
Message: Undefined offset: 1
Filename: cc_class.php
Line Number: 252
where those lines look like:
(248)
$xml = simplexml_load_string($return);
(252)
}
and full related function to those two lines:
public function subscriberExists($email = '') {
$call = $this->apiPath.'/contacts?email='.$email;
$return = $this->doServerCall($call);
$xml = simplexml_load_string($return);
$id = $xml->entry->id;
if($id){ return $id; }
else { return false; }
}
but it passes data to Constan Contact anyway.
Any clue what is going on there with those error messages?
Thanks
From the class GitHub
This is just a PHP notice, not a failure, when trying to access an
index of an array that hasn't been defined yet. The codebase in this
app is fairly old, and hasn't been brought up to date as PHP is
upgraded.
We would recommend instead of using this repo, utilizing the newer PHP
SDK which is object-oriented, available via composer, and kept up to
date. You can definitely mute these notifications in your environment,
but this repo is deprecated, so this issue won't be addressed in the
project.
Related
I'm getting the following error in codeigniter once I deploy it in server. I do not get this error in localhost. I'm not sure where I'm going wrong. Any suggestions. I'm using Google Apps Engine.
Fatal error: Call to a member function result_array() on a non-object
in /base/data/home/apps/s~some-app/1.401263586523638658/application/models/Some_model.php on line 199
A PHP Error was encountered
Severity: Warning
Message: Cannot modify header information - headers already sent by (output started at /base/data/home/apps/s~some-app/1.401263586523638658/application/models/Some_model.php:199)
Filename: core/Common.php
Line Number: 569
Backtrace:
A PHP Error was encountered
Severity: Error
Message: Call to a member function result_array() on a non-object
Filename: models/Some_model.php
Line Number: 199
Backtrace:
I checked the controller and models for any white space and I do not have any such. This particular function is also not used by any cron job as mentioned in another post.
Edited to add code:
$query = "select u.id, u.queue_name, u.queue_email, u.tickets_for_all
from agent_queue_mapping_table as m, queue_table as u
where u.id=m.queue_id
and u.company_id = ".$this->session->userdata('user_comp_id')."
and m.user_id = ".$this->session->userdata('user_id');
$queue_details = $this->db->query($query);
return $queue_details->result_array();
1.Check the PHP version of your server.
2.Get your SQL query by using $this->db->last_query() and run the query on MySQL console and check if there any errors.
3.Check the result_array() array function usage in your controller. send us your screenshot of the code here to check on that section
I got this error, because I had not updated a table that I had to alter. Once I did that, this issue got resolved.
I want to use different databases for different language files. I can get language code with this;
$this->lang->lang()
I have to define it as pre_controller hook, so system will select right database at the beginning. But when I try to use the code above, I'm getting a fatal error.
A PHP Error was encountered
Severity: Notice
Message: Undefined property: CI_Hooks::$lang
Filename: config/hooks.php
Line Number: 13
Fatal error: Call to a member function lang() on a non-object in...
This is my code;
$hook['pre_controller'] = define('LANG', isset($_SESSION['lang']) ? $_SESSION['lang'] : $this->lang->lang());
Thanks in advance.
I hope you are all fine.
Recently, my host has upgraded the PHP version to PHP 5.4. I cannot use my web application "myclientbase" any longer. Some features like auto suggestion are no longer available. Is there any way to keep the old version of PHP 5.3? I didn't face any issues while using this version.
Please check the below errors;
A PHP Error was encountered
Severity: Warning
Message: Creating default object from empty value
Filename: models/mdl_mcb_data.php
Line Number: 88
A PHP Error was encountered
Severity: Warning
Message: Creating default object from empty value
Filename: models/mdl_mcb_userdata.php
Line Number: 76
Thank you very much for your help.
1) Open
/application/modules_core/mcb_data/models/mdl_mcb_data.php
/application/modules_core/mcb_data/models/mdl_mcb_userdata.php
/application/modules_core/mcb_data/models/mdl_mcb_client_data.php
2) after public $settings line 5 insert
public function __construct() {
if(empty($this->settings))$this->settings= new stdClass();
}
1) Open /application/modules_core/mcb_data/models/mdl_mcb_data.php
2) Go to line 77
3) Change
foreach ($mcb_data as $data) {
$this->settings->{$data->mcb_key} = $data->mcb_value;
}
to
$this->settings=new stdClass();
foreach ($mcb_data as $data) {
$this->settings->{$data->mcb_key} = $data->mcb_value;
}
go to root folder
open index.php
change error_reporting(E_ALL); at line 34 to error_reporting(0);
I am using CodeIgniter and I have a problem
the code very simple just few row in the controller ,this is my controller
<?php
class Site extends Controller {
function index() {
echo 'i am here';
}
}
And this are the errors:
1- Deprecated: Assigning the return value of new by reference is deprecated in C:\wamp\www\ci\system\codeigniter\Common.php on line 130
2-Deprecated: Assigning the return value of new by reference is deprecated in C:\wamp\www\ci\system\codeigniter\Common.php on line 136
3-A PHP Error was encountered
Severity: 8192
Message: Assigning the return value of new by reference is deprecated
Filename: libraries/Loader.php
Line Number: 255
4-A PHP Error was encountered
Severity: 8192
Message: Assigning the return value of new by reference is deprecated
Filename: database/DB.php
Line Number: 133
I don't know where is the problem, certainly the code is correct but where is the problem. Any suggestions?
& is used in PHP to pass an object to a method / assign a new object to a variable by reference. It is deprecated in PHP 5 because PHP5 passes all objects by reference, but other vars default to by value.
To fix this error:
Update to the latest version of CodeIgniter, really!
Recently I faced the same prob, I was using codeigniter 1.7 and PHP 5.2.6 everything was working great, but after upgrading PHP to 5.3 the below error starts coming:-
Deprecated: Assigning the return value of new by reference is deprecated
The reason behind it is same as mentioned by #Amal , & is used in PHP to pass an object to a method / assign a new object to a variable by reference. It is deprecated in PHP 5 because PHP5 passes all objects by reference
For more info Refer to
Assigning the return value of new by reference is deprecated
So if you are creating your code from scratch, then better to use all the latest things, use codeigniter 2.1.4
But if you have your codebase in some old codeigniter version, then better to degrade your PHP (which is not recommended) till the time you move on to newer version.
I have put the files I downloaded from http://www.openwall.com/phpass/ to application/libraries
In my controller, I am using this code -
$params = array(
'phpass_hash_strength' => 8,
'phpass_hash_portable' => FALSE
);
$this->load->library('PasswordHash', $params);
$password = $this->passwordhash->HashPassword($pwd);
I am getting these errors -
A PHP Error was encountered
Severity: Notice
Message: Uninitialized string offset: 3
Filename: libraries/PasswordHash.php
Line Number: 116
A PHP Error was encountered
Severity: Warning
Message: strpos() [function.strpos]: Empty delimiter
Filename: libraries/PasswordHash.php
Line Number: 116
Update
Removed PasswordHash.php, using SimpleLoginSecure now.
I had the same issue whilst integrating PasswordHash into Symfony2.
To solve it, I renamed the PasswordHash method to __construct.
In theory, PHP 5+ should look for a method with the same name as the class if it can't find a constructor (http://php.net/manual/en/language.oop5.decon.php). My guess is that the class name resolves differently once a namespace is added (a requirement for my integration), but I've not investigated at all.
I think your problem is you are trying to use a generic PHP object as a CodeIgniter library. You can't just do that. You'll need to modify the original code to work, or download one of the contributed libraries already designed for CodeIgniter.
CodeIgniter libraries have some restrictions (such as how they are instantiated), so just dropping any file into the libraries folder won't work.