[PHP-DEV] Re: Get name of extending class with static method call (PHP5)

2005-01-12 Thread Christian Schneider
Hey Torsten, Torsten Roehr wrote: $persons = Person::load($sql); // returns collection of Person objects $cars= Car::load($sql);// returns collection of Car objects Simple solutions: 1) $persons = DB::load('Person', $sql); foreach ($persons as $person)... 2) $person = new Person($sql);

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

2004-12-27 Thread Christian Schneider
Sebastian Bergmann wrote: The Reflection API was introduced at the same time as exceptions. It therefore makes perfect sense to make consistent use of exception in the Reflection API. You don't have to treat everything like a nail just because you have a hammer. So the people who know how to

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

2004-12-24 Thread Christian Schneider
Derick Rethans wrote: I think it doesn't make sense if there is no method to actually check if it's there. Now you start throwing exeptions without having a way to avoid it. THAT is crazy. I assume that Sebastian would use something along the lines of try { $reflectionClass-getMethod(foo);

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

2004-12-24 Thread Christian Schneider
Sebastian Bergmann wrote: You assume wrong. My point is that you should not use getMethod() when you do not know whether or not the method exists. Ok, let's look at the options then: 5.0 - getMethods() [sure, you could probably use clever tricks to make this shorter but the general clumsiness

Re: [PHP-DEV] Why we don’t like PHP /

2004-12-22 Thread Christian Schneider
Paul Querna wrote: just a general feeling that it isn't tested as much. As one of the Apache Developers, I would be happy to help with any issues PHP has in its Apache 2 SAPI. I think that's an offer the PHP community should accept ;-) - Chris -- PHP Internals - PHP Runtime Development Mailing

Re: [PHP-DEV] Why we don’t like PHP /

2004-12-20 Thread Christian Schneider
Derick Rethans wrote: Why would we (as PHP developers) invest time in something while the current version provides us with all we need? Because more and more people want to run Apache 2 for different reasons? According to your argument PHP would only need to support one single OS and Webserver

Re: [PHP-DEV] Why we don’t like PHP /

2004-12-20 Thread Christian Schneider
Rasmus Lerdorf wrote: actually researching why something is a certain way. There was a time when there was no AddHandler directive. Addtype was the way you did According to the Apache documentation AddHandler appeared in Apache 1.1. I'm impressed with your memory, it's better than the memory

Re: [PHP-DEV] im convert php-screw to windows dll

2004-12-15 Thread Christian Schneider
Andrew Van Dyk wrote: Sorry... PHP Screw is a module to encrypt your PHP files so you don't distribute the source code. It works perfectly in UNIX, but Just a quick note for people considering using PHP Screw: It is absolutely trivial to decrypt such a file as the encryption algorithm is

Re: [PHP-DEV] creating detached processes in PHP

2004-11-22 Thread Christian Schneider
Wez Furlong wrote: Will app work do what you want on unix and start app do what you want on win32? On unix you probably want to do something like nohup app /dev/null /dev/null 21 to completely detach. - Chris -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit:

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

2004-11-22 Thread Christian Schneider
Andi Gutmans wrote: Why can't people who implement the Countable interface use $obj-count() instead of count($obj)? I guess the idea of SPL is hide the difference between real arrays and some homebrewed containers. The question is how much you want to maintain this illusion, i.e. what

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

2004-11-20 Thread Christian Schneider
Marcus Boerger wrote: We don't do this for any other interface based 'magic' (iterators, array overloading). But if that's your only concern then i'll happily change I think the keyword here is 'magic'. This introduces another mechanism for overloaded behaviour. Something can now a) implement an

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

2004-11-20 Thread Christian Schneider
Marcus Boerger wrote: We already decided not to allow ArrayAccess implementations to work Ok, excuse my ignorance, so what's the list of functions/constructs affected by SPL? - foreach - [] - count() What else? Are there plan to extend that at a later stage? [ Simply point me to an online

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

2004-11-20 Thread Christian Schneider
Marcus Boerger wrote: Mabe you should look here at the engine description in Zend directory of you PHP source. Ok, thanks for you summary. I read that and had a look at ZEND_CHANGES. - [] is overloaded by interface ArrayAccess (this is engine level only count() is missing here) - count() is

Re: [PHP-DEV] Type hints with null default values

2004-10-27 Thread Christian Schneider
Marcus Boerger wrote: So for now the only addition we may probably consider for 5.1 is adding 4: optional typehinted values that default to null and only null. Please don't add another parameter syntax (especially with line-noi... err special characters) like [BaseClass]. This would make PHP more

[PHP-DEV] Re: streams file uri under windows

2004-10-26 Thread Christian Schneider
Rob Richards wrote: Index: streams.c === RCS file: /repository/php-src/main/streams/streams.c,v retrieving revision 1.68 diff -r1.68 streams.c 1496c1496 if (protocol path[n+1] == '/' path[n+2] == '/' path[n+4] != ':') { --- if

Re: [PHP-DEV] Type hints with null default values

2004-10-19 Thread Christian Schneider
Andi Gutmans wrote: So one suggestion (also made a few months ago) was that the following: function method(MyClass $obj = NULL); would mark $obj as allowing NULL parameter. The only restrictions I see is that it makes the parameter optional as well (something I don't consider a problem as it is

[PHP-DEV] HTTP Response Splitting

2004-10-11 Thread Christian Schneider
I looked through the bug database and the archive of this mailing list but couldn't find any reference to HTTP Response Splitting. I apoligize if this has been discussed before :-) Basically it means that web applications return unfiltered user-supplied data in the HTTP header, most commonly

Re: [PHP-DEV] HTTP Response Splitting

2004-10-11 Thread Christian Schneider
Derick Rethans wrote: This is the users' problem, not ours. Sounds too much like MS to me :-) I wrote a little patch for PHP4 which I'll deploy on our servers. In case anyone is interested, have a look at: http://cschneid.com/php/php4/http_reponse_splitting.patch - Chris -- PHP Internals - PHP

Re: [PHP-DEV] HTTP Response Splitting

2004-10-11 Thread Christian Schneider
Sascha Schumann wrote: response header. There are also some SAPI modules which specifically expect exactly one header per call. As such, stripping off \n.* seems correct to me. The HTTP standard allows header field folding (CR/LF followed by at least one whitespace on the next

Re: [PHP-DEV] HTTP Response Splitting

2004-10-11 Thread Christian Schneider
Andi Gutmans wrote: No I don't know of any application which uses it. You might be right. If you people think we should introduce it then I'd do it for 5.1.x and as you said, definitely have an RC before release. And as I mentioned to Andi in another email the change would also increase

Re: [PHP-DEV] switch() and default:

2004-10-08 Thread Christian Schneider
Benj Carson wrote: Coming from C (or Java), I find the new behaviour a little strange. If you I fully agree. Although I wouldn't have used the word 'little' here :-) use default to match invalid conditions, putting it at the beginning of a switch doesn't seem to be poor practice to me (putting

Re: [PHP-DEV] switch() and default:

2004-10-08 Thread Christian Schneider
Andi Gutmans wrote: However, I can assure you that from day 1 this was not supposed to work and was documented as such for years already (since the days of PHP 3). If it worked at some point then it was by chance! This would be a good time to accept the defacto standard, redefine switch() in

Re: [PHP-DEV] Static call detection

2004-10-04 Thread Christian Schneider
Wez Furlong wrote: If a method is static, you should only ever call it statically. Doing any other tricks is just plain wrong. I dare to disagree. For tool functions it often makes sense to make them statically callable while you still might want to use them in an object instance context

Re: [PHP-DEV] Static call detection

2004-10-04 Thread Christian Schneider
Marcus Bointon wrote: To summarise, you can't tell, and you shouldn't be trying to anyway. That seems to be the consensus. I find it a pity as I like PHP for giving programmers freedom instead of telling them how to do things but oh well... :-) Over and out, - Chris -- PHP Internals - PHP

[PHP-DEV] Re: declaring classes as static or final

2004-09-28 Thread Christian Schneider
Michael Virnstein wrote: What do you think about it? PINJ (PHP Is Not Java) ;-) Let's keep the language simple, too much was added already IMHO (-:C - Chris -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php

Re: [PHP-DEV] realpath() caching

2004-09-22 Thread Christian Schneider
Sara Golemon wrote: realpath_cache_ttl - Time to live for cache entry (default 120 seconds; if set to 0 then doesn't refresh). Ah, didn't grok the TTL at first glance that fairly well negates the need for an explicit flush If the FS layout needs to change all one would have to do is turn

Re: [PHP-DEV] Re: setcookie() and Max-Age

2004-08-18 Thread Christian Schneider
Rasmus Lerdorf wrote: How about this: setcookie('name',$value,array('Max-Age'=3600, 'Comment'=$comment, 'Path'='/'); One drawback is that people have to know about the cookie specifications, e.g. 'Max-Age': Is it case sensitive, does it have a dash between max and age, etc? That should at

Re: [PHP-DEV] Re: setcookie() and Max-Age

2004-08-18 Thread Christian Schneider
Derick Rethans wrote: How is zend_strtolower() magic? I checked the RFC and we don't even need to convert it to lowercase. RDC 2109: 4.1 Syntax: General: Attributes (names) (attr) are case-insensitive. BTW: The comment was wrong about Max-Age: -1 to delete a cookie, the RFC says you have to use

[PHP-DEV] Re: setcookie() and Max-Age

2004-08-17 Thread Christian Schneider
Andi Gutmans wrote: Not sure if an how this could be added to setcookie() because of the already rich amount of parameters it accepts. Would it make sense to have something like setcookie_max_age() or something similar? I think we should overload the expire parameter. Somewhat ugly but

Re: [PHP-DEV] Everyone on the road?

2004-07-24 Thread Christian Schneider
Stefan Esser wrote: Realpath is not only slow, it is also dangerous on some systems like linux where it also works on paths that are not really existing. example: include ./foo/bar/index.php/../../../../../../etc/passwd; This is a completely legal unix path as .. in / is / again. And from a

[PHP-DEV] Re: fp, rounding, decimal arithmetic - definitive account?

2004-07-23 Thread Christian Schneider
George Whiffen wrote: As you either already know or could reasonably guess, my personal view is that simple, consistent, exact decimal arithmetic is highly desirable for any development tool intended for either novices or commercial use. I use BCMath for critical (e.g. money) calculations as I'd

[PHP-DEV] Re: fp, rounding, decimal arithmetic - definitive account?

2004-07-23 Thread Christian Schneider
Hey George, My point is: I'm not against improving accuracy of floating point arithmetic in PHP (although it could lead to some weird compatibility problems with older version) but I wouldn't advise people who really, really have to rely on their numbers to be correct to use floats anyway.

[PHP-DEV] Re: fp, rounding, decimal arithmetic - definitive account?

2004-07-23 Thread Christian Schneider
Christian Schneider wrote: I store cent values as integer strings and I possibly have to deal with values bigger than 214 million bucks (where PHP starts to convert ints Errr, that's 21 million bucks where the transition occurs :-) - Chris -- PHP Internals - PHP Runtime Development Mailing List

Re: [PHP-DEV] what happened to that new isset() like language

2004-07-10 Thread Christian Schneider
Andi Gutmans wrote: I don't think it's a matter of giving the engine a try. I think we first need to make a decision what the best way to go is and then we can discuss implementation if/what is possible. Once 5.0.0 is out I'm going Thanks for these words of wisdom, Andi. Dismissing a solution

Re: [PHP-DEV] what happened to that new isset() like language

2004-07-10 Thread Christian Schneider
Sascha Schumann wrote: This rule would favor the a ? : b notation - which has been supported by GCC for at least five years. My personal reasons against ?: : - It's non-standard and not well known even though GCC supports it. - It's hard to look up. - It's easily confused with $a ? $b :

Re: [PHP-DEV] what happened to that new isset() like language

2004-07-08 Thread Christian Schneider
Jason Garber wrote: What we basically settled on was to use this syntax (as a new language construct): $x = ifsetor(mixed variable, mixed default); Before it gets forgotten: I still think that $x = ifsetor(mixed var, mixed var [, ...]); with expressions in all parts is the way to go. Example

Re: [PHP-DEV] what happened to that new isset() like language

2004-07-08 Thread Christian Schneider
Marcus Boerger wrote: As i wrote before several times before to me this seems impossible. But maybe someone can come up with a working patch? I'll have a look at it as soon as I find time (not this week anyway). What I'm looking for is the equivalent of coalesce($a, $b) == @($a ? $a : b) or

[PHP-DEV] Re: Binary Shift: Signed or Unsigned?

2004-06-25 Thread Christian Schneider
Alex Stapleton wrote: I am using PHP5, if I want unsigned binary shift, do i have any options other than converting to a string using base_convert and You could use BC: bcdiv($a, 2); to do $a 1; - Chris -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit:

[PHP-DEV] Re: idate problems

2004-06-24 Thread Christian Schneider
Nuno Lopes wrote: 1) (i)date('L') should return the same (1 if is leap year, 0 otherwise), but they aren't outputing the same echo date('L'); //1 echo idate('L'); //0 Yes, this is indeed a bug in the isleap macro (you needed to call it with double parens), the fix is diff -u -r1.120 datetime.c

[PHP-DEV] Re: keyword arguments?

2004-06-23 Thread Christian Schneider
Daniel Crookston wrote: some_function($a, 'B', :check TRUE) function some_function($first, $second, :check $key1 = FALSE, :foo $key2) First of all: I guess it is too early to start the discussion about named parameters again. As much as I think named parameters are an interesting concept I don't

[PHP-DEV] Re: ClassHints and NULL

2004-06-15 Thread Christian Schneider
Michael Wallner wrote: Is there *ANY* serious reason why NULL is not allowed in place of an object? PHP will become *really* odd if this is the way it goes. People won't stick to this new feature... There was a (very) long discussion about this on this mailing list a couple of weeks ago, please

Re: [PHP-DEV] Re: crc32() improvements

2004-06-14 Thread Christian Schneider
Alexander Valyalkin wrote: It is only idle talk. Can you provide any string from my code which violates your coding standards? Calm down. As I said before (obviously not clearly enough, I was hoping one of the 'project managers' would do that for me ;-)) you are missing the point why people

Re: [PHP-DEV] basename() memory access violation

2004-06-14 Thread Christian Schneider
Ilia Alshanetsky wrote: Do you have an example script that can be used to reproduce the supposed memory access violation? The function php_basename actually DOES access the char at s-1, i.e. one byte before the string it is passed. If you hand it a buffer gotten from malloc you get a valgrind

[PHP-DEV] Re: strip_tags() discussion

2004-06-10 Thread Christian Schneider
Alexander Valyalkin wrote: What sense of the [allowable_tags] parameter in strip_tags()? According docs, You can use the optional second parameter to specify tags which should not be stripped. strip_tags alone is indeed not enough to make sure the input is safe to display inside your web page.

[PHP-DEV] Re: the new version of strip_tag()

2004-06-10 Thread Christian Schneider
Alexander Valyalkin wrote: Today I wrote the new version of strip_tags(). It looks like you're very eager to contribute to PHP and write code very quickly. On the other hand I think the focus of people on this list right now is a bit different from what you're trying to do: Fix bugs in PHP 4

[PHP-DEV] feof hangs (bug #25939)

2004-05-27 Thread Christian Schneider
I tried to reopen bug #25939 http://bugs.php.net/bug.php?id=25939 because I ran into the same problem as topace at lightbox dot org but it's not my bug report. Should I open a new bug? I agree with the last comment that feof should not hang. Sample script: $fd = fsockopen('www.php.net', 80);

[PHP-DEV] Re: Destructors

2004-05-24 Thread Christian Schneider
Jason Garber wrote: Based on the above example, the $oSession-__destruct() method relies on the $oDB object still being usable. How can this be structured to ensure that the DB object does not get released first? Adding something like $oSession-db = $oDB; should work in my opinion. Didn't test

Re: [PHP-DEV] Re: Destructors

2004-05-24 Thread Christian Schneider
Adam Maccabee Trachtenberg wrote: That's not guaranteed to work. PHP 5 does not guarantee that object destructors will be called in any particular order or that the order will remain constant from one invocation to another. Ok, I was under the impression that PHP won't call any destructors of

[PHP-DEV] Re: protected/private access and var_dump/print_r

2004-05-18 Thread Christian Schneider
Sara Golemon wrote: var_dump($someobject); shows only public properties (as I'd expect), but print_r($someobject) shows all properties (explicitly identifying protected/private props). I agree with Derick and Andrey in that if anything should be changed it is var_dump. Reasoning: PPP is there to

[PHP-DEV] Re: Implicit Arrays and E_STRICT

2004-05-07 Thread Christian Schneider
Sara Golemon wrote: plea. I'd like to see Zend throw an E_STRICT when arrays are implicitly created. I know there were objections to E_NOTICE, but did anyone have violent objections to E_STRICT? I guess the question is whether we want to deprecate the automatic array creation at some point as

[PHP-DEV] Re: call_user_function wrong number of parameters?

2004-04-29 Thread Christian Schneider
Bill Zeller wrote: if (call_user_function(CG(function_table), NULL, func_name,retval_ptr, 2,params) == SUCCESS) { ZEND_API int call_user_function(HashTable *function_table, zval **object_pp, zval *function_name, zval *retval_ptr, zend_uint param_count, zval *params[] TSRMLS_DC); Without having a

Re: [PHP-DEV] Illegal use of string offset

2004-04-27 Thread Christian Schneider
Andi Gutmans wrote: At 03:49 AM 4/27/2004 +, Curt Zirzow wrote: $a = 'a string'; /* E_ERROR Cannot use string offset as an array */ echo is_array($a['bar']['baz']); I made this change back in December. I guess I could revert back but I think it makes sense to be strict here. What does the

Re: [PHP-DEV] Illegal use of string offset

2004-04-27 Thread Christian Schneider
Andi Gutmans wrote: I made this change back in December. I guess I could revert back but I think it makes sense to be strict here. Reevaluating it I noted the following: $a = 'foo'; $a['bar']['qux'] = 42; # error $a = 42; $a['bar']['qux'] = 42;# warning $a = true; $a['bar']['qux'] =

Re: [PHP-DEV] Illegal use of string offset

2004-04-27 Thread Christian Schneider
Marcus Boerger wrote: [ $a = 'foo'; $a['bar'] = 42; has an even weirder behaviour: It results in the string '4oo'... ] That's a pretty. It is using 'bar' as a sting index to 'foo' and to do this it needs to convert 'bar' to an integer. The rest is obvious. So you find it obvious that 42 is cast

Re: [PHP-DEV] Illegal use of string offset

2004-04-27 Thread Christian Schneider
Marcus Boerger wrote: For BC purposes with PHP 3, NULL/False and unset creation of array does not emit a warning. I don't think we should change this. It is time to forget BC with PHP 3. Nearly noone is using it now. PHP 4 doesn't issue a warning/notice either and I could imagine there is plenty

[PHP-DEV] Re: typehinting and NULL

2004-04-21 Thread Christian Schneider
Marcus Boerger wrote: function allowingNULL(object $val = NULL) function preventNULL(object $val) I like this idea even though it's abusing the default value syntax. What's a bit weird is something like function foo(object $obj = NULL, $mandatoryparameter) { ... } where people will wonder why

[PHP-DEV] Re: Interface inheritance

2004-04-19 Thread Christian Schneider
Zeev Suraski wrote: Any method that implements (directly or indirectly) an interface method or an abstract method, will have implementation checks fully enforced, with an E_COMPILE_ERROR emitted in case of an error. Excuse my ignorance: What is defined as fully implementing the interface? I

Re: [PHP-DEV] Interface inheritance

2004-04-19 Thread Christian Schneider
Zeev Suraski wrote: 1. First of all, I agree that in a perfect world we should go with E_COMPILE_ERROR for everything. Maybe now that's constructors are out I'm not sure I understand what you mean by everything. whole interface/abstract/class type hints mechanism was added for the sole

Re: [PHP-DEV] Interface inheritance

2004-04-19 Thread Christian Schneider
Zeev Suraski wrote: In my opinion it doesn't, because it breaks the interface of the parent class. I.e., you can no longer use code you've written to work with an object of the parent class, with an object of the child class, which breaks one of the most fundamental principals of OO. In turn,

Re: [PHP-DEV] Interface inheritance

2004-04-19 Thread Christian Schneider
Magnus Määttä wrote: If you don't want strictness, don't use interfaces. If this doesn't get I agree. Which also means that the PHP core and extensions should be written without interfaces to avoid forcing people to use them. Otherwise you end up with an extension you can't use with another

Re: [PHP-DEV] php.ini-dist

2004-04-19 Thread Christian Schneider
Marcus Boerger wrote: Erm i meant we may add E_STRICT to E_ALL in a later version. ... which would be a big BC break. Remember that 'var' produces a warning under E_STRICT. And 'var' is here to stay for a *long* time. - Chris -- PHP Internals - PHP Runtime Development Mailing List To

[PHP-DEV] set_error_handler

2004-04-17 Thread Christian Schneider
Jason Garber wrote: Don't forget that some users make use of set_error_handler(). This Which reminds me that the documentation should be updated to reflect the additional parameter error_types to set_error_handler. (Without it you end up calling the user error handler *lots* even if you

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: [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] 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 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

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] 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

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

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

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

Re: [PHP-DEV] Exceptions and Errors

2004-04-14 Thread Christian Schneider
Marcus Boerger wrote: As i explained there is no good other way to tell the user the ctor has failed. The two ways out out are: Personally I'd much prefer a way of returning a value from a constructor, i.e. to be able to 'return null;' or a similar language construct so I could do 'if ($db = new

Re: [PHP-DEV] Exceptions and Errors

2004-04-14 Thread Christian Schneider
Sterling Hughes wrote: Objects that have logic in a constructor throw exceptions - that's how it works. I disagree. There *are* options to this approach as has been pointed out earlier in this thread. - Chris -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit:

Re: [PHP-DEV] Exceptions and Errors

2004-04-14 Thread Christian Schneider
Marcus Boerger wrote: In no language i know (c++, delphi, java as the popular ones) a ctor First of all I'm a bit sad that you compare PHP with 'old' static OO languages, not 'modern' dynamic ones like Python or Ruby. Wrong focus IMHO. Second I don't think that's a very strong point: None of the

Re: [PHP-DEV] Exceptions and Errors

2004-04-13 Thread Christian Schneider
Derick Rethans wrote: Then they are abusing exceptions big time. Throwing exceptions for E_ERROR conditions *might* be a good idea, but for anything lower than that: no way. I agree wholeheartedly. Having worked with (Java) exceptions I realized that it is a _very_ hard instrument to use

Re: [PHP-DEV] Exceptions and Errors

2004-04-13 Thread Christian Schneider
Marcus Boerger wrote: 2) Use exceptions when a ctor needs to advertise its failure and in other places where exceptions are really usefull. ... and make the exception in the ctor an option, not the default IMHO. Too much exception is a bad thing anyway. Yes, it has to be a really severe error,

Re: [PHP-DEV] protected __call() question

2004-04-08 Thread Christian Schneider
Jochem Maas wrote: I'm happy to just remove the P and add it again if ever that becomes an option. Or go for the simpler option: Just don't use P. An addition to the documentation of __call saying that it has to be public makes sense though. The meaning of PPP on __call would be confusing

Re: [PHP-DEV] Patch to minimize session fixation (continued)

2004-04-07 Thread Christian Schneider
Inodes wrote: You guys are probably good programmers, but my experience shows me that the standard PHP developper is not aware of security problems or he/she has not the time to finalize the scripts (time is money...). The problem with your patch is twofold: 1) It breaks for some users under rare

Re: [PHP-DEV] Patch to minimize session fixation (continued)

2004-04-07 Thread Christian Schneider
Derick Rethans wrote: PHP's generated from remote ID, process id, time and some randomness; and then MD5'ed. That's 'better' then your random/MD5 based approach as it's even less likely to result in collisions. How can you tell without knowing what my source of random data is? And no, I'm not

Re: [PHP-DEV] php5 class initialization

2004-03-24 Thread Christian Schneider
Stanislav Malyshev wrote: By real world I don't mean you write up, I mean someone really needs it. You are defining language practice now. I think it's a bad practice to I found the example a bad one too but the more I think about it the more I believe that the language shouldn't stop you from

Re: [PHP-DEV] php5 class initialization

2004-03-23 Thread Christian Schneider
Rasmus Lerdorf wrote: I could see people doing: class foo { function foo() { ...constructor stuff... } function __construct() { $this-foo(); } } Why not just leave out __construct in this case? Or am I missing something? This looks pretty ugly to me. And if you

[PHP-DEV] Re: PHP5: Exception not correctly thown with __get, __set and __toString

2004-02-02 Thread Christian Schneider
Stephane Drouard wrote: The following code does not work as expected: I think it is a very good thing to test these things and I think it should be turned into phpt tests and added to the distribution. - Chris -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit:

Re: [PHP-DEV] dollars and sense.

2004-01-27 Thread Christian Schneider
Ken Tossell wrote: pps: don't use foo $bar blah -- use 'foo ' . $bar . ' blah'; or commas:) Why do you say this? I prefer foo $bar blah. - Chris -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php

Re: [PHP-DEV] base class

2004-01-27 Thread Christian Schneider
Stephane Drouard wrote: For sure I can't answer to your question, but why would you only implement it to construtors? That's where I think it is most needed. The other magic methods are already less important but if there is an agreement to this I could also whip a patch together for those. I

Re: [PHP-DEV] dollars and sense.

2004-01-27 Thread Christian Schneider
Andrei Zmievski wrote: On Tue, 27 Jan 2004, Christian Schneider wrote: Why do you say this? I prefer foo $bar blah. Because it's faster. Ok, that's interesting but irrelevant for most of my code. Readability is a higher priority in most cases. Thanks for pointing this out, - Chris -- PHP

Re: [PHP-DEV] base class

2004-01-25 Thread Christian Schneider
Stephane Drouard wrote: Implementing a common base class with empty methods (or Chris' proposal, just do not report error) does not impact performance (just don't call them), but allows people having a different view on programming to do it. Here's a little patch which changes Can not call

Re: [PHP-DEV] base class

2004-01-25 Thread Christian Schneider
Marcus Boerger wrote: I can very much understand the drive behind this whish. The patch consists of two parts. The first part is generating an error message in case no constructor is available. He uses E_NOTICE while i would prefer E_STRICT Both E_NOTICE or E_STRICT are fine with me. Whatever

[PHP-DEV] Re: base class

2004-01-22 Thread Christian Schneider
Stephane Drouard wrote: Currently it is not possible to call parent::__construct() if the class does not derived from another one, or none of its parent implements a constructor. I agree that it should always be possible to call parent::__construct() (at least if a base class exists :-)).

[PHP-DEV] Re: php 5 bug?

2004-01-22 Thread Christian Schneider
Nuno Lopes wrote: I don't know if this is a bug or a feature, but... The code below works with PHP 4, but gives an error in PHP 5. Classes have to be defined before they are used in PHP5. - Chris -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit:

Re: [PHP-DEV] base class

2004-01-22 Thread Christian Schneider
Marcus Boerger wrote: Well you design a class tree/framework and should know what you have done. If not use reflection. So to be able to later add a constructor to a base class one would be stuck with one of two options: 1) have __construct() in all classes from the start, even if it's empty.

[PHP-DEV] Re: [ZEND-ENGINE-CVS] cvs: ZendEngine2 / zend_API.c

2004-01-19 Thread Christian Schneider
Wez Furlong wrote: Even better would be to add an array of module names into the module structure and have the ZE apply this check when it loads the module. I think that it is reasonably important to warn the user that things will break if we can detect it. If there was an array of dependencies in

Re: [PHP-DEV] Re: [ZEND-ENGINE-CVS] cvs: ZendEngine2 / zend_API.c

2004-01-19 Thread Christian Schneider
Wez Furlong wrote: This is quite difficult to implement correctly, as the extension name != module file name, and that filename is platform dependent Hmm. Three passes should do the job: First DL_LOAD, then DL_FETCH_SYM to determine order of init then initialize the modules. Or am I missing

[PHP-DEV] Re: Casting of objects to array exports private/protected data

2004-01-18 Thread Christian Schneider
Andrey Hristov wrote: casting an object to array gives the possibility to get the values of protected/private member variables : IMO, when casting to array with (array) only the public-ly visible members should returned. Public/protected/private is there to protect you from bugs due to name

Re: [PHP-DEV] SPL

2004-01-18 Thread Christian Schneider
Andrei Zmievski wrote: SPL, SPL. SPL? SPL! SPL, SPPP. Bonus points if you recognize the movie reference. Being John Malkovich :-) - Chris -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php

Re: [PHP-DEV] SimpleXML: Moving Forward

2004-01-16 Thread Christian Schneider
Marcus Boerger wrote: Just a node: The thing you saw required SXE objects implementing interface RecursiveIterator{reset(), hasMore(), key(), current(), next(), hasChildren(), getChildren()} Excuse my ignorance: As I wasn't at ApacheCon I'm not sure what Adam was talking about, is the

Re: [PHP-DEV] __toString() with strval() and settype()

2004-01-16 Thread Christian Schneider
Adam Maccabee Trachtenberg wrote: Anyone else care to chime in here? If we're really moving to RC1, I So to summarize that'd be echo, print, (string), strval() and settype() using __toString(), right? Sounds +1 to me. Right now strval() and settype() don't call __toString() but exit() does. -

Re: [PHP-DEV] SimpleXML: Moving Forward

2004-01-15 Thread Christian Schneider
Marcus Boerger wrote: Thanks for moving backward. Since iterating is now worthless i am all for removing it completley. I mean it isn't even in the spirit of the extension. Care to explain? I'm dazed and confused on how you came to the conclusion that iterators are now worthless... Was this

Re: [PHP-DEV] SimpleXML: Moving Forward

2004-01-13 Thread Christian Schneider
Rob Richards wrote: From: Adam Maccabee Trachtenberg accessing the text node children of an element is akin to object properties ($foo-bar); the syntax of accessing attributes is akin to array elements ($foo['bar']). Hmm... This is somewhat up-side-down language wise. Attributes are

Re: [PHP-DEV] SimpleXML: Moving Forward

2004-01-13 Thread Christian Schneider
Adam Trachtenberg wrote: Ugh. This is pretty much the limit of what I think is reasonable for SimpleXML to handle. It think the API would be more consistent if the Agreed. I was just curious how it behaves if I push it to the limit :-) However, I don't really see any way around this otherwise.

Re: [PHP-DEV] SimpleXML: Moving Forward

2004-01-13 Thread Christian Schneider
Adam Maccabee Trachtenberg wrote: Don't do that. Use the schema. :) Is that why it's called SimpleXML? ;-) I don't think one should force people to use schemata for now. Unless, of course, you're not in control over those documents. You can simply wrap it when passing it to SimpleXML, e.g.

<    1   2   3   4   5   6   >