php-general Digest 14 Nov 2012 12:08:15 -0000 Issue 8039

Topics (messages 319703 through 319707):

Re: Date comparison going wrong, wrong, wrong
        319703 by: Matijn Woudt

Re: memory allocation error
        319704 by: Carol Peck

error_handler : unique "caller ID" ?
        319705 by: B. Aerts
        319706 by: Robert Williams
        319707 by: B. Aerts

Administrivia:

To subscribe to the digest, e-mail:
        php-general-digest-subscr...@lists.php.net

To unsubscribe from the digest, e-mail:
        php-general-digest-unsubscr...@lists.php.net

To post to the list, e-mail:
        php-gene...@lists.php.net


----------------------------------------------------------------------
--- Begin Message ---
On Tue, Nov 13, 2012 at 5:11 AM, Kanishka <kanishkani...@gmail.com> wrote:

> if we use a date after 19 January 2038, we can not use 'strtotime' to get
> timestamp.
> http://en.wikipedia.org/wiki/Year_2038_problem
>
>
Only if you're running 32bit OS. If you're running 64bit OS with 64bit PHP
you can represent about 580 billion years...

- Matijn

--- End Message ---
--- Begin Message ---


On 11/13/2012 6:29 AM, Matijn Woudt wrote:



On Tue, Nov 13, 2012 at 12:23 AM, Carol Peck <carolap...@gmail.com <mailto:carolap...@gmail.com>> wrote:


    On 11/12/2012 11:51 AM, Matijn Woudt wrote:

    On Mon, Nov 12, 2012 at 3:17 PM, Carol Peck <carolap...@gmail.com
    <mailto:carolap...@gmail.com>> wrote:

        Sebastian,
        Yes, I do , but this particular error never gets into my
        custom handler.
        I have also set it so that fatal errors fall through, and
        that doesn't seem to make any difference (again, probably
        because it never gets there).

        Carol


    Can you post the code of the error handler? I guess the bug is
    there. Bugs like these are mostly because of recursion errors or
    something. (Don't know if it's possible, but an error inside the
    error handler?)
    Fatal errors will btw always fall through, you can't catch fatal
    errors. You should, for testing, turn off your custom error
    handler and see what it does.

    - Matijn

    Ps. Please bottom-post on this mailing list.
    Here is the error class (I hope I"m posting the code the right
    way).  I will turn this off for a while.
    It's main purpose is to format the message before logging.  I do
    know that things are getting logged properly.

    Thanks again.


<Snip some code>

Your hosting is using SuPHP which most likely causes these problems. You have two options:
1) Get a better host, or even better, get a dedicated server.
2) Increase your memory limit, even though your script doesn't really reaches that limit, it seems that SuPHP somehow messes that up. Read more at [1].

- Matijn

[1] http://forum.inmotionhosting.com/viewtopic.php?t=3147
Matijn,
Thanks so much, I had found that post but thought it was related to the SilverStripe CMS they were referencing. I've been coming to the same conclusion about the host.
Cheers,
Carol


--- End Message ---
--- Begin Message ---
Dear list,

a penny for your thoughts on the following problem.

Does anyone have an idea how to find a unique "caller ID" for a user-defined error handler ?

The goal is to get a cached error messages tree where the following snippet would yield an array as below it:

// start-of-snippet

function Outer(&$a)
{
   trigger_error('entering Outer');
   $a=Inner($a) ;
   trigger_error('leaving Outer') ;
}

function Inner($x)
{
   trigger_error('entering Inner');
   return(2*$x) ;
}

trigger_error('Here we go ');
$b = 1 ;
$b = Outer($b) ;
trigger_error('End result is $b');


// end-of-snippet

Output:

Array(
[0] => 'Here we go'
['Outer(<unique_ID_01>)'] => Array(
   [0] => 'entering Outer' ;
   ['Inner(<unique_ID_02>)'] => Array(
      [0] => 'entering Inner' ;
       )
   [1] => 'leaving Outer' ;
   )
[1] => 'End result is 2'
)

I've considered the 'args' option in debug_backtrace(), but that fails for referenced arguments.

Having read access to a variable's address (like a C-pointer) would be perfect - but Google tells me you can't in PHP.

Any other idea's ?

Regards,

Bert

--- End Message ---
--- Begin Message ---
On 11/13/12 11:20, "B. Aerts" <ba_ae...@yahoo.com> wrote:


>Having read access to a variable's address (like a C-pointer) would be
>perfect - but Google tells me you can't in PHP.

If you can restrict yourself to objects for the passed variables, you can
use spl_object_hash(). It does exactly what you need, but it only works
with objects. AFAIK, there's no equivalent for scalars or arrays.

<http://php.net/manual/en/function.spl-object-hash.php>


Regards,
Bob

--
Robert E. Williams, Jr.
Associate Vice President of Software Development
Newtek Businesss Services, Inc. -- The Small Business Authority
https://www.newtekreferrals.com/rewjr
http://www.thesba.com/







Notice: This communication, including attachments, may contain information that 
is confidential. It constitutes non-public information intended to be conveyed 
only to the designated recipient(s). If the reader or recipient of this 
communication is not the intended recipient, an employee or agent of the 
intended recipient who is responsible for delivering it to the intended 
recipient, or if you believe that you have received this communication in 
error, please notify the sender immediately by return e-mail and promptly 
delete this e-mail, including attachments without reading or saving them in any 
manner. The unauthorized use, dissemination, distribution, or reproduction of 
this e-mail, including attachments, is prohibited and may be unlawful. If you 
have received this email in error, please notify us immediately by e-mail or 
telephone and delete the e-mail and the attachments (if any).

--- End Message ---
--- Begin Message ---
On 13/11/12 20:04, Robert Williams wrote:
On 11/13/12 11:20, "B. Aerts" <ba_ae...@yahoo.com> wrote:


Having read access to a variable's address (like a C-pointer) would be
perfect - but Google tells me you can't in PHP.

If you can restrict yourself to objects for the passed variables, you can
use spl_object_hash(). It does exactly what you need, but it only works
with objects. AFAIK, there's no equivalent for scalars or arrays.

<http://php.net/manual/en/function.spl-object-hash.php>


Regards,
Bob

--
Robert E. Williams, Jr.
Associate Vice President of Software Development
Newtek Businesss Services, Inc. -- The Small Business Authority
https://www.newtekreferrals.com/rewjr
http://www.thesba.com/


Hello Bob,

thanks for the tip - indeed it does exactly what I need.
Unfortunately, I need to keep scalars/arrays in the frame too.

But thinking along your line, do you know of a function that does a similar thing to the function call itsself ?

( as functions get stacked, called recursive or through callback mechanisms, there must be a similar allocation table/mechanism as for variables/objects)

Regards,

Bert


--- End Message ---

Reply via email to