My webpage gives the "methods with the same name as their class will not be constructors in a future version of php" error with the below code.
When I change the "function settings()" to "function __construct()", the web page gives a fatal error.
Fatal error: Uncaught Error: Call to undefined method validator::settings() in /home/mertcek1563/public_html/rmd2015/sdwf/validator.php:11
Stack trace:
#0 /home/mertcek1563/public_html/rmd2015/z_common.php(103): validator->__construct()
#1 /home/mertcek1563/public_html/rmd2015/z_core.php(22): include('/home/mertcek15...')
#2 /home/mertcek1563/public_html/rmd2015/index.php(2): include('/home/mertcek15...')
#3 {main}
thrown in /home/mertcek1563/public_html/rmd2015/sdwf/validator.php on line 11
How I can fix this code?
class settings
{
var $settings = array();
function settings(){
$this->settings["price"]=array();
$this->settings["price"]["dot"]=".";
$this->settings["price"]["decimals"]=6;
$this->settings["date"]=array();
$this->settings["date"]["delimiter"]="/";
$this->settings["date"]["format"]="dd/mm/yyyy";
$this->settings["number"]=array();
$this->settings["number"]["dot"]=".";
$this->settings["number"]["decimals"]=6;
}
}
Then I end up with fatal error:
Fatal error: Uncaught Error: Call to undefined method
validator::settings() in
/home/mertcek1563/public_html/rmd2015/sdwf/validator.php:11
<?
include_once("settings.php");
class validator extends settings
{
var $errors = array();
var $required = array();
function __construct(){
$this->settings();
}
Related
I have a issue trying to save an object into session.
From my index.php I create the object and store it into session:
include_once __DIR__.'/vendor/autoload.php';
use Axiom\Rivescript\Rivescript;
$test = new Rivescript();
$test->load(realpath(__KNOWLEDGE__));
session_start();
if (isset($_SESSION['ENGINE'])){
unset($_SESSION['ENGINE']);
}
$_SESSION['ENGINE'] = $test;
in another php page I recall the session to get te object:
session_start();
if (!isset($_SESSION['ENGINE'] )){
// error
}else{
$test = $_SESSION['ENGINE'];
$txt = $test->reply($input,$client_id);
}
This page is called by AJAX.
and I get this error:
Notice: Trying to get property 'memory' of non-object in /var/www/html/vendor/axiom/rivescript/src/Cortex/Input.php on line 64
Fatal error: Uncaught Error: Call to a member function substitute() on null in /var/www/html/vendor/axiom/rivescript/src/Cortex/Input.php:64 Stack trace: #0 /var/www/html/vendor/axiom/rivescript/src/Cortex/Input.php(33): Axiom\Rivescript\Cortex\Input->cleanOriginalSource() #1 /var/www/html/vendor/axiom/rivescript/src/Rivescript.php(34): Axiom\Rivescript\Cortex\Input->__construct('ciao', '5e5fe0688782a') #2 /var/www/html/include/bot.php(24): Axiom\Rivescript\Rivescript->reply('ciao', '5e5fe0688782a') #3 {main} thrown in /var/www/html/vendor/axiom/rivescript/src/Cortex/Input.php on line 64
Any help ??
I am having an intermittent problem in my website
https://americascareercenters.us/jobs.php?q=92630
Sometimes the page loads fine. other times I get just a blank page with an error.
Fatal error: Uncaught Error: Call to a member function attributes() on
boolean in /home/acc/public_html/jobs.php:95 Stack trace: #0 {main}
thrown in /home/acc/public_html/jobs.php on line 95
Here is the section of code
$rCurl_f = curl_init($sUrl_f);
curl_setopt($rCurl_f, CURLOPT_RETURNTRANSFER, TRUE);
$sXml_f = curl_exec($rCurl_f);
curl_close($rCurl_f);
$oXml_f = simplexml_load_string($sXml_f);
$results_atributes_f = $oXml_f->attributes();
$total_f = $results_atributes_f['total'];
Yeah, you need to check if $oXml_f is false before trying to use its method:
if ( ! empty( $oXml_f ) ) {
$results_atributes_f = $oXml_f->attributes();
$total_f = $results_atributes_f['total'];
} else {
//Whatever you want to do if it fails
//Maybe $total_f = 0;
}
We have wsdl :
http://xxxxxxxxxxxxxxx.com/XXXX_Beta_3_API/webservice.asmx?wsdl
IN PHP FILE : i have created a Class with some arrays in it..
class Crmtet {
public $abc;
public $abc2;
public $abc3;
public $abc4;
}
$client = new SoapClient(http://xxxxxxxxxxxxxxx.com/XXXX_Beta_3_API/webservice.asmx?wsdl);
$obj = new Crmtet();
$obj->abc= "Test";
$obj->abc2= "Test2";
$obj->abc3= "Test3";
$obj->abc4= "Test4";
$result = $client->CRM_Warehouse_Master_Insert($obj)->CRM_Warehouse_Master_InsertResult;
echo"re".$result;
But i am getting below error :
Fatal error: Uncaught SoapFault exception: [soap:Server] Server was
unable to process request. ---> Object reference not set to an
instance of an object. in
E:\EasyPHP-12.1\www\test\inserwarrecrm.php:60 Stack trace: #0
E:\EasyPHP-12.1\www\test\inserwarrecrm.php(60):
SoapClient->__call('CRM_Warehouse_M...', Array) #1
E:\EasyPHP-12.1\www\test\inserwarrecrm.php(60):
SoapClient->CRM_Warehouse_Master_Insert(Object(Crmtet)) #2 {main}
thrown in E:\EasyPHP-12.1\www\test\inserwarrecrm.php on line 60
What is the issue.. can anyone help..??
I want to declare SplFixedArray(); to save memory consumption. but it is throwing fatal error.
$items=new SplFixedArray();
echo "Array Started...";
for($h=0;$h<5000;$h++)
{
for($i=0;$i<24;$i++)
{
$items[$h][$i]=$objSheet->getCellByColumnAndRow($i,$h+1)->getValue();
}
}
The same is working if do not declare new SplFixedArray();
Error:
Fatal error: Uncaught exception 'RuntimeException' with message 'Index
invalid or out of range' in /home/twa/files.php:168 Stack trace: #0
/home/twa/files.php(168): unknown() #1 {main} thrown in
/home/twa/files.php on line 168
$items=new SplFixedArray(SplFixedArray()); is also failing...
Please let me know correct syntax...
$items = new SplFixedArray(5000);
for ($h=0; $h<5000; $h++) {
$items[$h] = new SplFixedArray(24);
for ($i=0; $i<24; $i++) {
$items[$h][$i] = $objSheet->getCellByColumnAndRow($i,$h+1)->getValue();
}
}
This code:
<?php
namespace designblob;
function autoloader($class){
include "wrappers/databaseWrapper.php";
}
spl_autoload_register('autoloader');
?>
throws this error:
Fatal error: Uncaught exception 'LogicException' with message 'Function 'autoloader' not found (function 'autoloader' not found or invalid function name)' in /var/www/xxx/library/autoloader.php:8 Stack trace: #0 /var/www/xxx/library/autoloader.php(8): spl_autoload_register('autoloader') #1 /var/www/xxx/library/debug.php(19): require_once('/var/www/xxx...') #2 {main} thrown in /var/www/xxxm/library/autoloader.php on line 8
Why doesn't it work?
spl_autoload_register('designblob\autoloader');