Re: [PHP] error_handler : unique caller ID ?

2012-11-14 Thread B. Aerts

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


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] error_handler : unique caller ID ?

2012-11-13 Thread B. Aerts

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

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] error_handler : unique caller ID ?

2012-11-13 Thread Robert Williams
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).

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php