Re: [PHP-DEV] [VOTE] Choosing a distributed version control system for PHP

2011-08-25 Thread Lester Caine

Gwynne Raskind wrote:

On Wed, Aug 24, 2011 at 19:03, David Soria Parrad...@php.net  wrote:

  Those wanting to use git and git workflows have a disadvantage when we stay 
with SVN.
  Choosing a VCS happens from time to time and sometimes your favorit is not 
the winner.
  I personally would love to see PHP moving to hg, but if more people like git 
more, the
  hg people have to deal with it.

Agreed on both counts.

It _is_ nice to see that I am not alone in preferring hg ...
Sometimes it does seem that I'm in a minority of 1.


  The RFC points out that there will be modules. We will_not_  copy the 
current SVN
  history into one big repo. In fact having everything, pecl, php-src and co 
in one
  repository does not make sense.

The original plan called for the SVN repo to be split up at some point
in the future, but DVCS gained traction and SVN went without any
attempts by anyone to put a proper workflow of any kind in place.

And I think this is the point.
With the right structure in place then it _will_ be easier for cross dvcs 
working. The current plan calls for all of php-src to be a single repo, with 
rules for moving extra modules in and out. That is the single repo I am 
referring to and potentially it will be as unwieldy as the libreoffice setup? It 
_is_ about time that splitting things up was considered in a little more detail 
so we can work on every module with the same ease as 'extra' extensions are now 
currently managed? Even the argument that one needs to see all the history at 
once has the alternative view that just seeing commits for a single module would 
be helpful?


( Note Pierre - I'm not using upper case for emphasis - I started text messaging 
when the printers only had upper case so I'm still learning these newfangled 
ways :) )


--
Lester Caine - G8HFL
-
Contact - http://lsces.co.uk/wiki/?page=contact
L.S.Caine Electronic Services - http://lsces.co.uk
EnquirySolve - http://enquirysolve.com/
Model Engineers Digital Workshop - http://medw.co.uk//
Firebird - http://www.firebirdsql.org/index.php

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



[PHP-DEV] Array as class member and refcounting

2011-08-25 Thread Flavius Aspra
There is something that confuses me. Let there be a class member 
Foo::$bar, which has to be initialized as an empty array in the 
constructor. If I do that (via zend_update_property), its refcount is 
increased (from 1, which it gets after alloc + array_init, to 2). It is 
obvious why this happens, since from zend_update_property gets a 
variable from somone in the outside world, and so it is right to ++ it.


But in this particular case, the array being initialized in the 
constructor, it does not need a refcount of 2, 1 is right, since it's 
used only by the object (yet).


So I thought I will Z_DELREF_P() it. And it worked. Until I started 
valgrind, which was reporting:


==4538== Invalid read of size 4
==4538==at 0x822D3C6: _zval_ptr_dtor (zend.h:385)
==4538==by 0x823C1FF: _zval_ptr_dtor_wrapper (zend_variables.c:189)
==4538==by 0x824E1A1: zend_hash_destroy (zend_hash.c:529)
==4538==by 0x826655A: zend_object_std_dtor (zend_objects.c:45)
==4538==by 0x8266A28: zend_objects_free_object_storage 
(zend_objects.c:126)
==4538==by 0x826C43D: zend_objects_store_del_ref_by_handle_ex 
(zend_objects_API.c:220)
==4538==by 0x826C0AC: zend_objects_store_del_ref 
(zend_objects_API.c:172)

==4538==by 0x823BD77: _zval_dtor_func (zend_variables.c:52)
==4538==by 0x822B99B: _zval_dtor (zend_variables.h:35)
==4538==by 0x822D463: _zval_ptr_dtor (zend_execute_API.c:443)
==4538==by 0x823C1FF: _zval_ptr_dtor_wrapper (zend_variables.c:189)
==4538==by 0x824E518: zend_hash_apply_deleter (zend_hash.c:614)
==4538==  Address 0x44c1718 is 8 bytes inside a block of size 20 free'd

So it looks like the ZE really needs the refcount to be 2. All other 
tests I've written work fine, no memleaks, no segfaults whatsoever.


Still I am a little bit confused: WHY does it need it be higher than 
(from my understanding) it should be?


Thanks,
Flavius

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



Re: [PHP-DEV] PHP 5.3.8 Released!

2011-08-25 Thread Pierre Joye
On Thu, Aug 25, 2011 at 3:51 AM, a...@akbkhome.com a...@akbkhome.com wrote:

 BTW. we could really do with a searchable archive of php.dev + internals...
 - It's pretty difficult to find out if this was ever discussed before..

Again, it was discussed already and the argument of using instanceof
was used to deprecate is_a (along other arguments). I see no point to
argue again about that. It was a mistake to change it again in 5.3,
Zeev realized the use in this exact case, let move on now. Revert that
in 5.3 and do it only in 5.4.


-- 
Pierre

@pierrejoye | http://blog.thepimp.net | http://www.libgd.org

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



RE: [PHP-DEV] PHP 5.3.8 Released!

2011-08-25 Thread Zeev Suraski
 -Original Message-
 From: Pierre Joye [mailto:pierre@gmail.com]
 Sent: Thursday, August 25, 2011 11:31 AM
 To: a...@akbkhome.com
 Cc: Stas Malyshev; internals@lists.php.net
 Subject: Re: [PHP-DEV] PHP 5.3.8 Released!
 
 On Thu, Aug 25, 2011 at 3:51 AM, a...@akbkhome.com
 a...@akbkhome.com wrote:
 
  BTW. we could really do with a searchable archive of php.dev + internals...
  - It's pretty difficult to find out if this was ever discussed before..
 
 Again, it was discussed already and the argument of using instanceof was used
 to deprecate is_a (along other arguments). I see no point to argue again about
 that. It was a mistake to change it again in 5.3, Zeev realized the use in 
 this
 exact case, let move on now. Revert that in 5.3 and do it only in 5.4.

Just so that my position is clear on the matter:
- I still think that is_a() is working properly the way it does now, after the 
change.
- I think the code in isError() is wrong, and should be fixed.
- Had we (the collective we) known that fixing is_a() would result in such 
breakage, it would have probably been wise not to fix it in 5.3.x, and wait for 
5.4 for this purpose.
- Given that we've already done it - I wouldn't revert it. Fix it in PEAR.  
That's the only way to create something that works across all versions of 5.3.x.

Zeev



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



Re: [PHP-DEV] PHP 5.3.8 Released!

2011-08-25 Thread Pierre Joye
On Thu, Aug 25, 2011 at 10:39 AM, Zeev Suraski z...@zend.com wrote:
 -Original Message-
 From: Pierre Joye [mailto:pierre@gmail.com]
 Sent: Thursday, August 25, 2011 11:31 AM
 To: a...@akbkhome.com
 Cc: Stas Malyshev; internals@lists.php.net
 Subject: Re: [PHP-DEV] PHP 5.3.8 Released!

 On Thu, Aug 25, 2011 at 3:51 AM, a...@akbkhome.com
 a...@akbkhome.com wrote:

  BTW. we could really do with a searchable archive of php.dev + internals...
  - It's pretty difficult to find out if this was ever discussed before..

 Again, it was discussed already and the argument of using instanceof was used
 to deprecate is_a (along other arguments). I see no point to argue again 
 about
 that. It was a mistake to change it again in 5.3, Zeev realized the use in 
 this
 exact case, let move on now. Revert that in 5.3 and do it only in 5.4.

 Just so that my position is clear on the matter:
 - I still think that is_a() is working properly the way it does now, after 
 the change.
 - I think the code in isError() is wrong, and should be fixed.
 - Had we (the collective we) known that fixing is_a() would result in such 
 breakage, it would have probably been wise not to fix it in 5.3.x, and wait 
 for 5.4 for this purpose.
 - Given that we've already done it - I wouldn't revert it. Fix it in PEAR.  
 That's the only way to create something that works across all versions of 
 5.3.x.

I won't battle endlessly to get that fixed back again (you will always
find smtg else to keep that thing in anyway ;-) but it does confirm
what I said earlier about changing behaviors in patch releases. This
is something we must deal with much more carefully. And using x.y.0
tests as base is a good start, also the BC breakages are now covered
by the RFC, let stick to that for 5.4.x.


Cheers,
-- 
Pierre

@pierrejoye | http://blog.thepimp.net | http://www.libgd.org

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



RE: [PHP-DEV] PHP 5.3.8 Released!

2011-08-25 Thread Johannes Schlüter
On Thu, 2011-08-25 at 08:39 +, Zeev Suraski wrote:
 - Given that we've already done it - I wouldn't revert it. Fix it in
 PEAR.  That's the only way to create something that works across all
 versions of 5.3.x.

Unfortunately this is the case.

johannes



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



Re: [PHP-DEV] [VOTE] Choosing a distributed version control system for PHP

2011-08-25 Thread Derick Rethans
On Wed, 24 Aug 2011, Stas Malyshev wrote:

 On 8/24/11 2:03 PM, David Soria Parra wrote:
  
  after 3 weeks of discussion, I think we are ready to start voting on 
  the DVCS RFC.  If you think something is missing or should be 
  explained in more detail, let me know.
 
 I'm not sure choosing DCVS by vote is actually a good way to go here. 
 I think we need much more input from people that maintain all the 
 infrastructure we're using now and would be doing the move. If we 
 don't have people committed to making it happen majority-based vote is 
 useless IMHO.

I agree, and I also think that before people can make a choice they need 
to have played with all the options. Just picking git because that's 
what you heard of and what all the fan boys like is *not* the correct 
way to go. In order to make a choice, and even consider switching away 
from SVN, something that *works* just fine, you need to know the systems 
(ie, git and hg).

cheers,
Derick

-- 
http://derickrethans.nl | http://xdebug.org
Like Xdebug? Consider a donation: http://xdebug.org/donate.php
twitter: @derickr and @xdebug

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



Re: [PHP-DEV] [VOTE] Choosing a distributed version control system for PHP

2011-08-25 Thread Ivan Enderlin @ Hoa

On 25/08/11 11:15, Derick Rethans wrote:

On Wed, 24 Aug 2011, Stas Malyshev wrote:


On 8/24/11 2:03 PM, David Soria Parra wrote:

after 3 weeks of discussion, I think we are ready to start voting on
the DVCS RFC.  If you think something is missing or should be
explained in more detail, let me know.

I'm not sure choosing DCVS by vote is actually a good way to go here.
I think we need much more input from people that maintain all the
infrastructure we're using now and would be doing the move. If we
don't have people committed to making it happen majority-based vote is
useless IMHO.

I agree, and I also think that before people can make a choice they need
to have played with all the options. Just picking git because that's
what you heard of and what all the fan boys like is *not* the correct
way to go. In order to make a choice, and even consider switching away
from SVN, something that *works* just fine, you need to know the systems
(ie, git and hg).

+10.
I think a vote is prematured right now.

Cheers.

--
Ivan Enderlin
Developer of Hoa
http://hoa.42/ or http://hoa-project.net/

Member of HTML and WebApps Working Group of W3C
http://w3.org/


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



Re: [PHP-DEV] [VOTE] Choosing a distributed version control system for PHP

2011-08-25 Thread David Soria Parra
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

On 08/25/2011 11:28 AM, Ivan Enderlin @ Hoa wrote:
 On 25/08/11 11:15, Derick Rethans wrote:
 On Wed, 24 Aug 2011, Stas Malyshev wrote: I agree, and I also think
 that before people can make a choice they need to have played with
 all the options. Just picking git because that's what you heard
 of and what all the fan boys like is *not* the correct way to go.
 In order to make a choice, and even consider switching away from
 SVN, something that *works* just fine, you need to know the
 systems (ie, git and hg).
 +10. I think a vote is prematured right now.
so what do you suggest? We talk about the topic for 3 weeks now, and I
think waiting any longer will not make more people familar with HG. So
how do you make people take a look at the VCS in question? I'm open
for suggestions.

People now have 2 weeks to try out PHP by using the mirrors from either
git.php.net or hg.php.net and see how their favourite system works. For
me it seems most people don't even read the RFC and the recommendation,
so I don't expect them to try out the VCS, but I don't have a clue how
to change it.

Joking: Next time I'll add a survey that you need to complete
successfully before being alllowed to vote ;).
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.11 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iQIcBAEBAgAGBQJOVhfNAAoJEAT0aMuPE7Z1zukP/2IrTehCAE2AU+3CFSwh05NI
san2ncCOfk3tdn6zOuc+4rYGWfSfixqjC0Xre7nma8sRb14zRt1kpzB5xA6EL2i9
SgqfPEUcpzPAF5QkoNrnR9FnZfFK/y/QXTRaupdk/ApLg2rdwegG2BzdB5AiofN7
Q1kxTlVBnwlizPH4J/0/H0kzm9/spkRhWkXslVtvkhVy/7yZH7I7R8kd+voy+6bE
jmYuI7hS4Jf2/T0OFA9Js2V3sopOwOy7tuutEUqZ30EXjrE0UKFGs9eiGuBJaMF3
MLgvlSa6tcaAD+yJ8tLraJ1awUNl29kPT2QTJZQkgkJ07iKqPjipJu5jYRLQ6qdy
kPuec7gUWC4jzrdmCsvtB1fdEGKWiCXspnP0KgGXjVmqreSvZBabiZm0fOEHqHST
foqV7weQe/4wZd3n8UxTsk/Pd27OU5uXllkApsy123d7rV0hv9CEPy5WI7nlWsnB
+necXTfdUeOFV2Vdgw7mDPXxf5vIC6t/rXiO2UjGd0QUZz9rxnb+JjQ5CAIpgeZz
JVqXJH0RbVa7rIcxBctRmvZ/qq9oEQ9C4Du5vCSr8vOW7PKFJUo7QODd9cDbtBsS
0TnX8diqpw1JaXblIKrYmsUANkIiHLpynT3W9SZeCqdUjt8weiF8xAxbJKkA9/Tj
ZE87iAbx3L+GfGNJ5ayz
=Q5uu
-END PGP SIGNATURE-

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



[PHP-DEV] ReflectionClass::newInstanceWithoutConstructor()

2011-08-25 Thread Sebastian Bergmann

 I have attached a patch to https://bugs.php.net/bug.php?id=55490 that
 implements ReflectionClass::newInstanceWithoutConstructor() to create an
 object a class without invoking the constructor.

 As there are certain internal classes that would crash when their
 constructor is not invoked, this new method of the Reflection API only
 works for userland-defined classes.

 Unless there are objections, I will commit this change to PHP_5_4 and
 trunk on Monday. I will add the method to the documentation as well, of
 course.

--
Sebastian BergmannCo-Founder and Principal Consultant
http://sebastian-bergmann.de/   http://thePHP.cc/

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



Re: [PHP-DEV] [VOTE] Choosing a distributed version control system for PHP

2011-08-25 Thread Ivan Enderlin @ Hoa

On 25/08/11 11:37, David Soria Parra wrote:


On 08/25/2011 11:28 AM, Ivan Enderlin @ Hoa wrote:

On 25/08/11 11:15, Derick Rethans wrote:

On Wed, 24 Aug 2011, Stas Malyshev wrote: I agree, and I also think
that before people can make a choice they need to have played with
all the options. Just picking git because that's what you heard
of and what all the fan boys like is *not* the correct way to go.
In order to make a choice, and even consider switching away from
SVN, something that *works* just fine, you need to know the
systems (ie, git and hg).

+10. I think a vote is prematured right now.

so what do you suggest? We talk about the topic for 3 weeks now, and I
think waiting any longer will not make more people familar with HG. So
how do you make people take a look at the VCS in question? I'm open
for suggestions.

I know. It's a difficult choice.
But if we change our VCS for a DVCS, we do it for contributors or 
maintainers? If maintainers are the most concerned people, they should 
give a try to Hg and Git for a period longer than 2 weeks (2 months 
seems to be a reasonable period, 1 month with Hg, 1 month with Git).
For the moment, the vote is opened to contributors. Maybe it's not a 
good “target” for the vote.




People now have 2 weeks to try out PHP by using the mirrors from either
git.php.net or hg.php.net and see how their favourite system works. For
me it seems most people don't even read the RFC and the recommendation,
so I don't expect them to try out the VCS, but I don't have a clue how
to change it.
I don't too. I think Git is more complicated than Hg and I regret the 
way the vote is changing. But, I repeat, I think the target for the vote 
is not appropriated.




Joking: Next time I'll add a survey that you need to complete
successfully before being alllowed to vote ;).

s/Joking/Todo/ :-)

Best regards.

--
Ivan Enderlin
Developer of Hoa
http://hoa.42/ or http://hoa-project.net/

Member of HTML and WebApps Working Group of W3C
http://w3.org/



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



Re: [PHP-DEV] [VOTE] Choosing a distributed version control system for PHP

2011-08-25 Thread David Soria Parra
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

On 08/25/2011 11:56 AM, Ivan Enderlin @ Hoa wrote:
 On 25/08/11 11:37, David Soria Parra wrote:

 On 08/25/2011 11:28 AM, Ivan Enderlin @ Hoa wrote:
 On 25/08/11 11:15, Derick Rethans wrote:
 On Wed, 24 Aug 2011, Stas Malyshev wrote: I agree, and I also think
 that before people can make a choice they need to have played with
 all the options. Just picking git because that's what you heard
 of and what all the fan boys like is *not* the correct way to go.
 In order to make a choice, and even consider switching away from
 SVN, something that *works* just fine, you need to know the
 systems (ie, git and hg).
 +10. I think a vote is prematured right now.
 so what do you suggest? We talk about the topic for 3 weeks now, and I
 think waiting any longer will not make more people familar with HG. So
 how do you make people take a look at the VCS in question? I'm open
 for suggestions.
 I know. It's a difficult choice.
 But if we change our VCS for a DVCS, we do it for contributors or
 maintainers? If maintainers are the most concerned people, they should
 give a try to Hg and Git for a period longer than 2 weeks (2 months
 seems to be a reasonable period, 1 month with Hg, 1 month with Git).
 For the moment, the vote is opened to contributors. Maybe it's not a
 good “target” for the vote.
I think we are mostly concerned with contributers, nevertheless, if
people like to have more time, I have not problem with extending the
voting period to 4 or 6 weeks. You can always change your vote if you
find out another VCS is more suitable.
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.11 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iQIcBAEBAgAGBQJOVhzlAAoJEAT0aMuPE7Z1SB8QAICKk8PB+gVXSoq5c61oV7qy
yO4TFBbN8z/8f4KBpk1ai1BYP4VWESSXi9oJl/hZBwXFMZlBoa6a8lMU7wA431yK
pUQBhWXCBHfUlVXF4/PBWS6F2pvrRhHZFG/gexANurnPEmQD4idQnjUb98SkuTtQ
rA+9O3ON5ybUis8WZ1P23WjxTv6RFwU0EK2QfzhP9PXcDiXxiJhMAcNvUO10htdT
JPKabjJsDTCixRCf21UGsatX82rLdhy7NbWmEz0i95qjOYpps6qUqkIn+9bHVOsC
YXzBbMwnWRHeiafgf8N431mSEurlP5Oj8W9P+BHatd2YGO3TZVANKzEAeWNdQDMk
pnGtpP+XK9M7+OvnyX3/qX08s+g3vt0gCLMrI451lCJ7bq5lV+q6SXopzE5kVkBG
WA04TDh/6x1N96ijq12bCLIe+/DtEKsEDLvCFYt7IrGxCzbtepJa27RzYdkw378e
vMlHSlOt9h64tBV9Er814STEkr6S00VQLnJOSmQjB9QL/5vZ7HeWQK7kR4OuSaxN
OaTBSkU3BHVlO6CPujm3GhchtI0Vf6frREVA+0AdHJmBbQtxijF36xeP2ZFIqPxw
tbwI+wScfmD0ZMWtvy1DfL6E0EukElUYqrkdrnjqohRcw85NguUM733rBmfnXPfv
7x1fsSF8iS78jgDRF5SA
=BLPg
-END PGP SIGNATURE-

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



Re: [PHP-DEV] ReflectionClass::newInstanceWithoutConstructor()

2011-08-25 Thread Pierre Joye
hi,

On Thu, Aug 25, 2011 at 11:46 AM, Sebastian Bergmann sebast...@php.net wrote:
  I have attached a patch to https://bugs.php.net/bug.php?id=55490 that
  implements ReflectionClass::newInstanceWithoutConstructor() to create an
  object a class without invoking the constructor.

  As there are certain internal classes that would crash when their
  constructor is not invoked, this new method of the Reflection API only
  works for userland-defined classes.

Looks good and as you do the check to avoid internal classes, that's all good :)

Cheers,
-- 
Pierre

@pierrejoye | http://blog.thepimp.net | http://www.libgd.org

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



Re: [PHP-DEV] ReflectionClass::newInstanceWithoutConstructor()

2011-08-25 Thread Gustavo Lopes
On Thu, 25 Aug 2011 10:46:21 +0100, Sebastian Bergmann sebast...@php.net  
wrote:



  I have attached a patch to https://bugs.php.net/bug.php?id=55490 that
  implements ReflectionClass::newInstanceWithoutConstructor() to create  
an

  object a class without invoking the constructor.

  As there are certain internal classes that would crash when their
  constructor is not invoked, this new method of the Reflection API only
  works for userland-defined classes.



What about userland classes that extend internal classes?

--
Gustavo Lopes

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



Re: [PHP-DEV] ReflectionClass::newInstanceWithoutConstructor()

2011-08-25 Thread Patrick ALLAERT
2011/8/25 Sebastian Bergmann sebast...@php.net:
  I have attached a patch to https://bugs.php.net/bug.php?id=55490 that
  implements ReflectionClass::newInstanceWithoutConstructor() to create an
  object a class without invoking the constructor.

  As there are certain internal classes that would crash when their
  constructor is not invoked, this new method of the Reflection API only
  works for userland-defined classes.

+1 for the feature

  Unless there are objections, I will commit this change to PHP_5_4

+0

 and trunk on Monday.

+1

 I will add the method to the documentation as well, of
  course.

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



Re: [PHP-DEV] ReflectionClass::newInstanceWithoutConstructor()

2011-08-25 Thread Richard Quadling
On 25 August 2011 10:46, Sebastian Bergmann sebast...@php.net wrote:
  I have attached a patch to https://bugs.php.net/bug.php?id=55490 that
  implements ReflectionClass::newInstanceWithoutConstructor() to create an
  object a class without invoking the constructor.

  As there are certain internal classes that would crash when their
  constructor is not invoked, this new method of the Reflection API only
  works for userland-defined classes.

  Unless there are objections, I will commit this change to PHP_5_4 and
  trunk on Monday. I will add the method to the documentation as well, of
  course.

Wouldn't ReflectionClass::newMockInstance() be a better name?

What other use cases exists?



-- 
Richard Quadling
Twitter : EE : Zend : PHPDoc
@RQuadling : e-e.com/M_248814.html : bit.ly/9O8vFY : bit.ly/lFnVea

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



Re: [PHP-DEV] ReflectionClass::newInstanceWithoutConstructor()

2011-08-25 Thread Sebastian Bergmann

On 08/25/2011 02:26 PM, Richard Quadling wrote:

Wouldn't ReflectionClass::newMockInstance() be a better name?


 It is not specific to stubbing/mocking.


What other use cases exists?


 ORM and stubbing/mocking should be enough.

--
Sebastian BergmannCo-Founder and Principal Consultant
http://sebastian-bergmann.de/   http://thePHP.cc/

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



Re: [PHP-DEV] ReflectionClass::newInstanceWithoutConstructor()

2011-08-25 Thread Etienne Kneuss
Hi,

On Thu, Aug 25, 2011 at 11:46, Sebastian Bergmann sebast...@php.net wrote:
  I have attached a patch to https://bugs.php.net/bug.php?id=55490 that
  implements ReflectionClass::newInstanceWithoutConstructor() to create an
  object a class without invoking the constructor.

To me this feature makes no sense. But if people find use for it and
it remains in Reflection, I won't object to it, so +0.


  As there are certain internal classes that would crash when their
  constructor is not invoked, this new method of the Reflection API only
  works for userland-defined classes.

I don't believe there should be this artificial distinction. Internal
classes should behave like userland ones in every aspect, let's not
put additional barriers.

If an internal class can't behave well without a constructor call,
that should already be fixed/prevented, as it's already possible by
extending it.


  Unless there are objections, I will commit this change to PHP_5_4 and
  trunk on Monday. I will add the method to the documentation as well, of
  course.

 --
 Sebastian Bergmann                    Co-Founder and Principal Consultant
 http://sebastian-bergmann.de/                           http://thePHP.cc/

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





-- 
Etienne Kneuss
http://www.colder.ch

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



Re: [PHP-DEV] ReflectionClass::newInstanceWithoutConstructor()

2011-08-25 Thread Sebastian Bergmann

On 08/25/2011 01:46 PM, Gustavo Lopes wrote:

What about userland classes that extend internal classes?


 Good point. How would I implement such a check?

--
Sebastian BergmannCo-Founder and Principal Consultant
http://sebastian-bergmann.de/   http://thePHP.cc/

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



Re: [PHP-DEV] ReflectionClass::newInstanceWithoutConstructor()

2011-08-25 Thread Sebastian Bergmann

On 08/25/2011 02:39 PM, Etienne Kneuss wrote:

To me this feature makes no sense. But if people find use for it and
it remains in Reflection, I won't object to it, so +0.


 It should only be used for meta programming, of course ;-)


If an internal class can't behave well without a constructor call,
that should already be fixed/prevented, as it's already possible by
extending it.


 I second that emotion but as long as those internal classes are not
 fixed I think it makes sense to disallow creating objects of internal
 classes without invoking their constructor.

--
Sebastian BergmannCo-Founder and Principal Consultant
http://sebastian-bergmann.de/   http://thePHP.cc/

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



Re: [PHP-DEV] ReflectionClass::newInstanceWithoutConstructor()

2011-08-25 Thread Kalle Sommer Nielsen
Hi

2011/8/25 Sebastian Bergmann sebast...@php.net:
  Good point. How would I implement such a check?

Speaking of which, wouldn't it be easier to check all our internal
classes for such failures and fix them accordingly with this addition
(Fix the dont-crash-without-calling-constructor)?

We could do like that of above and cast an exception instead of
E_RECOVERABLE_ERROR (as I believe is being cast now) in 5.4.

-- 
regards,

Kalle Sommer Nielsen
ka...@php.net

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



Re: [PHP-DEV] ReflectionClass::newInstanceWithoutConstructor()

2011-08-25 Thread Sebastian Bergmann

On 08/25/2011 02:47 PM, Kalle Sommer Nielsen wrote:

Speaking of which, wouldn't it be easier to check all our internal
classes for such failures and fix them accordingly with this addition
(Fix the dont-crash-without-calling-constructor)?

We could do like that of above and cast an exception instead of
E_RECOVERABLE_ERROR (as I believe is being cast now) in 5.4.


 Makes sense to me.

--
Sebastian BergmannCo-Founder and Principal Consultant
http://sebastian-bergmann.de/   http://thePHP.cc/

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



Re: [PHP-DEV] ReflectionClass::newInstanceWithoutConstructor()

2011-08-25 Thread Etienne Kneuss
Hi,

On Thu, Aug 25, 2011 at 14:43, Sebastian Bergmann sebast...@php.net wrote:
 On 08/25/2011 02:39 PM, Etienne Kneuss wrote:

 To me this feature makes no sense. But if people find use for it and
 it remains in Reflection, I won't object to it, so +0.

  It should only be used for meta programming, of course ;-)

 If an internal class can't behave well without a constructor call,
 that should already be fixed/prevented, as it's already possible by
 extending it.

  I second that emotion but as long as those internal classes are not
  fixed I think it makes sense to disallow creating objects of internal
  classes without invoking their constructor.

It is already possible to do that currently, with or without this
feature, so you're not preventing much abuse by doing that here. As I
said, artificial distinction.

This feature however alters the necessary checks for missing
constructor calls (at least the ones implemented in SPL as of 5.4), as
those assume a userland subclass.


 --
 Sebastian Bergmann                    Co-Founder and Principal Consultant
 http://sebastian-bergmann.de/                           http://thePHP.cc/

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





-- 
Etienne Kneuss
http://www.colder.ch

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



Re: [PHP-DEV] ReflectionClass::newInstanceWithoutConstructor()

2011-08-25 Thread Pierre Joye
On Thu, Aug 25, 2011 at 2:41 PM, Sebastian Bergmann sebast...@php.net wrote:
 On 08/25/2011 01:46 PM, Gustavo Lopes wrote:

 What about userland classes that extend internal classes?

  Good point. How would I implement such a check?

Checking the same thing than what instanceof does


Cheers,
-- 
Pierre

@pierrejoye | http://blog.thepimp.net | http://www.libgd.org

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



Re: [PHP-DEV] ReflectionClass::newInstanceWithoutConstructor()

2011-08-25 Thread Etienne Kneuss
Hi,

On Thu, Aug 25, 2011 at 14:49, Sebastian Bergmann sebast...@php.net wrote:
 On 08/25/2011 02:47 PM, Kalle Sommer Nielsen wrote:

 Speaking of which, wouldn't it be easier to check all our internal
 classes for such failures and fix them accordingly with this addition
 (Fix the dont-crash-without-calling-constructor)?

 We could do like that of above and cast an exception instead of
 E_RECOVERABLE_ERROR (as I believe is being cast now) in 5.4.

  Makes sense to me.

There is already some standardized checks for 5.4 that wrap around the
get_constructor handler. But it should/could be standardized at the
engine level. And those raise exceptions in case they detect a
uncalled constructor.


 --
 Sebastian Bergmann                    Co-Founder and Principal Consultant
 http://sebastian-bergmann.de/                           http://thePHP.cc/

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





-- 
Etienne Kneuss
http://www.colder.ch

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



Re: [PHP-DEV] ReflectionClass::newInstanceWithoutConstructor()

2011-08-25 Thread Etienne Kneuss
On Thu, Aug 25, 2011 at 14:54, Etienne Kneuss col...@php.net wrote:
 Hi,

 On Thu, Aug 25, 2011 at 14:49, Sebastian Bergmann sebast...@php.net wrote:
 On 08/25/2011 02:47 PM, Kalle Sommer Nielsen wrote:

 Speaking of which, wouldn't it be easier to check all our internal
 classes for such failures and fix them accordingly with this addition
 (Fix the dont-crash-without-calling-constructor)?

 We could do like that of above and cast an exception instead of
 E_RECOVERABLE_ERROR (as I believe is being cast now) in 5.4.

  Makes sense to me.

 There is already some standardized checks for 5.4 that wrap around the
 get_constructor handler.

In SPL, that is

 But it should/could be standardized at the
 engine level. And those raise exceptions in case they detect a
 uncalled constructor.


 --
 Sebastian Bergmann                    Co-Founder and Principal Consultant
 http://sebastian-bergmann.de/                           http://thePHP.cc/

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





 --
 Etienne Kneuss
 http://www.colder.ch




-- 
Etienne Kneuss
http://www.colder.ch

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



Re: [PHP-DEV] ReflectionClass::newInstanceWithoutConstructor()

2011-08-25 Thread Gustavo Lopes
On Thu, 25 Aug 2011 13:41:27 +0100, Sebastian Bergmann sebast...@php.net  
wrote:



On 08/25/2011 01:46 PM, Gustavo Lopes wrote:

What about userland classes that extend internal classes?


  Good point. How would I implement such a check?



You could fetch the parent and do the same check, and so on. I think you  
might be able to just check whether ce.create_object is not NULL, because  
if the internal class doesn't replace create_object, there's no chance of  
that class of crashes occurring; plus, they're propagated to the  
subclasses.



--
Gustavo Lopes

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



Re: [PHP-DEV] ReflectionClass::newInstanceWithoutConstructor()

2011-08-25 Thread Sebastian Bergmann

On 08/25/2011 02:54 PM, Gustavo Lopes wrote:

You could fetch the parent and do the same check, and so on. I think you
might be able to just check whether ce.create_object is not NULL, because
if the internal class doesn't replace create_object, there's no chance of
that class of crashes occurring; plus, they're propagated to the subclasses.


 I updated the patch accordingly. Thanks!

--
Sebastian BergmannCo-Founder and Principal Consultant
http://sebastian-bergmann.de/   http://thePHP.cc/

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



Re: [PHP-DEV] PHP 5.3.8 Released!

2011-08-25 Thread Matthew Weier O'Phinney
On 2011-08-25, a...@akbkhome.com a...@akbkhome.com wrote:
 I'm not sure it's possible to get agreement on if this is a bug or
 not, you might see a bug, I just see this as a pointless change for
 consistency that pretty much nobody will ever need or use.

Please don't generalize based on your own opinions and use cases. I am a
long time PEAR user (and contributor), and I actually agree with the
change. 

The reporter of the issue that started this all is a colleague of mine,
Ralph Schindler, and we discussed it in June along with David Zuilke,
who had run into similar issues we had (as well as discussed it with
others in other projects). It's not an isolated request; there are many
who find the current behavior of is_a() (pre-5.3.7) incoherent for
modern PHP usage.

Basically, in our case, we were building a DI container.  To keep the DI
container light-weight, you create definitions that utilize string class
names. In order to determine what injections need to be made, you need
to introspect the class a little -- and this is where is_a() vs
is_subclass_of() vs instanceof comes into play. The latter two _require_
an object instance -- which we may not yet be ready to provide (we may
be trying to determine what to inject into the constructor). is_a() does
_not_ require an object instance...  but prior to 5.3.7 was unable to
test against inherited behavior. As such, the only fallback is the much
more expensive Reflection API.

Having is_a() work properly with string class names and checking the
inheritance hierarchy is a huge improvement, keeps it semantically
consistent with the rest of the language, and provides capabilities
is_subclass_of() cannot (as it cannot check against strings).

 I think I'll leave it as
 a) no bug was ever reported on the previous behaviour.

False -- others in this thread have pointed it out, and I alluded to the
report Ralph issued earlier.

 b) intended design of is_subclass_of  was originally to return false 
 on non-object - andrei (1999)
 http://svn.php.net/viewvc/php/php-src/trunk/Zend/zend_builtin_functions.c?r1=17245r2=17272
  
http://svn.php.net/viewvc/php/php-src/trunk/Zend/zend_builtin_functions.c?r1=17245r2=17272

 c) is_a() was introduced by sebastian (2002) and kept this intended 
 behaviour
 http://svn.php.net/viewvc/php/php-src/trunk/Zend/zend_builtin_functions.c?r1=67102r2=69234
  
http://svn.php.net/viewvc/php/php-src/trunk/Zend/zend_builtin_functions.c?r1=67102r2=69234

 d) when andrey (2004) proposed the change to accepts strings on  
 is_subclass_of, he deliberately maintained the existing behaviour for 
 is_a()
 http://svn.php.net/viewvc/php/php-src/trunk/Zend/zend_builtin_functions.c?r1=170604r2=171349
  
http://svn.php.net/viewvc/php/php-src/trunk/Zend/zend_builtin_functions.c?r1=170604r2=171349

 e) is_a() has a valid use case , and is currently reasonably commonly used.

 d) the new behaviour is an uncommon use case, and can be done very 
 easily in other ways.


 BTW. we could really do with a searchable archive of php.dev + 
 internals... - It's pretty difficult to find out if this was ever 
 discussed before..

 Regards
 Alan




 On Thursday, August 25, 2011 09:10 AM, Stas Malyshev wrote:
 Hi!

 On 8/24/11 4:38 PM, Alan Knowles wrote:
 Some real history for the young ones ;)

 I wonder who you are meaning... :)

 So the previous behavior was very likely the 'designed' behavior. Not an
 accidental side effect, or bug.

 Bugs can be very well intentional, but if they use the language wrong 
 way they are bugs.

 It's use case is reasonably common when doing tests on mixed returns
 (method returns PEAR:error, object or normal value.)

 That's when you use instanceof.

 So we had a situation where a reasonable number of people (eg. anyone
 who had used PEAR), had seen and expected the previous behavior.

 Seeing wrong code somewhere doesn't mean it's not wrong. There's a 
 reason we have the manual.

 Please do not fix something that is not broken, and breaks real working
 code, just for the hell of it, even in 5.4.

 is_a() was broken - it was returning different results from 
 essentially the same function is_subclass_of() for no reason at all 
 (no, somebody writing buggy code in PEAR using undocumented parameter 
 types is not a reason). The reason why we kept is_a() and not killed 
 it in favor of instanceof was to have it work with string arguments, 
 since instanceof does not. Thus, string arguments should be handled 
 properly. I can see how it can be argued that 5.3 is mature enough so 
 such changes shouldn't be there, however correct in theory. For 5.4, I 
 see no base for argument here.



-- 
Matthew Weier O'Phinney
Project Lead| matt...@zend.com
Zend Framework  | http://framework.zend.com/
PGP key: http://framework.zend.com/zf-matthew-pgp-key.asc

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



Re: [PHP-DEV] ReflectionClass::newInstanceWithoutConstructor()

2011-08-25 Thread Benjamin Eberlei
Thanks for working on this Sebastian, its really appreciated! +1 from me!

On Thu, Aug 25, 2011 at 3:27 PM, Sebastian Bergmann sebast...@php.netwrote:

 On 08/25/2011 02:54 PM, Gustavo Lopes wrote:

 You could fetch the parent and do the same check, and so on. I think you
 might be able to just check whether ce.create_object is not NULL, because
 if the internal class doesn't replace create_object, there's no chance of
 that class of crashes occurring; plus, they're propagated to the
 subclasses.


  I updated the patch accordingly. Thanks!


 --
 Sebastian BergmannCo-Founder and Principal Consultant
 http://sebastian-bergmann.de/   http://thePHP.cc/

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




Re: [PHP-DEV] ReflectionClass::newInstanceWithoutConstructor()

2011-08-25 Thread guilhermebla...@gmail.com
Sebastian,

This is a hidden  gem for us! =D
Thanks a lot for putting your effort into this.

Cheers,

On Thu, Aug 25, 2011 at 11:03 AM, Benjamin Eberlei kont...@beberlei.de wrote:
 Thanks for working on this Sebastian, its really appreciated! +1 from me!

 On Thu, Aug 25, 2011 at 3:27 PM, Sebastian Bergmann sebast...@php.netwrote:

 On 08/25/2011 02:54 PM, Gustavo Lopes wrote:

 You could fetch the parent and do the same check, and so on. I think you
 might be able to just check whether ce.create_object is not NULL, because
 if the internal class doesn't replace create_object, there's no chance of
 that class of crashes occurring; plus, they're propagated to the
 subclasses.


  I updated the patch accordingly. Thanks!


 --
 Sebastian Bergmann                    Co-Founder and Principal Consultant
 http://sebastian-bergmann.de/                           http://thePHP.cc/

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






-- 
Guilherme Blanco
Mobile: +55 (11) 8118-4422
MSN: guilhermebla...@hotmail.com
São Paulo - SP/Brazil

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



Re: [PHP-DEV] [VOTE] Choosing a distributed version control system for PHP

2011-08-25 Thread Philip Olson

I'm not familiar enough with Mercurial to properly vote, but am 
guessing we'll move to Git. Git is popular because Github is 
popular, and Github is popular because it's awesome.

But I think we should skip git.php.net and mirrors/bridges, and 
simply move to Github. And this means people who maintain Git for a 
living would maintain it, while we can focus on developing PHP.

Regards,
Philip



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



Re: [PHP-DEV] ReflectionClass::newInstanceWithoutConstructor()

2011-08-25 Thread Patrick ALLAERT
2011/8/25 Gustavo Lopes glo...@nebm.ist.utl.pt:
 You could fetch the parent and do the same check, and so on.

Checking only the topmost should be enough if traversing the whole
inheritance could be avoided.

 I think you
 might be able to just check whether ce.create_object is not NULL, because if
 the internal class doesn't replace create_object, there's no chance of that
 class of crashes occurring; plus, they're propagated to the subclasses.


 --
 Gustavo Lopes

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

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



Re: [PHP-DEV] ReflectionClass::newInstanceWithoutConstructor()

2011-08-25 Thread Patrick ALLAERT
2011/8/25 Patrick ALLAERT patrickalla...@php.net:
 2011/8/25 Gustavo Lopes glo...@nebm.ist.utl.pt:
 You could fetch the parent and do the same check, and so on.

 Checking only the topmost should be enough if traversing the whole
 inheritance could be avoided.

Well, of course I highly second the opinion that not making
distinction and fixing possible bugs in internal classes is a much
better approach.

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



Re: [PHP-DEV] [VOTE] Choosing a distributed version control system for PHP

2011-08-25 Thread Kalle Sommer Nielsen
2011/8/24 David Soria Parra d...@php.net:
 Hi Internals,,

 after 3 weeks of discussion, I think we are ready to start voting on
 the DVCS RFC.  If you think something is missing or should be explained
 in more detail, let me know.

I won't transfer the discussion over here but; I don't want to move to
a new system we we did it just a few years ago, as Rasmus said long
before we moved was that we want to find a solid system that could
hold out just as long as the old setup. I don't have a problem by
using SVN, nor merge as we have been good at keeping files in sync so
its easy to merge patches, much easier than the old unicode-trunk.

That being said; I agree with Stas that having a vote is not a good
way to actually make a choice here, but it gives a hint of those that
voted, as I'm sure that there are many more actively working on the
project like PEAR. PECL and Doc guys thats not gonna vote because they
don't follow Internals.

But -1 from me.


-- 
regards,

Kalle Sommer Nielsen
ka...@php.net

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



Re: [PHP-DEV] [VOTE] Choosing a distributed version control system for PHP

2011-08-25 Thread Ilia Alshanetsky
If we do decide to make a VCS change the vote should be fairly one
sided for option of choice as this has a fairly broad impact on our
development process.

On Wed, Aug 24, 2011 at 5:03 PM, David Soria Parra d...@php.net wrote:
 Hi Internals,,

 after 3 weeks of discussion, I think we are ready to start voting on
 the DVCS RFC.  If you think something is missing or should be explained
 in more detail, let me know.

 Votes can be found here:

    https://wiki.php.net/rfc/dvcs/vote

 The RFC can be found here:

    https://wiki.php.net/rfc/dvcs

 Voting will be opened for 2 weeks and end on Sept. 7 at 12 pm.

 - David

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



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



Re: [PHP-DEV] Failing Autotests / Bugs

2011-08-25 Thread marius adrian popa
On Tue, Aug 23, 2011 at 10:26 PM, marius adrian popa map...@gmail.com wrote:
 On Tue, Aug 23, 2011 at 9:51 PM, Rasmus Lerdorf ras...@lerdorf.com wrote:
 On 08/23/2011 09:45 AM, Daniel Convissor wrote:
 Hi:

 On Sun, Aug 21, 2011 at 03:08:09PM +0200, Reindl Harald wrote:
 FAIL DateTime::diff() days -- spring type2 type2 
 [ext/date/tests/DateTime_days-spring-type2-
 These tests have been fixed.  Thanks for bringing this to my attention.

 Thanks Dan.

 Could we all bookmark

 http://gcov.php.net/viewer.php?version=PHP_5_4func=tests
 I will bookmark and check firebird_pdo related bugs


gcov seems to be down at the moment

http://gcov.php.net/viewer.php?version=PHP_5_4func=tests

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



[PHP-DEV] transversing associative arrays from C

2011-08-25 Thread Aaron Gray

Hi,

I am working on a C extension module for PHP and am wondering about an API 
issue.


I can see how to add to an associative array :-

   zval *aa;
   MAKE_STD_ZVAL(aa);
   array_init(aa);

   add_assoc_string(aa, test, test value, 1);

but how do I transverse an associative array of values in a for loop simular 
to using foreach in PHP ?


Hope this is not too OT for this list, but I could not find a better place 
to ask the question.


I have looked through the API SVN sources and this seems like a possible 
blind spot.


Many thanks in advance,

Aaron


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



[PHP-DEV] transversing associative arrays from C

2011-08-25 Thread Aaron Gray

Hi,

I am working on a C extension module for PHP and am wondering about an API
issue.

I can see how to add to an associative array :-

zval *aa;
MAKE_STD_ZVAL(aa);
array_init(aa);

Hi,

I am working on a C extension module for PHP and am wondering about an API
issue.

I can see how to add to an associative array :-

zval *aa;
MAKE_STD_ZVAL(aa);
array_init(aa);

add_assoc_string(aa, test, test value, 1);
add_assoc_string(aa, test2, test value2, 1);

but how do I transverse an associative array of values in a for loop simular
to using foreach in PHP ?

Hope this is not too OT for this list, but I could not find a better place
to ask the question.

I have looked through the API SVN sources and this seems like a possible
blind spot.

Many thanks in advance,

Aaron

but how do I transverse an associative array of values in a for loop simular
to using foreach in PHP ?

Hope this is not too OT for this list, but I could not find a better place
to ask the question.

I have looked through the API SVN sources and this seems like a possible
blind spot.

Many thanks in advance,

Aaron


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



Re: [PHP-DEV] [VOTE] Choosing a distributed version control system for PHP

2011-08-25 Thread David Muir
On 08/26/2011 04:12 AM, Kalle Sommer Nielsen wrote:
 2011/8/24 David Soria Parra d...@php.net:
 Hi Internals,,

 after 3 weeks of discussion, I think we are ready to start voting on
 the DVCS RFC.  If you think something is missing or should be explained
 in more detail, let me know.
 I won't transfer the discussion over here but; I don't want to move to
 a new system we we did it just a few years ago, as Rasmus said long
 before we moved was that we want to find a solid system that could
 hold out just as long as the old setup. I don't have a problem by
 using SVN, nor merge as we have been good at keeping files in sync so
 its easy to merge patches, much easier than the old unicode-trunk.

 That being said; I agree with Stas that having a vote is not a good
 way to actually make a choice here, but it gives a hint of those that
 voted, as I'm sure that there are many more actively working on the
 project like PEAR. PECL and Doc guys thats not gonna vote because they
 don't follow Internals.

 But -1 from me.



FWIW, PEAR is already moving to GitHub.

David



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



Re: [PHP-DEV] transversing associative arrays from C

2011-08-25 Thread Chris Stockton
Hello,

On Thu, Aug 25, 2011 at 2:57 PM, Aaron Gray ang.use...@gmail.com wrote:
 Hi,

 I am working on a C extension module for PHP and am wondering about an API
 issue.

 I can see how to add to an associative array :-


Most everything you need to know about manipulating arrays can be
found in ext/standard/array.c

-Chris

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



Re: [PHP-DEV] transversing associative arrays from C

2011-08-25 Thread Aaron Gray
Chris Stockton chrisstockto...@gmail.com wrote in message 
news:calkfbxvsuq-zqyytdxi3a9tccieh6xzz9y-kbyqva8kpc4-...@mail.gmail.com...

Hello,

On Thu, Aug 25, 2011 at 2:57 PM, Aaron Gray ang.use...@gmail.com wrote:

Hi,

I am working on a C extension module for PHP and am wondering about an 
API

issue.

I can see how to add to an associative array :-



Most everything you need to know about manipulating arrays can be
found in ext/standard/array.c


Where's that in the SVN source tree ?

Aaron



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



Re: [PHP-DEV] transversing associative arrays from C

2011-08-25 Thread Christopher Jones



On 08/25/2011 05:16 PM, Aaron Gray wrote:

Chris Stockton chrisstockto...@gmail.com wrote in message 
news:calkfbxvsuq-zqyytdxi3a9tccieh6xzz9y-kbyqva8kpc4-...@mail.gmail.com...

Hello,

On Thu, Aug 25, 2011 at 2:57 PM, Aaron Gray ang.use...@gmail.com wrote:

Hi,

I am working on a C extension module for PHP and am wondering about an API
issue.

I can see how to add to an associative array :-



Most everything you need to know about manipulating arrays can be
found in ext/standard/array.c


Where's that in the SVN source tree ?

Aaron


http://svn.php.net/viewvc/php/php-src/branches/PHP_5_4/ext/standard/

Chris

--
Email: christopher.jo...@oracle.com
Tel:  +1 650 506 8630
Blog:  http://blogs.oracle.com/opal/

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



Re: [PHP-DEV] transversing associative arrays from C

2011-08-25 Thread Aaron Gray
Aaron Gray ang.use...@gmail.com wrote in message 
news:a1.a0.22704.0d5e6...@pb1.pair.com...
Chris Stockton chrisstockto...@gmail.com wrote in message 
news:calkfbxvsuq-zqyytdxi3a9tccieh6xzz9y-kbyqva8kpc4-...@mail.gmail.com...

Hello,

On Thu, Aug 25, 2011 at 2:57 PM, Aaron Gray ang.use...@gmail.com wrote:

Hi,

I am working on a C extension module for PHP and am wondering about an 
API

issue.

I can see how to add to an associative array :-



Most everything you need to know about manipulating arrays can be
found in ext/standard/array.c


Where's that in the SVN source tree ?


Ah, got it many thanks,

Aaron


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



Re: [PHP-DEV] transversing associative arrays from C

2011-08-25 Thread Aaron Gray
Christopher Jones christopher.jo...@oracle.com wrote in message 
news:4e56e662.90...@oracle.com...



On 08/25/2011 05:16 PM, Aaron Gray wrote:
Chris Stockton chrisstockto...@gmail.com wrote in message 
news:calkfbxvsuq-zqyytdxi3a9tccieh6xzz9y-kbyqva8kpc4-...@mail.gmail.com...

Hello,

On Thu, Aug 25, 2011 at 2:57 PM, Aaron Gray ang.use...@gmail.com 
wrote:

Hi,

I am working on a C extension module for PHP and am wondering about an 
API

issue.

I can see how to add to an associative array :-



Most everything you need to know about manipulating arrays can be
found in ext/standard/array.c


Where's that in the SVN source tree ?

Aaron


http://svn.php.net/viewvc/php/php-src/branches/PHP_5_4/ext/standard/


Chris,

How much can I access as a PHP plugin dll or shared object ?

Thinking about it what I really want to do is see if a key exists in an 
array and get its type to see if it is BOOL and that it is TRUE.


Many thanks,

Aaron


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



Re: [PHP-DEV] transversing associative arrays from C

2011-08-25 Thread Stas Malyshev

Hi!

On 8/25/11 5:52 PM, Aaron Gray wrote:

Thinking about it what I really want to do is see if a key exists in an
array and get its type to see if it is BOOL and that it is TRUE.


For this, you will need to call zend_hash_find (or zend_symtable_find if 
there's a possibility of keys like 0 that have to be treated as 0). If 
you get SUCCESS, the key exists and you'll be getting zval **, then 
either check it's type and value with Z_TYPE_PP and Z_LVAL_PP or call 
zend_is_true(*val) to get generic truth value (like if(), etc. do).

--
Stanislav Malyshev, Software Architect
SugarCRM: http://www.sugarcrm.com/
(408)454-6900 ext. 227

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



[PHP-DEV] is_a() consequences.....

2011-08-25 Thread Alan Knowles

I've committed the fixes for my two of my packages to support this change..

Who ever thinks this is such a great idea, could you kindly file bugs 
against all the packages below to request they fix their 'bugs' or 
verify the input


http://pear.php.net/bugs/

Since the behaviour of is_a() is now is_a(mixed, string), if any of the 
first arguments is a string that matches the class name, or it's parent 
or causes the autoloader to load a class such a class it will produce 
unpredicatable results now.


This is not a full list, as I only have a partial copy of all pear packages.

Date/Span.php:182:if (is_a($time, 'date_span')) {
Date/Span.php:184:} elseif (is_a($time, 'date') and 
is_a($format, 'date')) {
Date/Span.php:536:if (!is_a($date1, 'date') or !is_a($date2, 
'date')) {

Date/Span.php:571:if (is_a($time, 'date_span')) {
Date.php:204:} elseif (is_a($date, 'Date')) {
Date.php:552:if(is_a($tz, 'Date_Timezone')) {
Date.php:746:if (!is_a($span, 'Date_Span')) {
Date.php:821:if (!is_a($span, 'Date_Span')) {
DB/common.php:1252:if (is_a($result, 'DB_result')) {
DB/mysqli.php:996:if (!is_a($id, 'mysqli_result')) {
DB.php:594:return is_a($value, 'DB_Error');
HTTP/Request.php:692:if (!is_a($this-_url, 'Net_URL')) {
HTTP/Request.php:1078:if (!is_a($listener, 
'HTTP_Request_Listener')) {
HTTP/Request.php:1095:if (!is_a($listener, 
'HTTP_Request_Listener') ||

I18Nv2/DecoratedList.php:51:if (is_a($list, 'I18Nv2_CommonList') ||
I18Nv2/DecoratedList.php:52:is_a($list, 
'I18Nv2_DecoratedList')) {

Image/Graph.php:161:} elseif (is_a($params, 'Image_Canvas')) {
Image/Graph.php:211:if (!is_a($this-_canvas, 'Image_Canvas')) {
Image/Graph.php:595:if (!(is_a($part1, 'Image_Graph_Element'))) {
Image/Graph.php:599:if (!(is_a($part2, 'Image_Graph_Element'))) {
Image/Graph/Title.php:154:if (is_a($this-_parent, 
'Image_Graph_Plotarea')) {
Image/Graph/Title.php:161:} elseif (!is_a($this-_parent, 
'Image_Graph_Layout')) {
Image/Graph/Plot.php:119:if (!is_a($dataset, 
'Image_Graph_Dataset')) {
Image/Graph/Plot.php:123:if (!is_a($dataset[$key], 
'Image_Graph_Dataset')) {
Image/Graph/Plot.php:756:if (is_a($this-_fillStyle, 
'Image_Graph_Fill')) {
Image/Graph/Common.php:49:return is_a(get_parent_class($object), 
$class_name);
Image/Graph/Common.php:180:} elseif (is_a($this-_parent, 
'Image_Graph_Common')) {
Image/Graph/Common.php:200:if (!is_a($element, 
'Image_Graph_Font')) {
Image/Graph/Common.php:295:if (($this-_canvas == null) || 
(!is_a($this-_canvas, 'Image_Canvas'))) {
Image/Graph/Marker/Average.php:65:(is_a($this-_parent, 
'Image_Graph_Plot')))
Image/Graph/Marker/Array.php:71:if (is_a($marker, 
'Image_Graph_Element')) {
Image/Graph/Marker.php:105:if (is_a($this-_secondaryMarker, 
'Image_Graph_Marker')) {
Image/Graph/Legend.php:99:if (is_a($plotarea, 
'Image_Graph_Plotarea')) {
Image/Graph/Legend.php:103:if (is_a($element, 
'Image_Graph_Plot')) {
Image/Graph/Legend.php:162:if (is_a($element, 
'Image_Graph_Plot')) {
Image/Graph/Legend.php:194:if (is_a($element, 
'Image_Graph_Plot')) {
Image/Graph/Legend.php:259:if (is_a($plotarea, 
'Image_Graph_Plotarea')) {
Image/Graph/Legend.php:332:if (is_a($element, 
'Image_Graph_Plot')) {
Image/Graph/Legend.php:348:if (is_a($element, 
'Image_Graph_Plot')) {
Image/Graph/Legend.php:371:if (is_a($element, 
'Image_Graph_Plot')) {
Image/Graph/Line/Array.php:74:if (is_a($style, 
'Image_Graph_Element')) {
Image/Graph/Plotarea.php:221:if (is_a($element, 
'Image_Graph_Plot')) {
Image/Graph/Plotarea.php:225:} elseif (is_a($element, 
'Image_Graph_Grid')) {
Image/Graph/Plotarea.php:252:} elseif (is_a($element, 
'Image_Graph_Axis')) {
Image/Graph/Plotarea.php:334:if (is_a($dataset, 
'Image_Graph_Dataset')) {
Image/Graph/Plotarea.php:624:if (is_a($element, 
'Image_Graph_Plot')) {
Image/Graph/Plotarea.php:625:if (((is_a($element, 
'Image_Graph_Plot_Bar')) ||
Image/Graph/Plotarea.php:626:(is_a($element, 
'Image_Graph_Plot_Step')) ||
Image/Graph/Plotarea.php:627:(is_a($element, 
'Image_Graph_Plot_Dot')) ||
Image/Graph/Plotarea.php:628:(is_a($element, 
'Image_Graph_Plot_CandleStick')) ||
Image/Graph/Plotarea.php:629:(is_a($element, 
'Image_Graph_Plot_BoxWhisker')) ||
Image/Graph/Plotarea.php:630:(is_a($element, 
'Image_Graph_Plot_Impulse'))) 
Image/Graph/Layout/Horizontal.php:94:if (!is_a($part1, 
'Image_Graph_Layout')) {
Image/Graph/Layout/Horizontal.php:99:} elseif 

Re: [PHP-DEV] transversing associative arrays from C

2011-08-25 Thread Aaron Gray

Hi Stas,

Stas Malyshev smalys...@sugarcrm.com wrote in message 
news:4e56f0d6.20...@sugarcrm.com...

Hi!

On 8/25/11 5:52 PM, Aaron Gray wrote:

Thinking about it what I really want to do is see if a key exists in an
array and get its type to see if it is BOOL and that it is TRUE.


For this, you will need to call zend_hash_find (or zend_symtable_find if 
there's a possibility of keys like 0 that have to be treated as 0).


Okay, found it, zend_hash.h, so that should be accessable to my module :)

If you get SUCCESS, the key exists and you'll be getting zval **, then 
either check it's type and value with Z_TYPE_PP and Z_LVAL_PP or call 
zend_is_true(*val) to get generic truth value (like if(), etc. do).


Great.

That seems alot simpler.

Many thanks,

Aaron


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



Re: [PHP-DEV] transversing associative arrays from C

2011-08-25 Thread Xinchen Hui
hi
  every api has lots of 'samples' ,that are the standard extensions in src/ext/*

   :)

Thanks
Sent from my iPhone

在 2011-8-26,11:20,Aaron Gray ang.use...@gmail.com 写道:

 Hi Stas,

 Stas Malyshev smalys...@sugarcrm.com wrote in message 
 news:4e56f0d6.20...@sugarcrm.com...
 Hi!

 On 8/25/11 5:52 PM, Aaron Gray wrote:
 Thinking about it what I really want to do is see if a key exists in an
 array and get its type to see if it is BOOL and that it is TRUE.

 For this, you will need to call zend_hash_find (or zend_symtable_find if 
 there's a possibility of keys like 0 that have to be treated as 0).

 Okay, found it, zend_hash.h, so that should be accessable to my module :)

 If you get SUCCESS, the key exists and you'll be getting zval **, then 
 either check it's type and value with Z_TYPE_PP and Z_LVAL_PP or call 
 zend_is_true(*val) to get generic truth value (like if(), etc. do).

 Great.

 That seems alot simpler.

 Many thanks,

 Aaron


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


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



Re: [PHP-DEV] transversing associative arrays from C

2011-08-25 Thread Aaron Gray

Thanks !

Xinchen Hui larue...@gmail.com wrote in message 
news:7256329410255948429@unknownmsgid...

hi
 every api has lots of 'samples' ,that are the standard extensions in 
src/ext/*


  :)

Thanks
Sent from my iPhone

在 2011-8-26,11:20,Aaron Gray ang.use...@gmail.com 写道:


Hi Stas,

Stas Malyshev smalys...@sugarcrm.com wrote in message 
news:4e56f0d6.20...@sugarcrm.com...

Hi!

On 8/25/11 5:52 PM, Aaron Gray wrote:

Thinking about it what I really want to do is see if a key exists in an
array and get its type to see if it is BOOL and that it is TRUE.


For this, you will need to call zend_hash_find (or zend_symtable_find if 
there's a possibility of keys like 0 that have to be treated as 0).


Okay, found it, zend_hash.h, so that should be accessable to my module 
:)


If you get SUCCESS, the key exists and you'll be getting zval **, then 
either check it's type and value with Z_TYPE_PP and Z_LVAL_PP or call 
zend_is_true(*val) to get generic truth value (like if(), etc. do).


Great.

That seems alot simpler.

Many thanks,

Aaron


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




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