Re: [PHP-DEV] Accept null type hint in C

2005-10-27 Thread Marcus Boerger
Hello Bob, Thursday, October 27, 2005, 8:51:18 AM, you wrote: > Hi, > Since NULL typehints are allowed in userland, how would I go about it in C? > I have ZEND_ARG_OBJ_INFO(0, obj, ZObject, 1) which has allow null set on. > Then in the method: > if (zend_parse_parameters(ZEND_NUM_ARGS() TSRML

Re: [PHP-DEV] foreach with null

2005-10-27 Thread Derick Rethans
On Wed, 26 Oct 2005, Ilia Alshanetsky wrote: > IMHO this is a bad idea, if you really wanted to support NULL in a > particular case you, as a developer could do: > php -r '$n=NULL; foreach((array)$n as $v);' > > Making NULL usage transparent where array is expects will lead to > difficult to debu

Re: [PHP-DEV] foreach with null

2005-10-27 Thread Hannes Magnusson
On 10/27/05, Derick Rethans <[EMAIL PROTECTED]> wrote: > > On Wed, 26 Oct 2005, Ilia Alshanetsky wrote: > > > IMHO this is a bad idea, if you really wanted to support NULL in a > > particular case you, as a developer could do: > > php -r '$n=NULL; foreach((array)$n as $v);' > > > > Making NULL usag

Re: [PHP-DEV] Re: foreach with null

2005-10-27 Thread Jani Taskinen
On Wed, 26 Oct 2005, Ilia Alshanetsky wrote: Greg Beaver wrote: amen, this behavior makes no sense even though sizeof() is an alias to count(). sizeof('this') and sizeof('this long thing') are both 1, which makes no sense. I would go so far as to say a E_NOTICE is more appropriate than E_STR

Re: [PHP-DEV] foreach with null

2005-10-27 Thread Jani Taskinen
On Thu, 27 Oct 2005, Jochem Maas wrote: advanced code should be checking vars properly before using them and, well, for any given foreach loop there is often enough an 'if (!count($array))'-like statement to take care of the 'empty' case. and in cases when speed is very important ..and wh

Re: [PHP-DEV] foreach with null

2005-10-27 Thread Derick Rethans
On Thu, 27 Oct 2005, Hannes Magnusson wrote: > On 10/27/05, Derick Rethans <[EMAIL PROTECTED]> wrote: > > > > On Wed, 26 Oct 2005, Ilia Alshanetsky wrote: > > > > > IMHO this is a bad idea, if you really wanted to support NULL in a > > > particular case you, as a developer could do: > > > php -r '

Re: [PHP-DEV] foreach with null

2005-10-27 Thread Jochem Maas
Jani Taskinen wrote: On Thu, 27 Oct 2005, Jochem Maas wrote: advanced code should be checking vars properly before using them and, well, for any given foreach loop there is often enough an 'if (!count($array))'-like statement to take care of the 'empty' case. and in cases when speed is very i

RE: [PHP-DEV] Accept null type hint in C

2005-10-27 Thread Bob Silva
I tried the "|!O" and that really hoses things. The | gets processed in zend_parse_va_args and removed (spec is incremented), so that "!O" get sent to zend_parse_arg_impl. Inside of zend_parse_arg_impl, the ! gets set to char c and spec_walk gets incremented which makes the check for the null oper

[PHP-DEV] Runtime check...

2005-10-27 Thread Marco Bambini
I have developed a php extension that requires zlib in order to works fine. The problem is that if someone have compiled php without zlib support my extension just crashed when it tries to use some zlib routines. I wonder if there is a way to check at runtime (or better at startup in the PH

[PHP-DEV] Re: Runtime check...

2005-10-27 Thread Sara Golemon
> I have developed a php extension that requires zlib in order to works > fine. > The problem is that if someone have compiled php without zlib support > my extension just crashed when it tries to use some zlib routines. > > I wonder if there is a way to check at runtime (or better at startup > in

Re: [PHP-DEV] Accept null type hint in C

2005-10-27 Thread Marcus Boerger
Hello Bob, that's definitively wrong, actually there must be something wrong with your code. The '|' is to ensure that the parameter is optional. Thus if you moit the param it's return value is untouched which means you have to initaialize the returned zval * to null before passing its address t

Re: [PHP-DEV] foreach with null

2005-10-27 Thread Marcus Boerger
Hello Jochem, Thursday, October 27, 2005, 12:49:57 PM, you wrote: > Jani Taskinen wrote: >> On Thu, 27 Oct 2005, Jochem Maas wrote: >> >>> advanced code should be checking vars properly before using them and, >>> well, >>> for any given foreach loop there is often enough an 'if >>> (!count($ar

Re: [PHP-DEV] Accept null type hint in C

2005-10-27 Thread Rob Richards
Marcus Boerger wrote: Hello Bob, that's definitively wrong, actually there must be something wrong with your code. The '|' is to ensure that the parameter is optional. Thus if you moit the param it's return value is untouched which means you have to initaialize the returned zval * to null befo

Re: [PHP-DEV] Accept null type hint in C

2005-10-27 Thread Marcus Boerger
Hello Rob, args, shit you're right! marcus Thursday, October 27, 2005, 8:35:12 PM, you wrote: > Marcus Boerger wrote: >>Hello Bob, >> >> that's definitively wrong, actually there must be something wrong with >>your code. The '|' is to ensure that the parameter is optional. Thus if you >>moi

RE: [PHP-DEV] Accept null type hint in C

2005-10-27 Thread Bob Silva
Thanks guys, the O! works as expected. It didn't need the | since I actually want to force a parameter to be sent even if it is null. I did think it was weird that the parse_parameter functions set the zval* passed in to NULL instead of setting the value/type of the zval to IS_NULL. This took a bi

Re: [PHP-DEV] Re: Namespace methods

2005-10-27 Thread Kevin Newman
Thank you for the info. I have some questions/suggestions (they may be silly - please feel welcome to tell me so, if they are): You have solved the problem (grievance number 5) of file based scoping, by introducing a function that can only be used within __autoload (the autoload_import_class

[PHP-DEV] Re: Are there plans to support Mysql 5 soon?

2005-10-27 Thread Holografix
Hi I'm having this problems with php 5.1 latest snapshot and mysql 5.0.15 only on linux FC4. On windows works fine. This code: $pdo = new PDO('mysql:host=localhost;dbname=dbtest', 'user', 'pass'); $pdo->setAttribute( PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION ); $stmt = $pdo->prepare('select *

Re: [PHP-DEV] Re: Namespace methods

2005-10-27 Thread Jessie Hernandez
Hi Kevin, Kevin Newman wrote: > Thank you for the info. > > I have some questions/suggestions (they may be silly - please feel > welcome to tell me so, if they are): > > You have solved the problem (grievance number 5) of file based scoping, > by introducing a function that can only be used wit

[PHP-DEV] Re: Are there plans to support Mysql 5 soon?

2005-10-27 Thread Holografix
Sorry There are only problems with pdo mysqli problems were due to zend.ze1_compatibility_mode = On. Now it's off and no mysqli errors. best regards ""Holografix"" <[EMAIL PROTECTED]> escreveu na mensagem news:[EMAIL PROTECTED] > Hi > > With PHP 5.1 knocking at the door, I guess many people w

Re: [PHP-DEV] Re: Are there plans to support Mysql 5 soon?

2005-10-27 Thread Wez Furlong
A backtrace would help a lot On 10/27/05, Holografix <[EMAIL PROTECTED]> wrote: > Sorry > There are only problems with pdo > > mysqli problems were due to zend.ze1_compatibility_mode = On. Now it's off > and no mysqli errors. > > best regards > > > ""Holografix"" <[EMAIL PROTECTED]> escreveu na me

Re: [PHP-DEV] foreach with null

2005-10-27 Thread Andi Gutmans
I think we should be keeping the warning (i.e. -1 for the change). I don't see a reason why overloaded objects can't expose an API of an empty array() instead of changing this behavior to fit the implementation. But even if it weren't so, there has to be a good reason to change the general case

[PHP-DEV] Question on arrays as properties

2005-10-27 Thread Bob Silva
Hi, Am I correct in saying that a class property cannot be initialized to an array? Looking at zend_declare_property it clearly states that Internal zvals cant be arrays. So how would I go about creating the following inherited property in all my subclasses if my core class has this proper

[PHP-DEV] Re: Question on arrays as properties

2005-10-27 Thread Michael Wallner
Hi Bob Silva, you wrote: > Hi, In other words, how would I create a property that is an array > (in C) where that property is available to all my subclasses WITHOUT > initializing it manually in the __construct, which would force each > subclass constructor to call its parent (while good design,