PHP imap library - how to get headers value - codeigniter-3

I fallow to:
https://github.com/ddeboer/imap/blob/master/src/Message/Headers.php
I try get:
'status' => $message->getHeaders()->get('reply_to'),
But I get issue:
`Severity: Notice
Message: Array to string conversion
Filename: database/DB_driver.php
Line Number: 1471
Error Number: 1054
Unknown column 'Array' in 'field list'
...
..
..
**Array**, 'new')`
How to correct get value reply_to ?
I need to check if this is new message or this is reply on message.

Related

A PHP Error was encountered Severity: Notice Message: Trying to access array offset on value of type null

A PHP Error was encountered
Severity: Notice
Message: Trying to access array offset on value of type null
Filename: datauser/editsuperadmin.php
Line Number: 20
Backtrace:
File: C:\xampp\htdocs\mcicampus2\application\views\Superadmin\datauser\editsuperadmin.php
Line: 20
Function: _error_handler
File: C:\xampp\htdocs\mcicampus2\application\controllers\Superadmin.php
Line: 107
Function: view
File: C:\xampp\htdocs\mcicampus2\index.php
Line: 315
Function: require_once
This error means the index doesn't exist in array. You should use isset before printing or using the value of the array.
To check whether the index exists or not you can use isset():
isset($abc_array['xyz_data']) {
echo $abc_array['xyz_data'];
}

Errors in codeigniter-restserver library

I want to use restful in my ci 3.03 application:
I found this tutplus tutorial
I downloaded codeigniter-restserver-master.zip file and copied Format.php and REST_Controller.php(#version 3.0.0) files into /application/libraries/REST directory
I created control application/controllers/api/Users.php :
require_once("application/libraries/REST/REST_Controller.php");
require_once("application/libraries/REST/Format.php");
class Users extends REST_Controller
{
//protected $rest_format = 'json';
function users_get()
{
//$users = $this->user_model->get_all();
$filter_username= $this->get('filter_username');
$filter_user_group= $this->get('filter_user_group');
$filter_active= $this->get('filter_active');
$sort= $this->get('sort');
$sort_direction= $this->get('sort_direction');
//, $filter_user_group, $filter_active, $sort, $sort_direction
$users_list = $this->muser->getUsersList(false, ''/*, $filter_username, $filter_user_group, $filter_active, $sort, $sort_direction, ''*/);
echo '<pre>'.count($users_list).'::$users_lists::'.print_r($users_list,true).'</pre>';
if($users_list)
{
$this->response($users, 200);
}
else
{
$this->response(NULL, 404);
}
}
AND RUNNING URL http://local-ci3.com/api/users I got many errors:
A PHP Error was encountered
Severity: Notice
Message: Undefined property: Users::$format
Filename: REST/REST_Controller.php
Line Number: 734
Backtrace:
File: /mnt/diskD_Work/wwwroot/ci3/application/libraries/REST/REST_Controller.php
Line: 734
Function: _error_handler
File: /mnt/diskD_Work/wwwroot/ci3/application/libraries/REST/REST_Controller.php
Line: 649
Function: response
File: /mnt/diskD_Work/wwwroot/ci3/index.php
Line: 292
Function: require_once
A PHP Error was encountered
Severity: Notice
Message: Undefined property: Users::$format
Filename: REST/REST_Controller.php
Line Number: 752
Backtrace:
File: /mnt/diskD_Work/wwwroot/ci3/application/libraries/REST/REST_Controller.php
Line: 752
Function: _error_handler
File: /mnt/diskD_Work/wwwroot/ci3/application/libraries/REST/REST_Controller.php
Line: 649
Function: response
File: /mnt/diskD_Work/wwwroot/ci3/index.php
Line: 292
Function: require_once
Actually I wanted to get some workable library to help me with REST api creation. I think that is preferable way istead of making from zero.
But is this library not workable or does it needs for some fixing? Sorry, what I missed is if this library only for ci 2?
I made search on this forum and found such hint :
I have the same problem when I load both Format.php and
Rest_Controller.php into a controller. After have a quick glance at
Format.php, it appears to be a standalone format conversion helper.
Try to just load Rest_Controller.php and see if your problem goes
away.
I commented line
//require_once("application/libraries/REST/Format.php");
in my controller, but I still get errors like :
Message: Undefined property: Users::$format.
I tried to review code of this library and see that invalid block when data are converted to json format, line 731-757 :
elseif ($data !== NULL)
{
// If the format method exists, call and return the output in that format
if (method_exists($this->format, 'to_' . $this->response->format))
{
// Set the format header
$this->output->set_content_type($this->_supported_formats[$this->response->format], strtolower($this->config->item('charset')));
$output = $this->format->factory($data)->{'to_' . $this->response->format}();
// An array must be parsed as a string, so as not to cause an array to string error
// Json is the most appropriate form for such a datatype
if ($this->response->format === 'array')
{
$output = $this->format->factory($output)->{'to_json'}();
}
}
else
{
// If an array or object, then parse as a json, so as to be a 'string'
if (is_array($data) || is_object($data))
{
$data = $this->format->factory($data)->{'to_json'}();
}
// Format is not supported, so output the raw data as a string
$output = $data;
}
}
If I tried to commented this block, but get error
Message: Array to string conversion
Looks like data are not converted in this case...
Is is possible to fix these errors?
Or can you, please, to tell me advice some codeigniter 3 REST api workable library with similar interface like library above?
Thanks!
I use that lib, work just fine. My suggestion is follow the more relevant installation instruction on github .
you also wrong place the lib file :
Tutorial say :
require(APPPATH'.libraries/REST_Controller.php');
You try :
require_once("application/libraries/REST/REST_Controller.php");
require_once("application/libraries/REST/Format.php");
No need to include the format because on line 407 the lib will load it. And also good to know on line 404 it will load the configuration (application/config/rest.php) it will be your default configuration, and also you can change it to suit your need.
Please let me know if you still got error using my answer :)

Codeigniter A PHP Error was encountered, Filename: mysqli/mysqli_driver.php

I am using Codeigniter 3.0.0 and have just tested the program live online. The website is www.theloven.com.
The problem is like below
I could not fix the error.I need some help on this case
A PHP Error was encountered
Severity: Warning
Message: mysqli::real_connect(): (42000/1203): User ... already has more than 'max_user_connections' active connections
Filename: mysqli/mysqli_driver.php
Line Number: 135
Backtrace:
File: /home/.../public_html/index.php
Line: 292
Function: require_once
A PHP Error was encountered
Severity: Warning
Message: session_start(): Cannot send session cache limiter - headers already sent (output started at /home/theloven8/public_html/system/core/Exceptions.php:272)
Filename: Session/Session.php
Line Number: 140
Backtrace:
File: /home/.../public_html/index.php
Line: 292
Function: require_once
A PHP Error was encountered
Severity: Warning
Message: Cannot modify header information - headers already sent by (output started at /home/theloven8/public_html/system/core/Exceptions.php:272)
Filename: Session/Session.php
Line Number: 168
Backtrace:
File: /home/.../public_html/index.php
Line: 292
Function: require_once
First you have specify local host user name and passwords in config > database.php
'hostname' => 'localhost',
'username' => 'uname',
'password' => 'password',
'database' => 'project',
'dbdriver' => 'mysqli',

tcpdf date error Message: Undefined offset: 2

i have a date (datepicker jquery) $fecha_constancia:
public function generarReporte(){
$data_b = array();
$container = $this->input->get_post('opc_report', TRUE);
$paciente = $this->input->get_post('paciente', TRUE);
$odontologo = $this->input->get_post('odontologo', TRUE);
$fecha_constancia = $this->input->get_post('fecha_constancia', TRUE);
$diagnostico = $this->input->get_post('diagnostico', TRUE);
$reposo= $this->input->get_post('reposo', TRUE);
$reposo = $reposo*7;
list($day,$mon,$year) = explode('/',$fecha_constancia);
$nueva_fecha = date('d/m/Y',mktime(0,0,0,$mon,$day+$reposo,$year));
$data_a = array(
'fecha_constancia' => $fecha_constancia,
'diagnostico' => $diagnostico,
'fecha_reposo' => $nueva_fecha,
'dias_reposo' => $reposo
but when I'm going to spend the time to the Make pdf throws me the following result:
A PHP Error was encountered
Severity: Notice
Message: Undefined offset: 2
Filename: controllers/constancia.php
Line Number: 38
A PHP Error was encountered
Severity: Notice
Message: Undefined offset: 1
Filename: controllers/constancia.php
Line Number: 38
is that the problem is in the date but not how to fix it
Check that the value of $fecha_constancia is an actual date in the format of Day/Month/Year.
This is line 38, correct?:
list($day,$mon,$year) = explode('/',$fecha_constancia);
Based on the error message, there's no slashes in $fecha_constancia. It can't assign anything to $mon and $year because explode is returning an array with a single element.

How to set a nillable attribute for SOAP::Lite object in Perl?

I'm receiving the following error:
Exception: Error code: , messge: com.sun.istack.XMLStreamException2: org.xml.sax.SAXParseException: cvc-elt.3.1: Attribute 'http://www.w3.org/2001/XMLSchema-instance,nil' must not appear on element 'v1:get_list', because the {nillable} property of 'v1:get_list' is false. at ./soap.pl line 42.
This is my Perl code:
my $client = SOAP::Lite
->on_fault( \&faultHandler )
->uri('http://api.domain.net/')
->proxy('https://api.domain.net/MyAPI');
# Execute
$client->get_list();
How do I change/add the nillable attribute and how ?
How do I change/add the nillable attribute and how ?
You use SOAP::Data to create argument for get_list, or for call
Switch to SOAP::Simple , it has better WSDL support cpan BERLE/SOAP-Simple-0.00_03.tar.gz