neither var_dump() nor die() displays anything [message #173634] |
Thu, 21 April 2011 13:07 |
Jivanmukta
Messages: 20 Registered: January 2011
Karma: 0
|
Junior Member |
|
|
I don't see my error, I think. Problem is that only
var_dump($statementNo) displays text(and $statementNo is !empty).
Neither var_dump($message) nor die($message) nor echo '#' displays
text. Function writeToLog() correctly writes to log file.
I failed to run debugging.
Here is my code:
// import_statement.php:
var_dump($statementNo); // works fine
if (!empty($statementNo)) {
error(ERRMSG_STATEMENT_ALREADY_IMPORTED); // enters error()
}
echo '#'; // here problem
// functions.inc.php:
function error($message) {
global $currentUser;
if (ob_get_length() !== false) {
ob_end_flush();
}
var_dump($message); // here problem
$page = $_SERVER['SERVER_NAME'] . '/' .
trim($_SERVER['REQUEST_URI'], '/ ');
$website = trim(ltrim(ltrim(WEBSITE_PUNYCODE, 'http:'), 'https:'),
'/ ');
$page = mb_strstr($page, $website);
$page = trim(mb_substr($page, mb_strlen($website)), '/ ');
writeToLog(null, null, $currentUser, null, null, null, "Application
error: $message Page: $page"); // works fine
die($message); // here problem
}
Please help. Thanks in advance.
|
|
|
Re: neither var_dump() nor die() displays anything [message #173635 is a reply to message #173634] |
Thu, 21 April 2011 16:58 |
Jerry Stuckle
Messages: 2598 Registered: September 2010
Karma: 0
|
Senior Member |
|
|
On 4/21/2011 9:07 AM, Jivanmukta wrote:
> I don't see my error, I think. Problem is that only
> var_dump($statementNo) displays text(and $statementNo is !empty).
> Neither var_dump($message) nor die($message) nor echo '#' displays
> text. Function writeToLog() correctly writes to log file.
> I failed to run debugging.
> Here is my code:
>
> // import_statement.php:
> var_dump($statementNo); // works fine
> if (!empty($statementNo)) {
> error(ERRMSG_STATEMENT_ALREADY_IMPORTED); // enters error()
> }
> echo '#'; // here problem
>
> // functions.inc.php:
> function error($message) {
> global $currentUser;
> if (ob_get_length() !== false) {
> ob_end_flush();
> }
> var_dump($message); // here problem
> $page = $_SERVER['SERVER_NAME'] . '/' .
> trim($_SERVER['REQUEST_URI'], '/ ');
> $website = trim(ltrim(ltrim(WEBSITE_PUNYCODE, 'http:'), 'https:'),
> '/ ');
> $page = mb_strstr($page, $website);
> $page = trim(mb_substr($page, mb_strlen($website)), '/ ');
> writeToLog(null, null, $currentUser, null, null, null, "Application
> error: $message Page: $page"); // works fine
> die($message); // here problem
> }
>
> Please help. Thanks in advance.
Have you tried looking at your page source?
--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex(at)attglobal(dot)net
==================
|
|
|
|
Re: neither var_dump() nor die() displays anything [message #173639 is a reply to message #173636] |
Fri, 22 April 2011 00:00 |
Jerry Stuckle
Messages: 2598 Registered: September 2010
Karma: 0
|
Senior Member |
|
|
On 4/21/2011 1:39 PM, Jivanmukta wrote:
>> Have you tried looking at your page source?
>
> If you mean View|Source from a browser - yes, I tried: my page
> contains only result of var_dump($statementNo), no other markers nor
> text.
OK, do you have the following in your php.ini file (on your development
system):
display_errors=on
error_reporting=E_ALL // or E_ALL | E_STRICT
--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex(at)attglobal(dot)net
==================
|
|
|
Re: neither var_dump() nor die() displays anything [message #173641 is a reply to message #173639] |
Fri, 22 April 2011 01:05 |
Jivanmukta
Messages: 20 Registered: January 2011
Karma: 0
|
Junior Member |
|
|
> OK, do you have the following in your php.ini file (on your development
> system):
> display_errors=on
> error_reporting=E_ALL // or E_ALL | E_STRICT
I added these two lines to my code (before problem):
ini_set('display_errors',1);
error_reporting( E_ALL);
but it didn't help: no error is displayed, I don't know why.
|
|
|
Re: neither var_dump() nor die() displays anything [message #173643 is a reply to message #173641] |
Fri, 22 April 2011 07:31 |
Unrest
Messages: 10 Registered: April 2011
Karma: 0
|
Junior Member |
|
|
Am Thu, 21 Apr 2011 18:05:53 -0700 schrieb Jivanmukta:
>> OK, do you have the following in your php.ini file (on your development
>> system):
>> display_errors=on
>> error_reporting=E_ALL // or E_ALL | E_STRICT
>
> I added these two lines to my code (before problem):
>
> ini_set('display_errors',1);
> error_reporting( E_ALL);
>
> but it didn't help: no error is displayed, I don't know why.
error_reporting(-1)
is e_all + e_strict.
Having E_STRICT set, it'll punish you for passing an undefined constant
to that function. ;)
|
|
|
Re: neither var_dump() nor die() displays anything [message #173644 is a reply to message #173634] |
Fri, 22 April 2011 07:45 |
Erwin Moller
Messages: 228 Registered: September 2010
Karma: 0
|
Senior Member |
|
|
On 4/21/2011 3:07 PM, Jivanmukta wrote:
> I don't see my error, I think. Problem is that only
> var_dump($statementNo) displays text(and $statementNo is !empty).
> Neither var_dump($message) nor die($message) nor echo '#' displays
> text. Function writeToLog() correctly writes to log file.
> I failed to run debugging.
> Here is my code:
>
> // import_statement.php:
> var_dump($statementNo); // works fine
> if (!empty($statementNo)) {
> error(ERRMSG_STATEMENT_ALREADY_IMPORTED); // enters error()
> }
> echo '#'; // here problem
>
> // functions.inc.php:
> function error($message) {
> global $currentUser;
> if (ob_get_length() !== false) {
> ob_end_flush();
> }
> var_dump($message); // here problem
> $page = $_SERVER['SERVER_NAME'] . '/' .
> trim($_SERVER['REQUEST_URI'], '/ ');
> $website = trim(ltrim(ltrim(WEBSITE_PUNYCODE, 'http:'), 'https:'),
> '/ ');
> $page = mb_strstr($page, $website);
> $page = trim(mb_substr($page, mb_strlen($website)), '/ ');
> writeToLog(null, null, $currentUser, null, null, null, "Application
> error: $message Page: $page"); // works fine
> die($message); // here problem
> }
>
> Please help. Thanks in advance.
Is that code possibly placed in an errorhandler?
Regards,
Erwin Moller
--
"That which can be asserted without evidence, can be dismissed without
evidence."
-- Christopher Hitchens
|
|
|
Re: neither var_dump() nor die() displays anything [message #173645 is a reply to message #173634] |
Fri, 22 April 2011 09:08 |
Helmut Chang
Messages: 22 Registered: September 2010
Karma: 0
|
Junior Member |
|
|
Am 21.04.2011 15:07, schrieb Jivanmukta:
> // functions.inc.php:
> function error($message) {
> global $currentUser;
> if (ob_get_length() !== false) {
> ob_end_flush();
> }
> var_dump($message); // here problem
Although I couldn't find it documented anywhere, I made the experience,
that any var_dumps() after an ob_end_clean() don't get displayed. Maybe
it's the same with your ob_end_flush()?
HTH, Helmut
|
|
|
Re: neither var_dump() nor die() displays anything [message #173647 is a reply to message #173641] |
Fri, 22 April 2011 10:57 |
Jerry Stuckle
Messages: 2598 Registered: September 2010
Karma: 0
|
Senior Member |
|
|
On 4/21/2011 9:05 PM, Jivanmukta wrote:
>> OK, do you have the following in your php.ini file (on your development
>> system):
>> display_errors=on
>> error_reporting=E_ALL // or E_ALL | E_STRICT
>
> I added these two lines to my code (before problem):
>
> ini_set('display_errors',1);
> error_reporting( E_ALL);
>
> but it didn't help: no error is displayed, I don't know why.
OK, do you have more than one output buffer?
In fact, why are you using the ob_xxx functions at all? They just add
extra load to the server and server no useful purpose except in a few
very specific cases.
--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex(at)attglobal(dot)net
==================
|
|
|
Re: neither var_dump() nor die() displays anything [message #173696 is a reply to message #173644] |
Fri, 29 April 2011 17:30 |
Jivanmukta
Messages: 20 Registered: January 2011
Karma: 0
|
Junior Member |
|
|
>> // import_statement.php:
>> var_dump($statementNo); // works fine
>> if (!empty($statementNo)) {
>> error(ERRMSG_STATEMENT_ALREADY_IMPORTED); // enters error()
>> }
>> echo '#'; // here problem
>
> Is that code possibly placed in an errorhandler?
No, it's not. The file import_statement.php is opened via
header('Location: import_statement.php'). The quoted lines are at top
level, not nested in a function.
|
|
|
|