Re: [PHP-DEV] Construct Request

2004-04-16 Thread Sascha Schumann
On Fri, 16 Apr 2004, Andi Gutmans wrote: At 02:21 PM 4/15/2004 -0400, Sean Coates wrote: Andi Gutmans wrote: It could be implemented but I don't see the big advantage over $bar ? 0 : $base It's one character... oes to GCC and its C extension). $bar ? : $baz; If $bar evaluates to

Re: [PHP-DEV] Feature proposal : php.ini option to disable access control and interfaces

2004-04-16 Thread Andi Gutmans
Hi Eric, I don't see very much value in such an option and I doubt it would help run-tme very much. In any case, the access control is very much part of the infrastructure and it can't just be skipped very easily. Andi At 11:32 AM 4/16/2004 +0200, Eric Daspet wrote: Hi, Is it possible or

Re: [PHP-DEV] language integration: php vs. perl vs. java vs. python vs. c#

2004-04-16 Thread Derick Rethans
On Fri, 16 Apr 2004, Enrico Weigelt wrote: I'm currently thinking about ways to integrate several other languages beside php into the zend engine. For example perl and php seem to be quite similar. Some perl experts told me, there're some things in perl which php semantically does not

Re: [PHP-DEV] Exceptions and a real example: Tidy

2004-04-16 Thread Christian Schneider
John Coggeshall wrote: Exceptions from use. I'm not prepared to do that, a failure to open a file is an exception in OO-world and that's what should be there. No! OO and exceptions are two completely different things. One is about data encapsulation and one is about error handling. OO can

[PHP-DEV] Re: [PHP-CVS] cvs: php-src /ext/tidy tidy.c

2004-04-16 Thread Nuno Lopes
Hello John et all, Before giving my opinion about the exceptions and errors in tidy, there are two errors that need to be corrected first: *Win32 build is broken: tidy.c ..\php_build\include\libtidy\platform.h(473) : warning C4005: 'strcasecmp' : macro redefinition

Re: [PHP-DEV] Re: [PHP-CVS] cvs: php-src /ext/tidy tidy.c

2004-04-16 Thread Derick Rethans
On Fri, 16 Apr 2004, Nuno Lopes wrote: This simple code: ? new tidy(); ? echoes: // note these funny characters Warning: tidy::__construct(X): failed to open stream: No such file or directory in /home/Nuno/php5/sapi/cli/tidy.php on line 2 Should be fixed

Re: [PHP-DEV] Re: [PHP-CVS] cvs: php-src /ext/tidy tidy.c

2004-04-16 Thread Nuno Lopes
Should be fixed now. Derick It isn't fixed because tidy tries to open NULL :) Please apply my patch that (hoppefully) fixes the problem. (I've tested it!) Nuno Index: tidy.c === RCS file: /repository/php-src/ext/tidy/tidy.c,v

[PHP-DEV] [RFC] ifsetor operator

2004-04-16 Thread Marcus Boerger
: ifsetor ( variable [ , expression ] ) Semantic: - The value in question must be a variable. - The default value can be any expression. - The default value can be omitted in which case NULL will be used. http://marcus-boerger.de/php/ext/ze2/ze2-ifsetor-20040416-2.diff.txt best regards

[PHP-DEV] Re: [RFC] ifsetor operator

2004-04-16 Thread Christian Schneider
Marcus Boerger wrote: [RFC] ifsetor operator Synopsis: ifsetor ( value , default ) Returns the value if it exists or a given default value. Syntax: ifsetor ( variable [ , expression ] ) Semantic: - The value in question must be a variable. I'd prefer to not have this restriction, a return

Re: [PHP-DEV] [RFC] ifsetor operator

2004-04-16 Thread Derick Rethans
On Fri, 16 Apr 2004, Marcus Boerger wrote: [RFC] ifsetor operator Hello List, i also agrre that an internal function is much better. And here is it as such an internal function (that does not result in an expensive function call). Synopsis: ifsetor ( value , default ) snip I don't

Re: [PHP-DEV] Re: [RFC] ifsetor operator

2004-04-16 Thread Christian Schneider
Derick Rethans wrote: isset() works on a variable only too, so this behavior matches already existing behavior. Hmm... this brings up another idea: Extend isset to have this behaviour. Funnily enough when I was thinking about such a feature I wished I could call it isset. And now I realize that

Re: [PHP-DEV] Re: [RFC] ifsetor operator

2004-04-16 Thread Marcus Boerger
Hello Christian, Friday, April 16, 2004, 10:10:01 PM, you wrote: Derick Rethans wrote: isset() works on a variable only too, so this behavior matches already existing behavior. Hmm... this brings up another idea: Extend isset to have this behaviour. Funnily enough when I was thinking

Re: [PHP-DEV] [RFC] ifsetor operator

2004-04-16 Thread Wez Furlong
must be a variable. - The default value can be any expression. - The default value can be omitted in which case NULL will be used. http://marcus-boerger.de/php/ext/ze2/ze2-ifsetor-20040416-2.diff.txt best regards marcus Friday, April 16, 2004, 2:12:04 AM, you wrote: Hello Jason

Re: [PHP-DEV] [RFC] ifsetor operator

2004-04-16 Thread Wez Furlong
Derick wrote: I don't like this name though, the rest sounds ok. Me either, but can't think of anything better (well, ?: operator is good ;) Other possibilities: ifset default default is already used in switch --Wez. -- PHP Internals - PHP Runtime Development Mailing List To

Re: [PHP-DEV] [RFC] ifsetor operator

2004-04-16 Thread Wez Furlong
://marcus-boerger.de/php/ext/ze2/ze2-ifsetor-20040416-2.diff.txt best regards marcus Friday, April 16, 2004, 2:12:04 AM, you wrote: Hello Jason, here is your operator patch: http://marcus-boerger.de/php/ext/ze2/ze2-ifsetor-20040416.diff.txt currently it uses the following

Re: [PHP-DEV] Re: [RFC] ifsetor operator

2004-04-16 Thread Derick Rethans
On Fri, 16 Apr 2004, Rasmus Lerdorf wrote: This would lead to $a = isset($b, 'default'); I think this is the sanest suggestion yet. But it's already in use... (isset accepts multiple parameters and does an AND on those). Derick -- PHP Internals - PHP Runtime Development Mailing List To

Re: [PHP-DEV] Re: [RFC] ifsetor operator

2004-04-16 Thread Christian Schneider
Marcus Boerger wrote: You cannot do this because that syntax is already defined for PHP with another semantic. Ok, missed that one, I never used multiple arguments to isset ;-) Let's call it ifsetor, ifset or default then. But I still think allowing a list of expressions is a good idea because

[PHP-DEV] Problem reusing variables

2004-04-16 Thread Frank M. Kromann
Hello Everyone, I have a problem reusing variables. This does not work (second query does not return any data): $rs = fbsql_query(select * from tuser;, $con); ... $rs = fbsql_query(select * from tuser;, $con); These three combinations work fine (both queries return data): $rs =

Re: [PHP-DEV] Re: [RFC] ifsetor operator

2004-04-16 Thread Jason Garber
Chris - As Wez pointed out, this is almost ready to insert into the parser. Most of yesterdays conversation was spent hashing out the ways that this should be implemented. Remember, one of the biggest reasons for creating this function was so that E_NOTICE would not be issued when attempting

Re: [PHP-DEV] [RFC] ifsetor operator

2004-04-16 Thread Marcus Boerger
Hello George, thinking twice and rechecking it is a bit more complicated though. NVL in oracle means Null-VaLue or beter 'NULL Value replacement'. We want to replace the non-existing situation with a predefined value which is slightly different. Hence the name should be NEL, NEV or NEVAR for

Re: [PHP-DEV] Re: [PHP-CVS] cvs: php-src /ext/tidy tidy.c

2004-04-16 Thread John Coggeshall
Should be fixed now -- windows builds too. John On Fri, 2004-04-16 at 15:34, Nuno Lopes wrote: Should be fixed now. Derick It isn't fixed because tidy tries to open NULL :) Please apply my patch that (hoppefully) fixes the problem. (I've tested it!) Nuno --

Re: [PHP-DEV] [RFC] ifsetor operator

2004-04-16 Thread George Schlossnagle
On Apr 16, 2004, at 5:51 PM, Marcus Boerger wrote: Hello George, thinking twice and rechecking it is a bit more complicated though. NVL in oracle means Null-VaLue or beter 'NULL Value replacement'. We want to replace the non-existing situation with a predefined value which is slightly

Re: [PHP-DEV] Re: [RFC] ifsetor operator

2004-04-16 Thread Christian Schneider
Jason Garber wrote: As Wez pointed out, this is almost ready to insert into the parser. Most of yesterdays conversation was spent hashing out the ways that this should be implemented. Ok, now I'm confused. Why is an RFC (Request For Comment) posted to the internals list if it was already

Re: [PHP-DEV] Re: [RFC] ifsetor operator

2004-04-16 Thread Andi Gutmans
I don't want to spoil the party but: a) I don't think we should add a new reserved word for this. I will try and think of an alternative which uses the existing vocabulary. b) I would not want to add this before releasing PHP 5.0.0. I think we should add it afterwards. We are not talking about a

Re: [PHP-DEV] Re: [RFC] ifsetor operator

2004-04-16 Thread Rasmus Lerdorf
Argh! Guys, let's not use anything that just combines 2 existing keywords. Being able to read stuff at a glance is important: if exists(...) ifexists(...) or else if(...) ifelse(...) these would do vastly different things but look alike, and that is ungood. -Rasmus On Sat, 17 Apr

Re: [PHP-DEV] [RFC] ifsetor operator

2004-04-16 Thread Jay Smith
Derick Rethans wrote: On Fri, 16 Apr 2004, Marcus Boerger wrote: [RFC] ifsetor operator Hello List, i also agrre that an internal function is much better. And here is it as such an internal function (that does not result in an expensive function call). Synopsis: ifsetor ( value ,

Re: [PHP-DEV] [RFC] ifsetor operator

2004-04-16 Thread Jochem Maas
? $myVar = null; var_dump(isset($myVar)); ? George Schlossnagle wrote: On Apr 16, 2004, at 5:51 PM, Marcus Boerger wrote: Hello George, thinking twice and rechecking it is a bit more complicated though. NVL in oracle means Null-VaLue or beter 'NULL Value replacement'. We want to replace the

RE: [PHP-DEV] Re: [RFC] ifsetor operator

2004-04-16 Thread Sterling Hughes
How about, if (isset($b)) { $a = $b; } else { $a = 10; } Or is that a bit too revolutionary? :) The problems with these operators is that the logic you want here is rarely simple, and when you need to refactor, you need to change your construct back to if{}else{} often introducing bugs. I

RE: [PHP-DEV] Re: [RFC] ifsetor operator

2004-04-16 Thread Jason Garber
In our code, you will find many blocks looking like $CUST_ID = (integer) (isset($_POST['CUST_ID']) ? $_POST['CUST_ID'] : 0); $CONTACT_ID = (integer) (isset($_POST['CONTACT_ID']) ? $_POST['CONTACT_ID'] : 0); And when you want to read an element from an array that may or may not exist, you see