Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

PHP script stops when a member function is called, no error thrown

Tags:

php

What can cause php script to stop executing without outputting any error? It happens to me when I call an inherited function.

Example code:

class X extends FPDF {
   function foo() {
       return $this->GetClientWidth();
   }
}

FPDF class as in here: (deleted link) wrong version

The object is initiated, anytime I call GetClientWidth() I get a blank page

Used to work before reinstalling my OS/dev environment. Running on XAMPP

UPDATE: Sorry for confusing you, I didn't check the link I gave, it indeed did not have the function discussed. It's there though on my local version.

like image 783
qeek Avatar asked May 26 '26 08:05

qeek


2 Answers

error_reporting(E_ALL); 
ini_set('display_errors',1);

or check error.log

like image 158
RiaD Avatar answered May 27 '26 22:05

RiaD


require_once "FPDF.php";
error_reporting(E_ALL); 
ini_set('display_errors',1);

class X extends FPDF {
   function foo() {
       return $this->GetClientWidth();
   }
}

$x = new X;
$ClienWidth = $x->foo();
var_dump($ClienWidth);

return:

Fatal error: Call to undefined method X::GetClientWidth()

The reason is simple: "There is no GetClientWidth method in the fpdf – Prisoner"

like image 22
Talisin Avatar answered May 27 '26 22:05

Talisin



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!