Re: [PHP-DEV] Storing zvals in hash tables in resources

2010-10-23 Thread Martin Jansen
On 23.10.10 01:05, Gustavo Lopes wrote:
 On Fri, 22 Oct 2010 22:22:06 +0100, Martin Jansen mar...@divbyzero.net
 wrote:
 
 I'm trying to store zvals in a hash table which is part of a resource.
 Unfortunately the zvals do not seem to persist between function calls:
 
 You probably want to give a destructor to zend_hash_init, since you're
 storing zvals, that would be ZVAL_PTR_DTOR.
 
 You're not incrementing the refcount of the value you're adding to the
 hash table. Call zval_add_ref.

Those two hints seem to do the trick. Thanks!

- Martin

-- 
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DEV] [PATCH] Allowing an array as a parameter for snmpget()/snmpgetnext() [repost]

2010-10-23 Thread Jorrit Kronjee
Chris and others,

Since SNMP didn't have any unit tests to begin with, I just looked at
some examples. I guess I looked at the wrong ones (in the current
version 5811 unit tests have the SKIPIF sections, compared to 5416 that
do not).

Before I start adding these, can someone tell me what to do to get this
patch included? The maintainers of the SNMP extension have been silent
so far. I would love to make this patch fly, but if it's just not going
to happen then that's fine with me too.

Regards,

Jorrit Kronjee

On 10/11/2010 04:37 PM, Christopher Jones wrote:

 Hi Jorrit,

 I'm not able to comment on the question of inclusion, but I did notice
 that the .phpt
 files are missing SKIPIF sections.  See http://qa.php.net/write-test.php

 Chris

 On 10/11/2010 05:43 AM, Jorrit Kronjee wrote:
 Dear list,

 A few weeks ago I submitted the attached patch to this list. Apart from
 some initial comments I've not heard if the patch is good enough now to
 be added to the PHP sources.

 Is there anything still missing?

 Regards,

 Jorrit Kronjee




-- 
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DEV] Intermittent problem: can't write to properties of $this

2010-10-23 Thread Richard Lynch
On Thu, October 21, 2010 6:04 pm, Tim Steiner wrote:
 Greetings,

 I'm currently trying to troubleshoot an intermittent problem on one of
 our servers.  After some time of running just fine (usually a couple
 of
 hours),  scripts will start throwing the warning Attempt to assign
 property of non-object when writing to a property of the $this
 object.
   Once it starts, it seems to keep happening every few requests (with
 other requests running as expected).  The poster at
 http://www.zfforums.com/zend-framework-components-13/core-infrastructure-19/warning-attempt-assign-property-non-object-zend_config-5469.html
 seems to be having the same issue.

 I've traced the warning output to line 576 of Zend/zend_execute.c,
 which
 means that something is happening to the write_property of the object.
 At this point, I don't have enough knowledge of the internals to
 continue tracking this bug down.  Any help would be appreciated.

Try dumping out the value of $this or your variable or the moral
equivalent in C, and see exactly what it *IS* that you are trying to
set a property on...

Once you figure that out, you can often realize how you managed to get
in this state of existence, or at least start backtracking to see how
that value got in there in the first place.

It probably is in Userland code, with something that you think should
persist but actually doesn't...

A resource, session data, an object that got destructed and is now
GC-ed, etc are the usual suspects.

In particular, if you have any register_shutdown_function or
destructors on your classes, note that PHP does *NOT* guarantee any
particular order of destruction, nor even consistency of the same from
request to request.

Once your server gets busy, GC may be kicking in more, and objects you
think are still valid in a destructor probably aren't -- they're
halfway torn apart by PHP as it shuts down the script.

PS
Don't try to use echo in a destructor nor shutdown function.
http://php.net/error_log is your friend.


-- 
brain cancer update:
http://richardlynch.blogspot.com/search/label/brain%20tumor
Donate:
https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclickhosted_button_id=FS9NLTNEEKWBE



-- 
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php