FUDforum
Fast Uncompromising Discussions. FUDforum will get your users talking.

Home » Imported messages » comp.lang.php » neither var_dump() nor die() displays anything
Show: Today's Messages :: Polls :: Message Navigator
Switch to threaded view of this topic Create a new topic Submit Reply
neither var_dump() nor die() displays anything [message #173634] Thu, 21 April 2011 13:07 Go to next message
Jivanmukta is currently offline  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 Go to previous messageGo to next message
Jerry Stuckle is currently offline  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 #173636 is a reply to message #173635] Thu, 21 April 2011 17:39 Go to previous messageGo to next message
Jivanmukta is currently offline  Jivanmukta
Messages: 20
Registered: January 2011
Karma: 0
Junior Member
> 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.
Re: neither var_dump() nor die() displays anything [message #173639 is a reply to message #173636] Fri, 22 April 2011 00:00 Go to previous messageGo to next message
Jerry Stuckle is currently offline  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 Go to previous messageGo to next message
Jivanmukta is currently offline  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 Go to previous messageGo to next message
Unrest is currently offline  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 Go to previous messageGo to next message
Erwin Moller is currently offline  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 Go to previous messageGo to next message
Helmut Chang is currently offline  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 Go to previous messageGo to next message
Jerry Stuckle is currently offline  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 Go to previous messageGo to next message
Jivanmukta is currently offline  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.
Re: neither var_dump() nor die() displays anything [message #173697 is a reply to message #173635] Fri, 29 April 2011 17:34 Go to previous message
Jivanmukta is currently offline  Jivanmukta
Messages: 20
Registered: January 2011
Karma: 0
Junior Member
> Have you tried looking at your page source?

If you mean View|Source in a browser - yes, I tried. The source code
(HTML) contains only result of var_dump($statementNo).
There's no error information although I have error reporting set to
E_ALL.
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: PHP Tutorials
Next Topic: PHP Runs In WinXP Command Window But Not In Browser
Goto Forum:
  

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ]

Current Time: Sat Nov 30 21:13:54 GMT 2024

Total time taken to generate the page: 0.02345 seconds