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

2004-04-15 Thread John Coggeshall
On Thu, 2004-04-15 at 20:07, Sterling Hughes wrote: > Also wrong. You never through an E_ERROR for this sort of thing. Ilia pointed that out, its been corrected -- all zend_error() references were also changed to php_error_docref() (except in RINIT) John -- -=~=--=~=--=~=--=~=--=~=--=~=--=~=-

Re: [PHP-DEV] Construct Request

2004-04-15 Thread Marcus Boerger
Hello Jason, here is your operator patch: http://marcus-boerger.de/php/ext/ze2/ze2-ifsetor-20040416.diff.txt currently it uses the following syntax: $var $: $defaul which would equal isset($var) ? $var : $default Notice that at the moment the operator is '$:' and not '?:'. This is because i h

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

2004-04-15 Thread Sterling Hughes
On Apr 15, 2004, at 4:12 PM, John Coggeshall wrote: Attached is a patch which I hope will keep people happy when it comes to specifically the Tidy extension. I'd like some feedback on this before I commit it / throw it away: Changes: - All errors were re-evaluated, and those (such as a bogus

Re: [PHP-DEV] Exceptions and Errors

2004-04-15 Thread Marcus Boerger
Hello Jevon, Friday, April 16, 2004, 1:05:11 AM, you wrote: >> Guys, I'm am not for forcing people to use exceptions. I agree that we >> should make PHP another Java exceptions from hell (especially with their >> exception declarations in function prototypes which is horrible). I'm just >> saying

Re: [PHP-DEV] [PATCH] fix for inconsistent output of spprintf() (for %p specifier)

2004-04-15 Thread Marcus Boerger
Hello Eric, thanks for noticing. marcus Thursday, April 15, 2004, 11:30:07 PM, you wrote: > Hello folks, > In all functions using spprintf(), the output corresponding to the > format conversion specifier "%p" depends on the value of the > *previously* converted argument (if any), not just the p

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

2004-04-15 Thread John Coggeshall
Attached is a patch which I hope will keep people happy when it comes to specifically the Tidy extension. I'd like some feedback on this before I commit it / throw it away: Changes: - All errors were re-evaluated, and those (such as a bogus config option) were demoted to E_NOTICE or promote

Re: [PHP-DEV] Construct Request

2004-04-15 Thread Jason Garber
Hello, Let me make an attempt to clarify what I originally requested. -- A function/construct named setor() modeled after isset(), which takes 2 parameters: parameter 1, the variable in question parameter 2, the default value if(isset($parameter1)) return $parameter1; else return $p

Re: [PHP-DEV] Exceptions and Errors

2004-04-15 Thread Jevon Wright
> Guys, I'm am not for forcing people to use exceptions. I agree that we > should make PHP another Java exceptions from hell (especially with their > exception declarations in function prototypes which is horrible). I'm just > saying, that some extensions might benefit from exceptions and the > ext

Re: [PHP-DEV] Construct Request

2004-04-15 Thread Andi Gutmans
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 true, the expression evaluates to $bar or to 0,

Re: [PHP-DEV] Construct Request

2004-04-15 Thread Andrey Hristov
Sean Coates wrote: Jason Garber wrote: function setor(&$param, $default) { return (isset($param) ? $param : $default); } I tested it on 4.3.4 and 5.0 RC1, and it worked. Is passing an undefined variable as a reference parameter a legal thing to do in PHP? That bring up an interesting point

Re: [PHP-DEV] Construct Request

2004-04-15 Thread Sean Coates
Jason Garber wrote: function setor(&$param, $default) { return (isset($param) ? $param : $default); } I tested it on 4.3.4 and 5.0 RC1, and it worked. Is passing an undefined variable as a reference parameter a legal thing to do in PHP? That bring up an interesting point: error_reporting(E_A

[PHP-DEV] [PATCH] fix for inconsistent output of spprintf() (for %p specifier)

2004-04-15 Thread Eric Lambart
Hello folks, In all functions using spprintf(), the output corresponding to the format conversion specifier "%p" depends on the value of the *previously* converted argument (if any), not just the pointer corresponding to the specifier. 1) If the previously-converted argument was a non-zero integer

Re: [PHP-DEV] Exceptions and Errors

2004-04-15 Thread George Schlossnagle
On Apr 15, 2004, at 5:21 PM, Marcus Boerger wrote: Hello Christian, Thursday, April 15, 2004, 1:06:20 PM, you wrote: [EMAIL PROTECTED] wrote: "modern dynamic" languages in that context, as for instance in Python there is no error handling but by using exceptions). Sorry but that's simply wrong.

Re: [PHP-DEV] Re: Construct Request

2004-04-15 Thread Marcus Boerger
Hello Justin, Thursday, April 15, 2004, 5:28:29 PM, you wrote: >> echo setor($required_variable, die('error...'); >> or >> echo setor($error, ''); >> or >> echo setor($sMessage, $sDefaultMessage). >> or >> $z = setor($_GET['z'], 'Default'); >> $z = setor($_GET['z'], 'Default'); > Whats wrong wit

Re: [PHP-DEV] Construct Request

2004-04-15 Thread Marcus Boerger
Hello Derick, Thursday, April 15, 2004, 10:07:01 PM, you wrote: > On Thu, 15 Apr 2004, Jason Garber wrote: >> I see. I was basing the spec on the functionality of isset() which does >> not (obviously) throw an E_NOTICE when you pass an undefined variable to >> it. However, do you see any reaso

Re: [PHP-DEV] Exceptions and Errors

2004-04-15 Thread Marcus Boerger
Hello Christian, Thursday, April 15, 2004, 1:06:20 PM, you wrote: > [EMAIL PROTECTED] wrote: >> "modern dynamic" languages in that context, as for instance in Python >> there is no error handling but by using exceptions). > Sorry but that's simply wrong. Python methods can return false or null

Re: [PHP-DEV] Exceptions and Errors

2004-04-15 Thread Marcus Boerger
Hello Derick, Thursday, April 15, 2004, 11:02:14 PM, you wrote: > On Thu, 15 Apr 2004, Marcus Boerger wrote: >> I don't. If you don't like the oo interface of SQLite then go with the >> procedural API. For the way i implemented SQLite's oo API exceptions are the >> way to go - a gingle exception

Re: [PHP-DEV] Exceptions and Errors

2004-04-15 Thread Derick Rethans
On Thu, 15 Apr 2004, Marcus Boerger wrote: > I don't. If you don't like the oo interface of SQLite then go with the > procedural API. For the way i implemented SQLite's oo API exceptions are the > way to go - a gingle exception in the ctor. There is nothing wrong with that at all, it's just the o

Re: [PHP-DEV] Exceptions and Errors

2004-04-15 Thread Marcus Boerger
Hello Christian, Thursday, April 15, 2004, 1:15:03 PM, you wrote: > Andi Gutmans wrote: >> I don't think allowing the return of anything except for the object >> itself is *fixing* PHP. > No, being able to fail and return would not be fixing it. It would be > extending it to allow people to av

Re: [PHP-DEV] Exceptions and Errors

2004-04-15 Thread Marcus Boerger
Hello Derick, Thursday, April 15, 2004, 9:59:23 AM, you wrote: > On Thu, 15 Apr 2004, Andi Gutmans wrote: >> I don't like these ideas. I think it should stay the way it is and not only >> because we're at RC2. >> If Thies doesn't want to deal with this, then he can write constructors >> without

Re: [PHP-DEV] Exceptions and Errors

2004-04-15 Thread Marcus Boerger
Hello Jani, Thursday, April 15, 2004, 10:49:17 PM, you wrote: > On Thu, 15 Apr 2004, Andi Gutmans wrote: >>Guys, I'm am not for forcing people to use exceptions. > Marcus is.. :) I don't. If you don't like the oo interface of SQLite then go with the procedural API. For the way i implemente

Re: [PHP-DEV] Exceptions and Errors

2004-04-15 Thread Jani Taskinen
On Thu, 15 Apr 2004, Andi Gutmans wrote: >Guys, I'm am not for forcing people to use exceptions. Marcus is.. :) > I agree that we should make PHP another Java exceptions from hell > (especially with their exception declarations in function prototypes which > is horrible). I'm just I

Re: [PHP-DEV] Exceptions and Errors

2004-04-15 Thread Jani Taskinen
On Thu, 15 Apr 2004, George Schlossnagle wrote: > >On Apr 15, 2004, at 9:49 AM, Jani Taskinen wrote: > >> On Thu, 15 Apr 2004, George Schlossnagle wrote: >> >>> On Apr 15, 2004, at 8:28 AM, Christian Schneider wrote: No, I dislike them because they create more problems than they solve. >>> >>

Re: [PHP-DEV] Construct Request

2004-04-15 Thread Wez Furlong
+1 for the GCC style syntax. --Wez. - Original Message - From: "Hartmut Holzgraefe" <[EMAIL PROTECTED]> To: "Sascha Schumann" <[EMAIL PROTECTED]> Cc: "Ilia Alshanetsky" <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]> Sent: Thursday, April 15, 2004 8:47 PM Subject: Re: [PHP-DEV] Construct Reques

Re: [PHP-DEV] Construct Request

2004-04-15 Thread Todd Ruth
You can avoid the E_NOTICE using a reference, but it can have undesired side effects. For example, if you pass $x[5] by reference (whether to an internal function or a user defined function), $x[5] will be "created" and set to NULL. To avoid this side-effect, don't use the reference and instead

Re: [PHP-DEV] Construct Request

2004-04-15 Thread Jason Garber
I wrote this (I underlined the relevant parts for you): > >You'll need something more clever, because > >an undefined key 'CUST_ID' in $_POST['CUST_ID'] will strill throw a Consider this: --- error_reporting(E_ALL); function setor(&$param, $default) {

Re: [PHP-DEV] Construct Request

2004-04-15 Thread Derick Rethans
On Thu, 15 Apr 2004, Jason Garber wrote: > I see. I was basing the spec on the functionality of isset() which does > not (obviously) throw an E_NOTICE when you pass an undefined variable to > it. However, do you see any reason that this would not reliably work? I wrote this (I underlined the re

Re: [PHP-DEV] Construct Request

2004-04-15 Thread Jason Garber
Hi Derick, I see. I was basing the spec on the functionality of isset() which does not (obviously) throw an E_NOTICE when you pass an undefined variable to it. However, do you see any reason that this would not reliably work? function setor(&$param, $default) { return (isset($param) ? $pa

Re: [PHP-DEV] Construct Request

2004-04-15 Thread Derick Rethans
On Thu, 15 Apr 2004, Jason Garber wrote: > $_POST['CUST_ID'] = (int) isset_or_default($_POST['CUST_ID'], 0); > > I agree that it would be helpful not to evaluate the second parameter > unless needed, which is why I originally proposed a language construct. You'll need something more clever, becau

Re: [PHP-DEV] Re: Construct Request

2004-04-15 Thread George Schlossnagle
On Apr 15, 2004, at 3:35 PM, Timm Friebe wrote: On Thu, 2004-04-15 at 21:36, Chuck Hagenbuch wrote: Quoting Hartmut Holzgraefe <[EMAIL PROTECTED]>: [...] If this were added, wouldn't it make sense to use the convention already adopted by perl? $foo |= 'default'; Already used: $ php -r '$a= 1; $a

Re: [PHP-DEV] Construct Request

2004-04-15 Thread Hartmut Holzgraefe
Sascha Schumann wrote: That is basically the same idea once proposed as extending the ternary operator (credit goes to GCC and its C extension). $bar ? : $baz; yes, that looks like the way it should look like, and the danger of newbees abusing it would be way lower than with a function

Re: [PHP-DEV] Construct Request

2004-04-15 Thread Jason Garber
The best functionality would be for it to return the value, not re-assign it. Many of the things being talked about would modify the sent parameter, rather than return selected value. For instance (using the isset_or_default()) call: $nCustID = (int) isset_or_default($_POST['CUST_ID'], 0); Th

Re: [PHP-DEV] Re: Construct Request

2004-04-15 Thread Timm Friebe
On Thu, 2004-04-15 at 21:36, Chuck Hagenbuch wrote: > Quoting Hartmut Holzgraefe <[EMAIL PROTECTED]>: [...] > If this were added, wouldn't it make sense to use the convention > already adopted > by perl? > > $foo |= 'default'; Already used: $ php -r '$a= 1; $a |= 2; var_dump($a);' int(3) - Tim

Re: [PHP-DEV] Re: Construct Request

2004-04-15 Thread Chuck Hagenbuch
Quoting Hartmut Holzgraefe <[EMAIL PROTECTED]>: actualy in this special case i have been whishing for an operator for ages, maybe a modification of the good old ternary: $foo = ?$bar : "default"; or $foo ?= "default"; If this were added, wouldn't it make sense to use the convention alread

Re: [PHP-DEV] Re: Construct Request

2004-04-15 Thread Olivier Hill
Hartmut Holzgraefe wrote: or $foo ?= "default"; Looks Too Much Like Perl. IMO, if this is to be implemented, a function should be created, and not a set of operators. Olivier -- GB/E/IT d+ s+:+ a-- C++$ UL$ P L+++$ E- W++$ N- ?o ?K w--(---) !O M+$ V- PS+ PE- Y PGP t++ 5-- X+@ R- tv+

Re: [PHP-DEV] Re: Construct Request

2004-04-15 Thread Hartmut Holzgraefe
Justin Hannus wrote: Whats wrong with defining a user-level function? actualy in this special case i have been whishing for an operator for ages, maybe a modification of the good old ternary: $foo = ?$bar : "default"; or $foo ?= "default"; ;) -- Hartmut Holzgraefe <[EMAIL PROTECTED]> -- PH

[PHP-DEV] 4.3.6 Released

2004-04-15 Thread Ilia Alshanetsky
PHP Development Team is proud to announce the release of PHP 4.3.6. This is is a bug fix release whose primary goal is to address two bugs which may result in crashes in PHP builds with thread-safety enabled. All users of PHP in a threaded environment (Windows) are strongly encouraged to upgrade

Re: [PHP-DEV] Construct Request

2004-04-15 Thread Ilia Alshanetsky
On April 15, 2004 02:15 pm, Andi Gutmans wrote: > It could be implemented but I don't see the big advantage over $bar ? 0 : > $base It's one character... Well, currently to check the value and assign the default you need to do the following: $_GET['foo'] = isset($_GET['foo']) ? (int) $_GET['foo'

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

2004-04-15 Thread Andrey Hristov
Adam Maccabee Trachtenberg wrote: On Thu, 15 Apr 2004, Andi Gutmans wrote: I held RC2 because I thought this was a critical engine bug. It happened because instead of not implementing NULL you implemented it without a body. Right now I changed it to NULL which means that any clone either via "clo

Re: [PHP-DEV] Construct Request

2004-04-15 Thread Sean Coates
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 true, the expression evaluates to $bar or to 0, respectively. I think we're unclear on this.

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

2004-04-15 Thread Adam Maccabee Trachtenberg
On Thu, 15 Apr 2004, Andi Gutmans wrote: > Personally, I think we can roll RC2 with the way the tree is now. The fact > that MySQLi isn't cloneable isn't a big deal because: > a) It's a new PHP 5 feature which is most likely not run in > zend.zend1_compatibility_mode > b) If explicit "clone" isn't

Re: [PHP-DEV] Construct Request

2004-04-15 Thread Andi Gutmans
It could be implemented but I don't see the big advantage over $bar ? 0 : $base It's one character... At 02:09 PM 4/15/2004 -0400, Sean Coates wrote: Is there a good reason to NOT implement this? If not, I'm +1 on that (if I carry ANY weight at all (-: ) BC isn't an issue, and it would be a very us

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

2004-04-15 Thread Andi Gutmans
At 02:09 PM 4/15/2004 -0400, Adam Maccabee Trachtenberg wrote: On Thu, 15 Apr 2004, Andi Gutmans wrote: > I held RC2 because I thought this was a critical engine bug. It happened > because instead of not implementing NULL you implemented it without a body. > Right now I changed it to NULL which me

RE: [PHP-DEV] Construct Request

2004-04-15 Thread Darrell Brogdon
+1 -Original Message- From: Sean Coates [mailto:[EMAIL PROTECTED] Sent: Thursday, April 15, 2004 12:10 PM To: Sascha Schumann Cc: [EMAIL PROTECTED] Subject: Re: [PHP-DEV] Construct Request Is there a good reason to NOT implement this? If not, I'm +1 on that (if I carry ANY weight at all

Re: [PHP-DEV] Construct Request

2004-04-15 Thread Sean Coates
Is there a good reason to NOT implement this? If not, I'm +1 on that (if I carry ANY weight at all (-: ) BC isn't an issue, and it would be a very useful feature, IMHO.. S Sascha Schumann wrote: That is basically the same idea once proposed as extending the ternary operator (credit goes t

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

2004-04-15 Thread Adam Maccabee Trachtenberg
On Thu, 15 Apr 2004, Andi Gutmans wrote: > I held RC2 because I thought this was a critical engine bug. It happened > because instead of not implementing NULL you implemented it without a body. > Right now I changed it to NULL which means that any clone either via > "clone" or compatibility_mode w

Re: [PHP-DEV] Re: Construct Request

2004-04-15 Thread Justin Hannus
Actually, although suppressing the E_NOTICE, this is not exactly the behavior you want. What if $_GET['Does']['Not']['Exist'] really doesn't exists? It is then created and assigned to $param when passed as an argument to the param function. Therefore polluting $_GET with another unused array and a

Re: [PHP-DEV] Exceptions and Errors

2004-04-15 Thread Andi Gutmans
At 01:15 PM 4/15/2004 +0200, Christian Schneider wrote: Andi Gutmans wrote: I don't think allowing the return of anything except for the object itself is *fixing* PHP. No, being able to fail and return would not be fixing it. It would be extending it to allow people to avoid exceptions for this s

Re: [PHP-DEV] Re: Construct Request

2004-04-15 Thread Todd Ruth
The thing I like about the suggestion over implementing the function in script is the ability to skip the call to a function that provides the default. In the following example, slowFunc() simulates a slow function using a sleep, but you can imagine any function call with a performance hit. The s

[PHP-DEV] Fwd: [PHP-CVS] cvs: php-src /ext/mysqli mysqli.c

2004-04-15 Thread Andi Gutmans
Georg, I held RC2 because I thought this was a critical engine bug. It happened because instead of not implementing NULL you implemented it without a body. Right now I changed it to NULL which means that any clone either via "clone" or compatibility_mode will result in an error message that MyS

Re: [PHP-DEV] Re: Construct Request

2004-04-15 Thread Ferdinand Beyer
On 15 Apr 2004 at 11:47, Jason Garber wrote: > a. the actual variable in question could not be passed This is wrong, too. Look at this example: Output: array(2) { ["Exists"]=> string(1) "0" ["Does"]=> array(1) { ["Not"]=> array(1) {

Re: [PHP-DEV] Exceptions and Errors

2004-04-15 Thread Lukas Smith
Brad Fisher wrote: Lukas Smith wrote: Our original idea was to handle this with an if statement like so: if (version_compare(phpversion(), "5.0.0") == -1) { // assign factoried method to this for PHP 4 // $this =& ::factory(); // $this =& ::singleton(); eval('$this =& ::singleton();'); S

Re: [PHP-DEV] Exceptions and Errors

2004-04-15 Thread Brad Fisher
Lukas Smith wrote: > > Our original idea was to handle this with an if statement like so: > > if (version_compare(phpversion(), "5.0.0") == -1) { > > // assign factoried method to this for PHP 4 > > // $this =& ::factory(); // $this =& ::singleton(); eval('$this =& ::singleton();'); > >

Re: [PHP-DEV] Construct Request

2004-04-15 Thread Sascha Schumann
That is basically the same idea once proposed as extending the ternary operator (credit goes to GCC and its C extension). $bar ? : $baz; If $bar evaluates to true, the expression evaluates to $bar or to 0, respectively. - Sascha -- PHP Internals - PHP Runtime Developmen

Re: [PHP-DEV] Construct Request

2004-04-15 Thread Ilia Alshanetsky
I am not sure what would be the best name for such an engine construct or a function, but the idea itself is good (IMHO). It would certainly make it easier to write safer notice free code. Ilia -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/un

Re: [PHP-DEV] Re: Construct Request

2004-04-15 Thread Derick Rethans
On Thu, 15 Apr 2004, Jason Garber wrote: > a. the actual variable in question could not be passed > b. it incurs the overhead of calling a user-level function Which takes about as much time as calling an internal function, so that argument is bogus. Derick -- PHP Internals - PHP Runtime Develo

[PHP-DEV] Re: Construct Request

2004-04-15 Thread Andrew
Hello, Thank you for your efforts for making PHP code error free and clean. Your idea to use common setor(arg1, arg2) function will completely resolve the problem of variable existing evaluating and further defaulting. By call of setor function developers will not take care about warnin

Re: [PHP-DEV] Re: Construct Request

2004-04-15 Thread Jason Garber
At 4/15/2004 11:28 AM -0400, Justin Hannus wrote: > echo setor($required_variable, die('error...'); > or > echo setor($error, ''); > or > echo setor($sMessage, $sDefaultMessage). > or > $z = setor($_GET['z'], 'Default'); > $z = setor($_GET['z'], 'Default'); Whats wrong with defining a user-level fu

[PHP-DEV] Re: Construct Request

2004-04-15 Thread Justin Hannus
> echo setor($required_variable, die('error...'); > or > echo setor($error, ''); > or > echo setor($sMessage, $sDefaultMessage). > or > $z = setor($_GET['z'], 'Default'); > $z = setor($_GET['z'], 'Default'); Whats wrong with defining a user-level function? function setor_array(&$array, $key, $def

[PHP-DEV] Construct Request

2004-04-15 Thread Jason Garber
Hello Internals team, Thank you for taking a moment to evaluate a serious request by a serious php developer that is responsible for a development company of 15 employees. In order to keep our code as clean and error free as possible, we opt to develop in the E_ALL error mode, and register_globals

Re: [PHP-DEV] Exceptions and Errors

2004-04-15 Thread George Schlossnagle
On Apr 15, 2004, at 9:49 AM, Jani Taskinen wrote: On Thu, 15 Apr 2004, George Schlossnagle wrote: On Apr 15, 2004, at 8:28 AM, Christian Schneider wrote: No, I dislike them because they create more problems than they solve. Then don't use them. You're a bit late to the party to debate their

Re: [PHP-DEV] Exceptions and Errors

2004-04-15 Thread Jani Taskinen
On Thu, 15 Apr 2004, George Schlossnagle wrote: >On Apr 15, 2004, at 8:28 AM, Christian Schneider wrote: >> No, I dislike them because they create more problems than they solve. > >Then don't use them. You're a bit late to the party to debate their But if some extension (e.g. sqlite) forces

Re: [PHP-DEV] BugReport reproductible: sqlite and multiple queries (PHP5.0.0RC1)

2004-04-15 Thread Wez Furlong
I noticed this problem the other day; it's related to the VM query implementation in libsqlite. --Wez. - Original Message - From: <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Thursday, April 15, 2004 2:15 PM Subject: [PHP-DEV] BugReport reproductible: sqlite and multiple queries (PH

[PHP-DEV] BugReport reproductible: sqlite and multiple queries (PHP5.0.0RC1)

2004-04-15 Thread mickael . bailly
Hi, sorry but bugs.php.net seems unreachable. Here is the reproductible problem I got, related to multiple queries in a single sqlite_query call : I'm using PHP5.0.0RC1 but the bug is still present in PHP5.0.0RC2RC1 from http://snaps.php.net/~andi/. Note this functionnali

Re: [PHP-DEV] Exceptions and Errors

2004-04-15 Thread Christian Schneider
George Schlossnagle wrote: Then don't use them. You're a bit late to the party to debate their existence in the language. I was late pointing out that copy-on-assignment is a mistake in PHP4, I was late pointing out that there is no migration path for __clone(), I was late with PPP and exceptio

Re: [PHP-DEV] Exceptions and Errors

2004-04-15 Thread George Schlossnagle
On Apr 15, 2004, at 8:28 AM, Christian Schneider wrote: No, I dislike them because they create more problems than they solve. Then don't use them. You're a bit late to the party to debate their existence in the language. George -- PHP Internals - PHP Runtime Development Mailing List To unsubscr

Re: [PHP-DEV] Exceptions and Errors

2004-04-15 Thread Lukas Smith
Lukas Smith wrote: Our original idea was to handle this with an if statement like so: if (version_compare(phpversion(), "5.0.0") == -1) { // assign factoried method to this for PHP 4 // $this =& ::factory(); $this =& ::singleton(); } else { // error handling for PHP5 // user ha

Re: [PHP-DEV] Exceptions and Errors

2004-04-15 Thread Christian Schneider
[EMAIL PROTECTED] wrote: Actually those are a 'modern/dynamic' aspect of Java (being pseudo-closures). And a very bad one indeed. Not everything modern is good. dicuss on objective, rational arguments than on pure personal preference. I gave more than enough rational arguments. If you don't accept

Re: [PHP-DEV] Exceptions and Errors

2004-04-15 Thread Lukas Smith
Just to add some more thoughts to the ongoing discussion from a slightly different POV. The PEAR devs are trying to slowly prepare their packages for PHP5 and so we also needed to address assignedments to $this in constructors in the few packages that do so. http://pear.php.net/bugs/bug.php?id

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

2004-04-15 Thread Nuno Lopes
Hello, I've followed the war, sorry, discussion about exceptions. Now, let me introduce some problems I've found in Tidy. Look at the code: 'bogusvalue')); //because of throwing the exception, this function is never executed //thus making it complitely unusefull. echo tidy_config_count($tidy);

Re: [PHP-DEV] Exceptions and Errors

2004-04-15 Thread cm
> [EMAIL PROTECTED] wrote: >> First of all, PHP's object model is most similar to the Java one, so >> Markus' comparisons make most sense in my eyes. > > The object model might be similar to Java (it's a very simple one which > I like) but the language is not and *should not be* IMHO. Java got much

Re: [PHP-DEV] what is the reasonable thing to with a segfault in php?

2004-04-15 Thread Per Jessen
Derick Rethans wrote: > On Thu, 15 Apr 2004, Per Jessen wrote: > >> I'm *certain* it is caused by a mistake in *my* code, but I feel it isn't >> exactly appropriate for php to segfault because of a user error? > > Right, it's not supposed to do so. Please make a backtrace of the > segfault (with

Re: [PHP-DEV] Exceptions and Errors

2004-04-15 Thread Christian Schneider
Andi Gutmans wrote: I don't think allowing the return of anything except for the object itself is *fixing* PHP. No, being able to fail and return would not be fixing it. It would be extending it to allow people to avoid exceptions for this simple case. For example, in the SOAP extension it is ve

Re: [PHP-DEV] what is the reasonable thing to with a segfault in php?

2004-04-15 Thread Derick Rethans
On Thu, 15 Apr 2004, Per Jessen wrote: > I'm *certain* it is caused by a mistake in *my* code, but I feel it isn't > exactly appropriate for php to segfault because of a user error? Right, it's not supposed to do so. Please make a backtrace of the segfault (with gdb), or try with valgrind to see

Re: [PHP-DEV] Exceptions and Errors

2004-04-15 Thread Christian Schneider
[EMAIL PROTECTED] wrote: First of all, PHP's object model is most similar to the Java one, so Markus' comparisons make most sense in my eyes. The object model might be similar to Java (it's a very simple one which I like) but the language is not and *should not be* IMHO. Java got much too bloated

Re: [PHP-DEV] what is the reasonable thing to with a segfault in php?

2004-04-15 Thread Antony Dovgal
On Thu, 15 Apr 2004 12:44:20 +0200 Per Jessen <[EMAIL PROTECTED]> wrote: > Per Jessen wrote: > > > > > $editmain=strcasecmp($_REQUEST['contact'],"main")==0; > > //$editbilling=strcasecmp($_REQUEST['contact'],"billing")==0; > > //$edittechnical=strcasecmp($_REQUEST['contac

Re: [PHP-DEV] what is the reasonable thing to with a segfault in php?

2004-04-15 Thread Per Jessen
Per Jessen wrote: > > $editmain=strcasecmp($_REQUEST['contact'],"main")==0; > //$editbilling=strcasecmp($_REQUEST['contact'],"billing")==0; > //$edittechnical=strcasecmp($_REQUEST['contact'],"technical")==0; > OK, I've now guarded the above with : if ( isset($_REQUEST[

[PHP-DEV] what is the reasonable thing to with a segfault in php?

2004-04-15 Thread Per Jessen
Hi, I've got a situation where a seemingly innocent statement produces a segfault. I've tried reducing it to a single reproducable testcase, but without success. The problem is however solidly reproducable in the context in which it occurs. I'm *certain* it is caused by a mistake in *my* code, b

Re: [PHP-DEV] Exceptions and Errors

2004-04-15 Thread Derick Rethans
On Thu, 15 Apr 2004, Andi Gutmans wrote: > I don't like these ideas. I think it should stay the way it is and not only > because we're at RC2. > If Thies doesn't want to deal with this, then he can write constructors > without logic. It's not that hard for the one in many classes where this > migh