On Mon, Sep 13, 2010 at 18:56, Tamara Temple <tamouse.li...@gmail.com>wrote:

> This isn't to answer your question, but...
>
>
> On Sep 13, 2010, at 5:16 PM, Camilo Sperberg wrote:
>
>> function my_error_handler($errno = '0', $errstr = '[FATAL] General Error',
>> $errfile = 'N/A', $errline = 'N/A', $errctx = '') {
>>  global $clean_exit;
>>  if(empty($clean_exit)) {
>>   ini_set('memory_limit','16M');
>>   ob_start();
>>   echo '<h1>PHP v'.PHP_VERSION.', error N&deg; '.$errno.'</h1>';
>> ?><h4>-- BEGIN COPY --</h4><p style="font-size:110%;margin:50px 0 20px
>> 25px"><em>Error N&deg;:</em><br /><?php
>>  echo '<strong>'.$errno.'</strong><br />';
>> ?><em>Error Detail:</em><br /><?php
>>   echo '<strong>'.$errstr.'</strong><br /><em>File:</em><br
>> /><strong>'.$errfile.'</strong><br /><em>Line:</em><br
>> /><strong>'.$errline.'</strong><br /><em>Debug:</em><br />';
>>   if (isset($errctx['r']['print'])) echo '<p>THIS LINE GIVES THE ERROR,
>> WHAT SHOULD IT RETURN?</p>';
>> ?></p><h4>-- END COPY --</h4><?php
>>   $content = ob_get_contents();
>>   ob_end_clean();
>>   die($content);
>>  }
>> }
>>
>
> Why do you put <?php echo...?> inside an echo statement in php space?
>
>

I think you may have mis-readed the code, I can't find where I put an <?php
echo inside an echo. I do a lot of opening/closing tags which contributes to
messing things up estetically but it works...

Any way, the posted code had a lot of remniscants of the production code,
here is a simplified version which does the same as above but .. well,
simplified :P

<?php
date_default_timezone_set('America/Santiago');
ini_set('memory_limit','1M');
ini_set('display_errors',1);
error_reporting(-1);

function my_error_handler($errno = '0', $errstr = '[FATAL] General Error',
$errfile = 'N/A', $errline = 'N/A', $errctx = '') {
  global $clean_exit;
  if(empty($clean_exit)) { // if isset or !empty, the script would have been
exited cleanly.
    ini_set('memory_limit','16M'); // This would be just to have enough
memory to print out the error.
    echo '<h5>-- BEGIN ERROR --</h5>Error N&deg;:
<strong>'.$errno.'</strong><br />Error Description:
<strong>'.$errstr.'</strong><br />File: <strong>'.$errfile.'</strong><br
/>Line: <strong>'.$errline.'</strong>';
    if (isset($errctx['r']['print'])) echo '<p>THIS LINE GIVES THE ERROR,
WHAT SHOULD IT RETURN?</p>'; // isset or empty gives the same error
    echo '<h5>-- END ERROR --</h5>';
    die(); // shutdown_function == manual die() or else it will continue to
execute.
  }
}
set_error_handler('my_error_handler');
register_shutdown_function('my_error_handler');

for ($i = 0; $i < 15000; $i++) $a[$i] = mt_rand(1,255);
$r['print'] = (string)$a[1]; // Just to asign something to that variable.
echo '<p>Everything fine.</p>';
$clean_exit = TRUE;

Greetings :)

-- 
Mailed by:
UnReAl4U - unreal4u
ICQ #: 54472056
www1: http://www.chw.net/
www2: http://unreal4u.com/

Reply via email to