Re: [PHP-DEV] Patch-tastic!
Am Mittwoch, 5. Juni 2002 10:44 schrieb Ilker Cetinkaya: Nice, but why not overload + for strings to do the concatenation? i totally agree, overloading + for string concat is really desireable. No, it is a nightmare. PHP is a dynamically typed language, that is, the actual language objects know their type, while object names (variable identifiers) are untyped. Also, PHP automatically changes types of language objects as needed. Consequently, most developers do not know the actual type of their variables (it is not seen anywhere unless you specifically ask for it), and most of the time they don't actually care for it. For example, when was the last time you noticed or even cared that all arguments of your program (_GET, _POST, _COOKIE) are actually string type, even if they are pure numeric strings? Overloading + would suddenly require that developers care about type, and would force them to write expressions like $c = $a . $b; as $c = (string) $a + (string) $b; just to make sure. Not actually an improvement. This actually a deeper problem, as we have seen in the last few discussions here on the list. PHP may remotely resemble C, C++ or even Java. It isn't. And it isn't intended to be. If you treat it like any of these statically typed, compiled, and far more traditional languages, you bleed. Big time. Actually, I believe that Javascript has the programming and execution model that comes closest to PHP of all the C lookalike languages. Kristian -- PHP Development Mailing List http://www.php.net/ To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DEV] Re: Patch-tastic!
Am Mittwoch, 5. Juni 2002 16:41 schrieb Jason T. Greene: If '+' concatenates what does '-' do? It drives you nuts. At least it does so in pike, which is a (discretionary, it has a type mixed) statically typed language and overloads the arithmetic operators for string types. See http://pike.roxen.com/documentation/tutorial/tutorial_5.html#5.1 for the full details. Here is the relevant excerpt: operands: string + string return type: string In this case, any int or float is first converted to a string. Then the two strings are concatenated and the resulting string is returned. operands: string - string return type: string A copy of the left string with all occurrences of the right string removed. operands: array(string) * string return type: string All the strings in the array are concatenated with the string on the right in between each string. Example: ({foo,bar})*- will return foo-bar. operands: string / string return type: array(string) In symmetry with the multiplication operator, the division operator can split a string into pieces. The right string will be split at every occurrence of the right string and an array containing the results will be returned. Example: foo-bar/- will return ({foo,bar}) Now if you would kindly look up the overloaded operator definitions for arrays and hashes (called mappings in pike) and after that retire to a secluded place _before_ you vomit? Thank you, Kristian -- PHP Development Mailing List http://www.php.net/ To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DEV] Re: Bug #16747 Updated: Empty file upload field results in No file uploaded in Unknown on line 0 warn
Hello, Jani, I don't quite understand this too why we really need a php_error() here when no file is uploaded at all? IMHO there's nothing wrong with it. Other opinions ? - Markus On Thu, Jun 06, 2002 at 08:06:29AM -, [EMAIL PROTECTED] wrote : ID: 16747 Updated by: [EMAIL PROTECTED] Reported By: [EMAIL PROTECTED] Status: Bogus Bug Type: Output Control Operating System: Windows 2000 SP2, Apache 1.3.22 PHP Version: 4.2.0 New Comment: If the development of PHP were a democracy (and it's not far off, I reckon :), I would vote (and maybe even campaign) to have this notice removed. Whether or not the user chooses to upload a file or is required to is a matter of application design and the sole responsibilty of the developer to address. What if a file upload is designed to optional? Why do I need to change the error reporting level on the server in order to suppress on Notice that is if fact completely useless to both the developer and the user. What benefit is it to the developer or the administrator to have notice in the logs that the user did not upload a file in a provided file box? I vote to drop the Notice and let it go. Irik Previous Comments: [2002-04-23 18:29:00] [EMAIL PROTECTED] Not a bug but expected behaviour. It's changed to E_NOTICE level now in CVS (for both HEAD and upcoming 4.2.1 release) Just set your error_reporting level. --Jani [2002-04-23 06:24:28] [EMAIL PROTECTED] maybe this is only a config issue in php.ini test.htm: html body FORM METHOD=POST ACTION=test.php NAME=form enctype=multipart/form-data INPUT TYPE=file NAME=admin_field_image_big_row1 MAXLENGTH=102400 SIZE=5 ACCEPT=image/* input type=submit name=submit value=test /form /body /html test.php ?php foreach( $GLOBALS[ HTTP_POST_VARS ] as $sName = $sValue ) echo $sName = $sValuebr; ? -- Outputs warning No file uploaded in Unknown on line 0 Thanks, Rasty -- Edit this bug report at http://bugs.php.net/?id=16747edit=1 -- GnuPG Key: http://guru.josefine.at/~mfischer/C2272BD0.asc -- PHP Development Mailing List http://www.php.net/ To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DEV] Re: Bug #16747 Updated: Empty file upload field results in No file uploaded in Unknown on line 0 warn
Hi, forget it. Stefan has informed me that this is fixed in CVS. - Markus On Thu, Jun 06, 2002 at 10:26:25AM +0200, Markus Fischer wrote : Hello, Jani, I don't quite understand this too why we really need a php_error() here when no file is uploaded at all? IMHO there's nothing wrong with it. Other opinions ? - Markus On Thu, Jun 06, 2002 at 08:06:29AM -, [EMAIL PROTECTED] wrote : ID: 16747 Updated by: [EMAIL PROTECTED] Reported By: [EMAIL PROTECTED] Status: Bogus Bug Type: Output Control Operating System: Windows 2000 SP2, Apache 1.3.22 PHP Version: 4.2.0 New Comment: If the development of PHP were a democracy (and it's not far off, I reckon :), I would vote (and maybe even campaign) to have this notice removed. Whether or not the user chooses to upload a file or is required to is a matter of application design and the sole responsibilty of the developer to address. What if a file upload is designed to optional? Why do I need to change the error reporting level on the server in order to suppress on Notice that is if fact completely useless to both the developer and the user. What benefit is it to the developer or the administrator to have notice in the logs that the user did not upload a file in a provided file box? I vote to drop the Notice and let it go. Irik Previous Comments: [2002-04-23 18:29:00] [EMAIL PROTECTED] Not a bug but expected behaviour. It's changed to E_NOTICE level now in CVS (for both HEAD and upcoming 4.2.1 release) Just set your error_reporting level. --Jani [2002-04-23 06:24:28] [EMAIL PROTECTED] maybe this is only a config issue in php.ini test.htm: html body FORM METHOD=POST ACTION=test.php NAME=form enctype=multipart/form-data INPUT TYPE=file NAME=admin_field_image_big_row1 MAXLENGTH=102400 SIZE=5 ACCEPT=image/* input type=submit name=submit value=test /form /body /html test.php ?php foreach( $GLOBALS[ HTTP_POST_VARS ] as $sName = $sValue ) echo $sName = $sValuebr; ? -- Outputs warning No file uploaded in Unknown on line 0 Thanks, Rasty -- Edit this bug report at http://bugs.php.net/?id=16747edit=1 -- GnuPG Key: http://guru.josefine.at/~mfischer/C2272BD0.asc -- PHP Development Mailing List http://www.php.net/ To unsubscribe, visit: http://www.php.net/unsub.php -- GnuPG Key: http://guru.josefine.at/~mfischer/C2272BD0.asc Did I help you?http://guru.josefine.at/wish_en Konnte ich helfen? http://guru.josefine.at/wish_de -- PHP Development Mailing List http://www.php.net/ To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DEV] How do I access a hash from an extention/module?
You can fech the zval * for _SESSION from the EG(symbol_table), e.g. something like this (untested): zval **z_sess; if (zend_hash_find(EG(symbol_table), _SESSION, sizeof(_SESSION)-1, (void**)z_sess) == SUCCESS) { ... } Try something like cd php4/ext rgrep 'EG(symbol_table)' * to get an idea how it's done. - Markus On Thu, Jun 06, 2002 at 11:14:32AM +0200, [EMAIL PROTECTED] wrote : I have posted this message before to the general list, but it seems nobody there can help me so I hope someone here might know... I am a bit stuck right now, I want to access the values of a global hash (actually it is a session variable) from within my PHP extention/module. So I want to be able to see which keys are defined in a hash, and what the corresponding value in this hash is for each key. Could someone please give me a small example how this is done? I have looked in the source code of the other extentions but I couldn't find anything that could be of any help (I might have missed it though). -- #!perl # Life ain't fair, but root passwords help. # Eric Veldhuyzen [EMAIL PROTECTED] $!=$;=$_+(++$_);($:,$~,$/,$^,$*,$@)=$!=~ # Perl Monger /.(.)...(.)(.)(.)..(.)..(.)/;`$^$~$/$: $^$*$@$~ $_$;` -- PHP Development Mailing List http://www.php.net/ To unsubscribe, visit: http://www.php.net/unsub.php -- GnuPG Key: http://guru.josefine.at/~mfischer/C2272BD0.asc Did I help you?http://guru.josefine.at/wish_en Konnte ich helfen? http://guru.josefine.at/wish_de -- PHP Development Mailing List http://www.php.net/ To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DEV] How do I access a hash from an extention/module?
On Thu, Jun 06, 2002 at 11:27:06AM +0200, Markus Fischer wrote: You can fech the zval * for _SESSION from the EG(symbol_table), e.g. something like this (untested): zval **z_sess; if (zend_hash_find(EG(symbol_table), _SESSION, sizeof(_SESSION)-1, (void**)z_sess) == SUCCESS) { ... } Well, this doesn't work. The _SESSION thing is something of another ext module (the session module), and I haven't been able to access anything from that directly. But I have worked around that, I can simply check whether a variable is registered in a session by calling the session_is_registered function from the session module (by using the call_user_function_ex() function). I don't think it is very pretty, but it works... Normal variables can then be fetched by using this zend_hash_find() function. But if it is an array or a hash the zend_hash_find function fails. I've got no idea why. And even if it would work I would still have no clue about how the access the key/value pairs in this array/hash. It would be nice it there was some REAL documentation about the API... -- #!perl # Life ain't fair, but root passwords help. # Eric Veldhuyzen [EMAIL PROTECTED] $!=$;=$_+(++$_);($:,$~,$/,$^,$*,$@)=$!=~ # Perl Monger /.(.)...(.)(.)(.)..(.)..(.)/;`$^$~$/$: $^$*$@$~ $_$;` -- PHP Development Mailing List http://www.php.net/ To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DEV] Patch-tastic!
[ I copy this to php-dev again, despite the fact that Ilker sent this to me in private mail, because I want to promote the concept of warnings for named accesses to _-members again. Privacy in C++/Java style will raise a lot of issues on this list again, if it is introduced to PHP. My proposal will have less syntactial impact, and will better blend with the general style of the language at this time. ] Am Donnerstag, 6. Juni 2002 11:58 schrieb Ilker Cetinkaya: know how objects and inheritance is done in javascript (ecma respectively?). have you ever seen private members on objects of js? In Javascript, each object is it's own class. You create new objects basically by duplicating some initial object, that is, Javascript's new is actually a clone. This is conceptually close to what PHP 4 does, where you can have preinitialized member variables in an object, and where you can at runtime add member variables to an object (and you could for a short time even add member functions thanks to Andrej, I believe). PHP 4 deviates from (I would even say obscures this) by not having an explicit clone operator (but PHP 4 implicitly clones every time due to unexpected value-semantics). Regarding the concept of private: Private member variables and private member functions are a nuisance anyway in a language where you can add members to an object at runtime. Also, in it's wake the concept of private introduces a lot of syntactic complexity as well, such as the need for protected variables and functions, and a friend relationship between classes. You will immediately see discussions around this issue once privacy is introduced. In Javascript-like languages, the same effect can be had by simply issuing a warning whenever accessing a member variable or member function with a name starting with _ through a named variable. That is, you would see warnings for $a-_private_slot = 10; $b = $a-_private_slot; $c = $a-_private_function(); but not when accessing the same internally using $this: $this-_private_slot = 10; $b = $this-_private_slot; $c = $this-_private_function(); A coder that must access private member variables and member functions through a named variable (and there are a lot of legitimate reasons for this, namely all metaprogramming applications including debuggers, rpc proxies, serializers and the like) can easily shut of this warning: $a-_private_slot = 10; $b = $a-_private_slot; $c = $a-_private_function(); will all execute warning-free, and clearly mark these statements as violating the encapsulation-contract of conventional OO programming, the same way a type-cast marks a violation of the typing contract in C, C++ or other statically typed languages (and there are a lot of legit reasons for that, too). This implementation of private has several advantages, one of them being that it is elective, another of them being that it is the minimal syntactic extension of current PHP, and a third of them being that it is compatible with current PEAR. namespaces? statics? consts? These concepts do not contradict a dynamically (this is different from loosely!) typed language concept. in closing, i have to admit that such a change would be a big issue in aspects of compatibility, juggling, parsing and object handling. therefore i'm sure it's not going to be realized. but still i'd desire it. just to be more stricty. I suggest you try Java. You seem to want it. Kristian -- PHP Development Mailing List http://www.php.net/ To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DEV] Introducing EXCPLICIT
i'd like to discuss with you a growing problem regarding php applications. i see the features taken into account for ze2 have been made regarding the needs of advanced php developers who design complete applications with php instead of just dumping out some dynamic content. php is ease of use because you don't have to care about important language needs like types. that makes following code possible $a = hello u ; $b = 2; echo $a.$b; imho that is a good feature for coding simple things fast from brain to keys. however in a more complicated and larger context, as in frameworks and libraries for example, this leads the coder to produce more code to get the things bugfree. consider a function inserting a row into a table with id and name: function ins($id, $name) { if (is_numeric($id) is_string($name)) { // do insert return true; } return false; } through loose typing a value of $id = 1 (note whitespace) is possible and insert would fail. no problem, extending condition to is_numeric(trim($id)) does it. anyways, a value of $name=444 causes failing this condition too, although it should be dyncasted into a string. instead consider this: bool function ins(int $id, string name) { //do insert return true; } and everything is right. what i want to point out is the loose vs. strong type issue - certainly discussed prior this post. i'd like to propose the introduction of an explicit command for ze2 to resolve this issue. as known of vb for example, explicit forces coder to explicitly declare variables. this would require to be explicit as a language directive or option. example: #!php --explicit (or something similar, perhaps a php.ini entry) mixed $mixed = hello; string $str = string; int $num = 5; bool $ok = false; array $ar; float $rate; bool function ins(int $id, string $name); class test { private bool $done; //private var string $name; //public; private object $o; string print() { return $name; } } object $o = new test(); echo $o-print(); i don't have any clue about implications regarding parsing and handling such explicit behaviour, especially considering type juggling, but juggling could be disabled when explicit is turned on. is there a chance to realize this ? and moreover, is this a desired, planned feature ? i'd welcome this just my 2c; ilker -- PHP Development Mailing List http://www.php.net/ To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DEV] CVS Account Request: progcom
Translating the documentation to Korean. -- PHP Development Mailing List http://www.php.net/ To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DEV] Re: [PHP-EVANGELISM] ANN: QA Evangelism Call to Arms @ LinuxTag
When everyone gets into linuxtag, we can work out the best time for a meeting and take it from there, i think. -- james ___ This mail sent using V-webmail - http://www.v-webmail.co.uk -- PHP Development Mailing List http://www.php.net/ To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DEV] bug in domxml_get_element_by_id
Recently the function domxml_get_element_by_id was changed from using an xpath query //*[@ID = '%s'] to actually using the ID hash from the DTD, which makes perfect sense. But for the following string: !DOCTYPE doc [ !ATTLIST child id ID #REQUIRED ] doc child id=2foo/child child id=4 entryfoo/entry titlehey there/title /child /doc I get for $xml-ids() a list nodeset of 2 nodes, but nothing for $xml-get_element_by_id(4); Broken? Dan -- Daniel Allen, [EMAIL PROTECTED] http://www.mojavelinux.com/ Real programmers don't change their wardrobe too often: there are no clothes stores that are open at two o'clock in the morning. -- PHP Development Mailing List http://www.php.net/ To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DEV] Linuxtag Coordination
I will be at Linuxtag on Sunday. I will have a cellphone. The number is +49 170 2231 811. I will not have net access. You need to summon me by phone (or by calling my name thrice while standing in a properly ornamented pentagram). Kristian -- PHP Development Mailing List http://www.php.net/ To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DEV] Bundled gdlib
I think it would be the best if we changed config option from --with-gd=php to just --with-gd when we want to use bundled gdlib. Edin -- PHP Development Mailing List http://www.php.net/ To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DEV] How do I access a hash from an extention/module?
It would be nice it there was some REAL documentation about the API... Amen to that!!!.. I spent exactely 5 1/2 hours yesterday trying to create a resource that is a structure which contains a set of pointers to an array of objects (yeah it's complicated but it's great when it works !), then later retrieve the array, walk throught it, get the objects back from the hash, and do something with them. Works fine for now (although i'm sure i have major memory leaks for now because i'm not sure how to deallocate and when to do it, when to add references and remove references), but some documentation would have reduced my research, trial and error, multiple compilations, tests, other source reading, debugging time, etc.. I get great help from people here on specific issues, but i'd rather read some documentation before asking stupid questions. Fab. -- PHP Development Mailing List http://www.php.net/ To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DEV] How do I access a hash from an extention/module?
On Thu, Jun 06, 2002 at 09:36:29AM -0400, fabwash wrote : It would be nice it there was some REAL documentation about the API... Amen to that!!!.. I spent exactely 5 1/2 hours yesterday trying to create a resource that is a structure which contains a set of pointers to an array of objects (yeah it's complicated but it's great when it works !), then later retrieve the array, walk throught it, get the objects back from the hash, and do something with them. Works fine for now (although i'm sure i have major memory leaks for now because i'm not sure how to deallocate and when to do it, when to add references and remove references), but some documentation would have reduced my research, trial and error, multiple compilations, tests, other source reading, debugging time, etc.. I get great help from people here on specific issues, but i'd rather read some documentation before asking stupid questions. Actually, there is: http://www.php.net/manual/en/zend.php Not up-to-date, but still worth a read. And, it's the same for Zend docs as it is for PHP docs: volunteers are welcome. I've seen quite a few people in the last months writing extenions and therefore they know how it is for a newcommer. Yet no one asked if he can help out with the documentation. - Markus -- GnuPG Key: http://guru.josefine.at/~mfischer/C2272BD0.asc -- PHP Development Mailing List http://www.php.net/ To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DEV] How do I access a hash from an extention/module?
Hi Markus, I think I know those pages by heart :) Doesn't mean they all make sense to me for now. I'm sure that when I get some experience I will find that they make a lot of sense, and that each word should give me a clue, but this is a high level overview of the API, what we need is a real documentation, for each callable function and macro, what are the parameters, what the macro or function does, what it returns, make examples etc.. Zend/zend_hash.c, Zend/zend_API.h and ext/array.c are my bibles for now, but as I said before, although it works, i'm not sure why it works :) The few examples available are about creating basic things, like creating a long, or a string. When you start working on an extension, this is definitely not sufficient. I'll definitely help on the documentation when I get the light, but i'm way out of the league for now. Fab - Original Message - From: Markus Fischer [EMAIL PROTECTED] To: fabwash [EMAIL PROTECTED] Cc: Eric Veldhuyzen [EMAIL PROTECTED]; [EMAIL PROTECTED] Sent: Thursday, June 06, 2002 9:45 AM Subject: Re: [PHP-DEV] How do I access a hash from an extention/module? On Thu, Jun 06, 2002 at 09:36:29AM -0400, fabwash wrote : It would be nice it there was some REAL documentation about the API... Amen to that!!!.. I spent exactely 5 1/2 hours yesterday trying to create a resource that is a structure which contains a set of pointers to an array of objects (yeah it's complicated but it's great when it works !), then later retrieve the array, walk throught it, get the objects back from the hash, and do something with them. Works fine for now (although i'm sure i have major memory leaks for now because i'm not sure how to deallocate and when to do it, when to add references and remove references), but some documentation would have reduced my research, trial and error, multiple compilations, tests, other source reading, debugging time, etc.. I get great help from people here on specific issues, but i'd rather read some documentation before asking stupid questions. Actually, there is: http://www.php.net/manual/en/zend.php Not up-to-date, but still worth a read. And, it's the same for Zend docs as it is for PHP docs: volunteers are welcome. I've seen quite a few people in the last months writing extenions and therefore they know how it is for a newcommer. Yet no one asked if he can help out with the documentation. - Markus -- GnuPG Key: http://guru.josefine.at/~mfischer/C2272BD0.asc -- PHP Development Mailing List http://www.php.net/ To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DEV] How do I access a hash from an extention/module?
On Thu, Jun 06, 2002 at 03:45:08PM +0200, Markus Fischer wrote: On Thu, Jun 06, 2002 at 09:36:29AM -0400, fabwash wrote : It would be nice it there was some REAL documentation about the API... Amen to that!!!.. I spent exactely 5 1/2 hours yesterday trying to create a resource that is a structure which contains a set of pointers to an array of objects (yeah it's complicated but it's great when it works !), then later retrieve the array, walk throught it, get the objects back from the hash, and do something with them. Works fine for now (although i'm sure i have major memory leaks for now because i'm not sure how to deallocate and when to do it, when to add references and remove references), but some documentation would have reduced my research, trial and error, multiple compilations, tests, other source reading, debugging time, etc.. I get great help from people here on specific issues, but i'd rather read some documentation before asking stupid questions. Actually, there is: http://www.php.net/manual/en/zend.php I've read that. Multiple times. But it is hardly anything close to real documentation. Claiming that this is real documentation is like explaining how to write a 'hello world' program in C is real documateion about how to write real programs in C. It is a nice primer, but nothing more than that. It explains how to werite a VERY basic extention and then stops. Not my idea of real documentation. I would settle for a small summary of all the functions one might want to call, with a short description of its function and the parameters it acceepts. That would be terrific. I've seen quite a few people in the last months writing extenions and therefore they know how it is for a newcommer. Yet no one asked if he can help out with the documentation. To write documentation you first have to know how it works. And I am nowhere near that. I have written some code that seems to work, but since none of tha parameters are described and there is hardly any comment in de PHP source code it is very hard to be able to understand how it all works. -- #!perl # Life ain't fair, but root passwords help. # Eric Veldhuyzen [EMAIL PROTECTED] $!=$;=$_+(++$_);($:,$~,$/,$^,$*,$@)=$!=~ # Perl Monger /.(.)...(.)(.)(.)..(.)..(.)/;`$^$~$/$: $^$*$@$~ $_$;` -- PHP Development Mailing List http://www.php.net/ To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DEV] How do I access a hash from an extention/module?
On Thu, Jun 06, 2002 at 09:36:29AM -0400, fabwash wrote: It would be nice it there was some REAL documentation about the API... Amen to that!!!.. I spent exactely 5 1/2 hours yesterday trying to create a resource that is a structure which contains a set of pointers to an array of objects (yeah it's complicated but it's great when it works !), then later retrieve the array, walk throught it, get the objects back from the hash, and do something with them. Well, I think you might be able to help me then. I want to retrieve an array and walk throught it. Should be pretty simple, right? I get great help from people here on specific issues, but i'd rather read some documentation before asking stupid questions. Exactly. -- #!perl # Life ain't fair, but root passwords help. # Eric Veldhuyzen [EMAIL PROTECTED] $!=$;=$_+(++$_);($:,$~,$/,$^,$*,$@)=$!=~ # Perl Monger /.(.)...(.)(.)(.)..(.)..(.)/;`$^$~$/$: $^$*$@$~ $_$;` -- PHP Development Mailing List http://www.php.net/ To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DEV] Newbie question about building GD...
Hi ng! I was wondering if anyone had a howto for compiling gd2.0.1 on Win32? I have managed to get the CGI and two SAPI modules to compile, and have even managed to get a couple of simple extensions (simple cos I managed to get them to compile!) such as sockets and win32api to build, but gd seems to be in a different league... any help gratefully received. Mikey -- PHP Development Mailing List http://www.php.net/ To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DEV] How do I access a hash from an extention/module?
Well, I think you might be able to help me then. I want to retrieve an array and walk throught it. Should be pretty simple, right? Think of which PHP functions do this and go have a look. Basically think of how you do it in PHP at the low level. You would do something like this: reset($arr); while($val=current($arr)) { $key = key($arr); ... do something with $key and $val ... next($arr); } Now, obviously this has a slight problem of $val evaluating to false, but it is more to explain the steps. Now here is the C equivalent: zval **arr,**val; char *key; ulong num_key; HashTable *target_hash; HashPosition pos; target_hash = HASH_OF($arr); zend_hash_internal_pointer_reset_ex(target_hash, pos); while(zend_hash_get_current_data_ex(target_hash, (void **)val, pos) == SUCCESS) { type = zend_hash_get_current_key_ex(target_hash, string_key, str_key_len, num_key, 0, pos); // type will be HASH_KEY_IS_STRING for a string key, and string_key/str_key_len are set // or type will be HASH_KEY_IS_LONG and num_key will be set // Now you have a normal zval** with the value and the key in either of string_key or num_key zend_hash_move_forward_ex(target_hash, pos); } That's all. -Rasmus -- PHP Development Mailing List http://www.php.net/ To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DEV] How do I access a hash from an extention/module?
Yes, that's basically what I sent him as an example. I think the ext/standard/array.c is a good place to look for this information too. Fab. - Original Message - From: Rasmus Lerdorf [EMAIL PROTECTED] To: Eric Veldhuyzen [EMAIL PROTECTED] Cc: fabwash [EMAIL PROTECTED]; Markus Fischer [EMAIL PROTECTED]; [EMAIL PROTECTED] Sent: Thursday, June 06, 2002 10:26 AM Subject: Re: [PHP-DEV] How do I access a hash from an extention/module? Well, I think you might be able to help me then. I want to retrieve an array and walk throught it. Should be pretty simple, right? Think of which PHP functions do this and go have a look. Basically think of how you do it in PHP at the low level. You would do something like this: reset($arr); while($val=current($arr)) { $key = key($arr); ... do something with $key and $val ... next($arr); } Now, obviously this has a slight problem of $val evaluating to false, but it is more to explain the steps. Now here is the C equivalent: zval **arr,**val; char *key; ulong num_key; HashTable *target_hash; HashPosition pos; target_hash = HASH_OF($arr); zend_hash_internal_pointer_reset_ex(target_hash, pos); while(zend_hash_get_current_data_ex(target_hash, (void **)val, pos) == SUCCESS) { type = zend_hash_get_current_key_ex(target_hash, string_key, str_key_len, num_key, 0, pos); // type will be HASH_KEY_IS_STRING for a string key, and string_key/str_key_len are set // or type will be HASH_KEY_IS_LONG and num_key will be set // Now you have a normal zval** with the value and the key in either of string_key or num_key zend_hash_move_forward_ex(target_hash, pos); } That's all. -Rasmus -- PHP Development Mailing List http://www.php.net/ To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Development Mailing List http://www.php.net/ To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DEV] Re: Introducing EXCPLICIT
I seem to remember strong typing being brought up before, and I also seem to remember it being shot down. The consensus seemed to be if you want a strongly-typed language, use Java. Or C. Or C++. Or something other than PHP that has strong data typing. Have things changed since then? J Ilker Cetinkaya wrote: i'd like to discuss with you a growing problem regarding php applications. i see the features taken into account for ze2 have been made regarding the needs of advanced php developers who design complete applications with php instead of just dumping out some dynamic content. php is ease of use because you don't have to care about important language needs like types. that makes following code possible $a = hello u ; $b = 2; echo $a.$b; imho that is a good feature for coding simple things fast from brain to keys. however in a more complicated and larger context, as in frameworks and libraries for example, this leads the coder to produce more code to get the things bugfree. consider a function inserting a row into a table with id and name: function ins($id, $name) { if (is_numeric($id) is_string($name)) { // do insert return true; } return false; } through loose typing a value of $id = 1 (note whitespace) is possible and insert would fail. no problem, extending condition to is_numeric(trim($id)) does it. anyways, a value of $name=444 causes failing this condition too, although it should be dyncasted into a string. instead consider this: bool function ins(int $id, string name) { //do insert return true; } and everything is right. what i want to point out is the loose vs. strong type issue - certainly discussed prior this post. i'd like to propose the introduction of an explicit command for ze2 to resolve this issue. as known of vb for example, explicit forces coder to explicitly declare variables. this would require to be explicit as a language directive or option. example: #!php --explicit (or something similar, perhaps a php.ini entry) mixed $mixed = hello; string $str = string; int $num = 5; bool $ok = false; array $ar; float $rate; bool function ins(int $id, string $name); class test { private bool $done; //private var string $name; //public; private object $o; string print() { return $name; } } object $o = new test(); echo $o-print(); i don't have any clue about implications regarding parsing and handling such explicit behaviour, especially considering type juggling, but juggling could be disabled when explicit is turned on. is there a chance to realize this ? and moreover, is this a desired, planned feature ? i'd welcome this just my 2c; ilker -- PHP Development Mailing List http://www.php.net/ To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DEV] Re: Introducing EXCPLICIT
thank you for your reply, i'll change to c# as soon as i've finished my current projects. regards, ilker J Smith [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... I seem to remember strong typing being brought up before, and I also seem to remember it being shot down. The consensus seemed to be if you want a strongly-typed language, use Java. Or C. Or C++. Or something other than PHP that has strong data typing. Have things changed since then? J Ilker Cetinkaya wrote: i'd like to discuss with you a growing problem regarding php applications. i see the features taken into account for ze2 have been made regarding the needs of advanced php developers who design complete applications with php instead of just dumping out some dynamic content. php is ease of use because you don't have to care about important language needs like types. that makes following code possible $a = hello u ; $b = 2; echo $a.$b; imho that is a good feature for coding simple things fast from brain to keys. however in a more complicated and larger context, as in frameworks and libraries for example, this leads the coder to produce more code to get the things bugfree. consider a function inserting a row into a table with id and name: function ins($id, $name) { if (is_numeric($id) is_string($name)) { // do insert return true; } return false; } through loose typing a value of $id = 1 (note whitespace) is possible and insert would fail. no problem, extending condition to is_numeric(trim($id)) does it. anyways, a value of $name=444 causes failing this condition too, although it should be dyncasted into a string. instead consider this: bool function ins(int $id, string name) { //do insert return true; } and everything is right. what i want to point out is the loose vs. strong type issue - certainly discussed prior this post. i'd like to propose the introduction of an explicit command for ze2 to resolve this issue. as known of vb for example, explicit forces coder to explicitly declare variables. this would require to be explicit as a language directive or option. example: #!php --explicit (or something similar, perhaps a php.ini entry) mixed $mixed = hello; string $str = string; int $num = 5; bool $ok = false; array $ar; float $rate; bool function ins(int $id, string $name); class test { private bool $done; //private var string $name; //public; private object $o; string print() { return $name; } } object $o = new test(); echo $o-print(); i don't have any clue about implications regarding parsing and handling such explicit behaviour, especially considering type juggling, but juggling could be disabled when explicit is turned on. is there a chance to realize this ? and moreover, is this a desired, planned feature ? i'd welcome this just my 2c; ilker -- PHP Development Mailing List http://www.php.net/ To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DEV] Performance of Apache 2.0 Filter
A user posted [1] a benchmark today in the German PHP Newsgroup [2] stating that Apache 2.0 and PHP (current HEAD) are about 20% slower than Apache 1.3. Are there any official benchmarks out there? I can't quite believe this... -- [1] Message-ID: [EMAIL PROTECTED] [2] news:de.comp.lang.php -- Sebastian Bergmann http://sebastian-bergmann.de/ http://phpOpenTracker.de/ Did I help you? Consider a gift: http://wishlist.sebastian-bergmann.de/ -- PHP Development Mailing List http://www.php.net/ To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DEV] PHP in the future
Ok I know this email has been posted again and again. But lets look at this objectivly. PHP was designed for the web. It's perfect in alot of ways for that market. Maybe we can shift the focus of php from the web to application development. Again i know this has been discussed and been shot down for different reasons. But how about this. PHP For Applications.. pretty much use the same code base. But we introduce stuff like typed variables, Case Sensivive, Greater OO support private methods, interfaces, operator overloading. I know changing these things for what php is aim'd for now doesn't make much sence but obviously people like php alot and want to see it be used for far greater things than just web development. Introducing a new distrubiton wont have any BC issues cause it's new. Introducing a new distrubiton will be confusing for some people. Please don't reply to this email saying Use Java... Because php is different than java and always will be even with these new features. PHP can be a soulition for serious application developers with some changes. The code base for it is already there. - Brad __ Do You Yahoo!? Yahoo! - Official partner of 2002 FIFA World Cup http://fifaworldcup.yahoo.com -- PHP Development Mailing List http://www.php.net/ To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DEV] Re: [Zend Engine 2] PHP in the future
At 07:01 PM 6/6/2002, brad lafountain wrote: Please don't reply to this email saying Use Java... Because php is different than java and always will be even with these new features. Brad, I beg you, there's nothing anybody can say on this list that would lead this to closure. Nothing. I believe that adding the things you mentioned does indeed turn PHP into Java, just a messy Java, Java which is worse at being Java than the real one is, and torn apart when compared against it. Many others feel the same way. You don't think that way, and I respect it, and there are also others who feel the same way too. If you, or others, want to take PHP into that direction - non-web-centric, more complicated language - it's your right, and you can do it outside the scope of PHP (or fork). I believe it's a bad thing for PHP (both having these patches in general and forking), but you don't necessarily share this belief. There's one thing that is clear to me - there's no way to 'find a solution', because we don't, at all, agree about the existence of the problem. If you believe these features belong in PHP and that it should import all (or most) of Java's features, we (and many others) have a fundamental gap in our perception of what PHP should be, and how it can stay competitive. Zeev -- PHP Development Mailing List http://www.php.net/ To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DEV] Performance of Apache 2.0 Filter
On Thu, Jun 06, 2002 at 09:05:16AM -0700, Rasmus Lerdorf wrote: A user posted [1] a benchmark today in the German PHP Newsgroup [2] stating that Apache 2.0 and PHP (current HEAD) are about 20% slower than Apache 1.3. Are there any official benchmarks out there? I can't quite believe this... It doesn't really surprise me. The bucket brigade stuff adds overhead as does the thread stuff in PHP. There is nothing inherently faster about threaded apps. They tend to scale a little bit better in most cases, so under extreme load performance should be better. But under light loads I would expect a non-threaded Apache+PHP to be quicker. Right, so I'd expect (hope) that at low load the performance is still reasonably fast, but at high concurrency and high load it still performs. Another thing that is gained in the new Apache 2.0 multithreaded architecture is memory conservation -- I've run a 500-thread system on under 20MB resident memory. Under Apache 1.3 that would require hundreds of MB of memory. -aaron -- PHP Development Mailing List http://www.php.net/ To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DEV] Re: Introducing EXCPLICIT
I wouldn't take my opinion as law, as I'm not part of the core PHP Group or anything, so I don't speak for anyone but myself. All I'm saying is that I seem to remember this issue being brought up before, and the result was that PHP is not a strong typed language, and probably won't become one any time soon. A couple of weeks ago the discussion kind of stirred up again with the idea of string types. You can sort of do your own data type checks now using is_int(), is_array(), etc., which although falls short of true strong typing, is better than nothing. If you want to move to C#, super. Use the tool that fits the job. But I hope to hell you aren't doing it just 'cause I sent you a reply on a newsgroup that you didn't like. Personally, I wouldn't mind a slightly stronger typed PHP (at least for function arguments) as long as BC and portability were maintained and it was totally optional. J Ilker Cetinkaya wrote: thank you for your reply, i'll change to c# as soon as i've finished my current projects. regards, ilker -- PHP Development Mailing List http://www.php.net/ To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DEV] Performance of Apache 2.0 Filter
At 07:00 PM 6/6/2002, Sebastian Bergmann wrote: A user posted [1] a benchmark today in the German PHP Newsgroup [2] stating that Apache 2.0 and PHP (current HEAD) are about 20% slower than Apache 1.3. Are there any official benchmarks out there? I can't quite believe this... Why not? The thread safe version of PHP is slower, and I think (I'm not sure) that the filter buffering would slow us down a bit more. Zeev -- PHP Development Mailing List http://www.php.net/ To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DEV] Re: Performance of Apache 2.0 Filter
On Thu, 6 Jun 2002, Sebastian Bergmann wrote: A user posted [1] a benchmark today in the German PHP Newsgroup [2] stating that Apache 2.0 and PHP (current HEAD) are about 20% slower than Apache 1.3. Are there any official benchmarks out there? I can't quite believe this... None that I know of. But I'm not terribly surprised by this... Apache 2.0 itself tends to be a bit faster than 1.3 depending on the configuration, though the apache2filter for PHP is nowhere near what I would consider optimal use of the capabilities of filters. Unfortunately, making them more optimal requires a bit of extra funtionality out of Zend that it doesn't currently seem to provide. (Namely, we need to be able to give Zend's lexer buffers to scan rather than handing it a file descriptor.) Aaron and I keep meaning to work on a patch for that but haven't gotten a chance yet. Not sure how that impacts performance, but it definitely impacts the capabilities over what they SHOULD be with 2.0. I'm sure there's room for optimization in there, too... if someone could do a profiling run on it (I don't have the best setup for that), I'd be willing to write some patches to try to optimize the worst offenders. --Cliff -- PHP Development Mailing List http://www.php.net/ To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DEV] Re: Performance of Apache 2.0 Filter
Cliff Woolley wrote: Namely, we need to be able to give Zend's lexer buffers to scan rather than handing it a file descriptor. Last time I talked to Zeev about this he said that this has been added. (Accepting a buffer instead of a file handle.) -- Sebastian Bergmann http://sebastian-bergmann.de/ http://phpOpenTracker.de/ Did I help you? Consider a gift: http://wishlist.sebastian-bergmann.de/ -- PHP Development Mailing List http://www.php.net/ To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DEV] Re: Performance of Apache 2.0 Filter
On Thu, Jun 06, 2002 at 07:18:22PM +0200, Sebastian Bergmann wrote: Cliff Woolley wrote: Namely, we need to be able to give Zend's lexer buffers to scan rather than handing it a file descriptor. Last time I talked to Zeev about this he said that this has been added. (Accepting a buffer instead of a file handle.) Oh? That would be awesome! Zeev, care to elaborate or point us at some code? -aaron -- PHP Development Mailing List http://www.php.net/ To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DEV] Re: [Zend Engine 2] PHP in the future
--- Zeev Suraski [EMAIL PROTECTED] wrote: At 07:01 PM 6/6/2002, brad lafountain wrote: Please don't reply to this email saying Use Java... Because php is different than java and always will be even with these new features. Brad, I beg you, there's nothing anybody can say on this list that would lead this to closure. Nothing. I believe that adding the things you mentioned does indeed turn PHP into Java, just a messy Java, Java which is worse at being Java than the real one is, and torn apart when compared against it. Why do you think it would be messy. Many others feel the same way. You don't think that way, and I respect it, and there are also others who feel the same way too. If you, or others, want to take PHP into that direction - non-web-centric, more complicated language - it's your right, and you can do it outside the scope of PHP (or fork). I believe it's a bad thing for PHP (both having these patches in general and forking), but you don't necessarily share this belief. I do believe that making a fork or patches for php is a bad thing. It would lead into a big mess. But at the same time i believe more strongly that cs is a good thing, types are a good thing and stronger oo support is a good thing. To me these are more important. There's one thing that is clear to me - there's no way to 'find a solution', because we don't, at all, agree about the existence of the problem. If you believe these features belong in PHP and that it should import all (or most) of Java's features, we (and many others) have a fundamental gap in our perception of what PHP should be, and how it can stay competitive. This is exactly true. I really feel that php/zend engine could be a alot more than you must think it can be. The thing is the stuff that I/many people have in mind won't harm php as it is, its just that some people don't want these new features. Types: ? string $var; int $int; $var = 123; // var will be a string $int = $var; // int will be a int $var2 = $var; // will be string NOTE: var2 wasn't declared $var2 = $int; // will be int // this is almost like a auto conversion... nothing more nothing less $ret = doSomething($var2, $var2); function doSomething(string $str, int $int) { } ? OO Support: interface thread { function run(); } class MyClass implements thread { function run() { yeahRight(); } function setSomething(string $test) { $this-something = $test; } opperator +(MyClass $class) { $this-something = $class-something; } opperator +(MyOtherClass $class) { $this-something = $class-otherSomething; } } class MyOtherClass extends MyClass { } MI: Someone posted a good mi example i don't recall where it may be class Person { function hello() { } } class OtherPerson { function hello() { } } class MulitPersonalites extends Person, otherPerson { var $currPerson; function MulitPersonalites() { parent::Person(Jake); parent::OtherPerson(Miles); } function Person::hello() { return super() . from multi; } function hello() { if($this-currPerson == Jake) $this-Person::hello(); else $this-OtherPerson::hello(); } } what ever the syntax should be don't forget about the public private Multi threading: I know this is a huge change but.. again i think it is a good thing. Case Sensitive: I know the reasons for and against this and i agree with both of them. But I would rather see CS. For the most part the only argument against these is do we need it and it will make things slower. Maybe somepeople do maybe somepeople don't but if someone thinks they need it then probally others do too, how much slower will some of these changes make the engine? Maybe not much at all. True these kinda things will make the languge more complicated and some people don't think that php should get complicated but I do, I think that making these kinda changes can only make php better. Again the point of this email isn't to change authors/founders minds its just my point of view. - Brad __ Do You Yahoo!? Yahoo! - Official partner of 2002 FIFA World Cup http://fifaworldcup.yahoo.com -- PHP Development Mailing List http://www.php.net/ To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DEV] exec etc. on Windows: why does it use cmd.exe ?
The shell execution commands on Windows execute a cmd /c program for running command-line programs. I have seen bug reports asking for a change but there hasn't been one. What's the reason for using cmd? Isn't it possible to directly execute those programs? The problem with using cmd.exe is that the IUSR_machine needs to have proper permissions to it which is a general security risk. It also creates problems because IIS 6 removes these permissions by default. (I have seen various postings about the typical cannot fork error after this in these groups but most of them weren't answered.) On a different topic: I started to get the lists from news.php.net recently. I tried to post there but instead I got this warning message: confirmation email already bounced once which is simply not true, there sure wasn't any mail sent to me. If the server doesn't allow for anonymous posting it should reject messages right-away instead of accepting them. This should also be clarified here: Newsgroups Many of the mailing lists listed here are also reflected onto the news server at news.php.net. Kai -- Kai Schätzl, Berlin, Germany Get your web at Conactive Internet Services: http://www.conactive.com IE-Center: http://ie5.de http://msie.winware.org -- PHP Development Mailing List http://www.php.net/ To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DEV] Re: [Zend Engine 2] PHP in the future
Brad, I beg you, there's nothing anybody can say on this list that would lead this to closure. Nothing. I believe that adding the things you mentioned does indeed turn PHP into Java, just a messy Java, Java which is worse at being Java than the real one is, and torn apart when compared against it. Why do you think it would be messy. Actually, given the changes I'm seeing in ZE2, and given our attempts at building proper applications (though they are web applications) with PHP (binarycloud), I have to agree with Brad: I don't see how they would be messy. I know this is a very dead horse, but I do think that PHP would benefit greatly from just a few features: explicit variable typing case sensitivity (because it's confusing not to have it) truly private methods and a couple other things.. note though that _all_ of that can be added with minimal pain, except for case sensitivity. (i.e. you can allow vars to be whatever if the user doesn't preface the declaration with a type, etc). Many others feel the same way. You don't think that way, and Actually Zeev, everyone I talk to (and it's a freaking lot of people) likes the idea of a tad more beefyness in PHP so long as it doesn't come at much cost. I do believe that making a fork or patches for php is a bad thing. It would lead into a big mess. But at the same time i believe more strongly that cs is a good thing, types are a good thing and stronger oo support is a good thing. To me these are more important. yes. and to many other people. remember Zeev that most people don't even understand OO concepts - so adding cool stuff for the serious people doesn't hurt the little guy writing procedural code in HTML one bit. There's one thing that is clear to me - there's no way to 'find a solution', because we don't, at all, agree about the existence of the That's bull. We could quite reasonably expect to see some things added to the language that would not turn it into a messy java. There are plenty of simple additions that would benefit more sophisticated developers a great deal. I don't want to use Java. It sucks. I like PHP. I would like to see PHP gain just a little more ground with OO, that's it. fundamental gap in our perception of what PHP should be, and how it can stay competitive. This is exactly true. I really feel that php/zend engine could be a alot more than you must think it can be. I think I'm in the it could be so much more camp. I'm not hard-core about this stuff, I don't think PHP will be useless without more advanced OO... but I don't think it hurts anyone to add some more advanced features that are not used by newbies. The problem with Java is that it forces developers to code a certain way: PHP is good precisely because it _doesn't_. You can improve PHP without sacrificing flexibility. The thing is the stuff that I/many people have in mind won't harm php as it is, its just that some people don't want these new features. Types: ? string $var; int $int; In fact, you could even have: $var = crap; // standard floating type or string $var = 123; $ret = doSomething($var2, $var2); function doSomething(string $str, int $int) { yep. that could be _optional_ and not change a single line of syntax in existing code bases. } ? OO Support: interface thread { function run(); } class MyClass implements thread { function run() { yeahRight(); } I don't see the need here.. function setSomething(string $test) { $this-something = $test; } opperator +(MyClass $class) { $this-something = $class-something; } opperator +(MyOtherClass $class) { $this-something = $class-otherSomething; } } Sitto. class MyOtherClass extends MyClass { } yes :) don't forget about the public private Case Sensitive: I know the reasons for and against this and i agree with both of them. But I would rather see CS. Ditto. If there's a time to do this it's now. php should get complicated but I do, I think that making these kinda changes I think we can add some of the basic necessities without impacting the complexity of the lauguage, see above. Again the point of this email isn't to change authors/founders minds its just my point of view. Mine is. I'd love to see case sensitivity, multiple inheritance, private methods, and optional typed variables. Except case sensitivity, all of those features can be implemented with ZERO impact on existing users and code. :) _alex -- PHP Development Mailing List http://www.php.net/ To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DEV] Re: [Zend Engine 2] PHP in the future
At 08:26 PM 6/6/2002, brad lafountain wrote: --- Zeev Suraski [EMAIL PROTECTED] wrote: At 07:01 PM 6/6/2002, brad lafountain wrote: Please don't reply to this email saying Use Java... Because php is different than java and always will be even with these new features. Brad, I beg you, there's nothing anybody can say on this list that would lead this to closure. Nothing. I believe that adding the things you mentioned does indeed turn PHP into Java, just a messy Java, Java which is worse at being Java than the real one is, and torn apart when compared against it. Why do you think it would be messy. See Kristian's letters to php-dev. I really don't want to get into it at this point, mental exhaustion :) I do believe that making a fork or patches for php is a bad thing. It would lead into a big mess. But at the same time i believe more strongly that cs is a good thing, types are a good thing and stronger oo support is a good thing. To me these are more important. I don't think I can add anything about CS that I haven't already said. Adding type hints is something that we have talked about in the past, and haven't ruled out - we need to think much more about the implications. I believe the OO level we have in ZE2 is the upper limit of what a scripting language should have. There's no doubt in my mind that going beyond that is going to complicate the language beyond what our average users want. There's one thing that is clear to me - there's no way to 'find a solution', because we don't, at all, agree about the existence of the problem. If you believe these features belong in PHP and that it should import all (or most) of Java's features, we (and many others) have a fundamental gap in our perception of what PHP should be, and how it can stay competitive. This is exactly true. I really feel that php/zend engine could be a alot more than you must think it can be. No, it's not a matter of me settling for little, and you thinking we can do much better. Not at all. While I don't think we can become a better Java than Java, this is not the reason I'm so much against going down this path. If that was it, I would have said 'let's give it a try, what's the worse that can happen?' But that's not the case. I believe that by going down that route we're going to ruin PHP where it is already established as one of the most popular web platforms out there, and that's a price I'm not willing to pay. For the most part the only argument against these is do we need it and it will make things slower. Maybe somepeople do maybe somepeople don't but if someone thinks they need it then probally others do too, how much slower will some of these changes make the engine? Maybe not much at all. True these kinda things will make the languge more complicated and some people don't think that php should get complicated but I do, I think that making these kinda changes can only make php better. FWIW, I think that performance only plays a second role in such decisions. It can indeed rule out certain features if they really slow things down without giving a significant benefit, but generally, functionality is more important than performance (good functionality does not necessarily mean more features but a good, usable platform, even if it means less features). For me, the key questions are Does that belong in the language?, i.e., would adding this feature to PHP make it a stronger/more popular/easier to use web platform than it already is, and Is it worth the price (if any)?. For the CS argument, my gut feeling was 'yes' for the first question (a long time ago) but when I tried to quantify it, it occurred to me that it doesn't really make it stronger/more popular/easier, and it was a clear 'no' for the second question. In my opinion, we should ask ourselves these questions about every new language-level feature. Of course, even if we agree on the questions, it doesn't mean we'll agree about the answers - but it would at least be a good start, and a good change from Why not add it?, which many people use today. Zeev -- PHP Development Mailing List http://www.php.net/ To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DEV] [PATCH] preg_match(_all) support for capturing offsets
Hi Andrei, all: (This is a re-send of a previous message that received no replies; my apologies if you've already seen/considered it) In a previous patch (http://news.php.net/article.php?group=php.devarticle=84281), support was added to preg_split for capturing offsets along with matches. The attached patch adds similar support to preg_match and preg_match_all via a new PREG_MATCH_OFFSET_CAPTURE flag. The code handles capturing offsets for both subpattern matches and whole pattern matches, using the previously-added add_offset_pair helper function. The flag is a new fourth (and optional) parameter for preg_match, and are or'd into the existing 'order' parameter for preg_match_all, above PREG_SET_ORDER and PREG_PATTERN_ORDER. The patch below is diffed against the CVS head - humbly sumbitted for application, rejection, suggestions, or extensive flaming. :) Thanks in advance, - Dave [EMAIL PROTECTED] --- ext/pcre/php_pcre.c.origTue Jun 4 13:02:50 2002 +++ ext/pcre/php_pcre.c Tue Jun 4 13:12:10 2002 @@ -35,7 +35,9 @@ #define PREG_PATTERN_ORDER 0 #define PREG_SET_ORDER 1 -#definePREG_SPLIT_NO_EMPTY (10) +#define PREG_MATCH_OFFSET_CAPTURE (12) + +#define PREG_SPLIT_NO_EMPTY(10) #define PREG_SPLIT_DELIM_CAPTURE (11) #define PREG_SPLIT_OFFSET_CAPTURE (12) @@ -99,6 +101,7 @@ REGISTER_LONG_CONSTANT(PREG_PATTERN_ORDER, PREG_PATTERN_ORDER, CONST_CS | CONST_PERSISTENT); REGISTER_LONG_CONSTANT(PREG_SET_ORDER, PREG_SET_ORDER, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT(PREG_MATCH_OFFSET_CAPTURE, PREG_MATCH_OFFSET_CAPTURE, +CONST_CS | CONST_PERSISTENT); REGISTER_LONG_CONSTANT(PREG_SPLIT_NO_EMPTY, PREG_SPLIT_NO_EMPTY, CONST_CS | CONST_PERSISTENT); REGISTER_LONG_CONSTANT(PREG_SPLIT_DELIM_CAPTURE, PREG_SPLIT_DELIM_CAPTURE, CONST_CS | CONST_PERSISTENT); REGISTER_LONG_CONSTANT(PREG_SPLIT_OFFSET_CAPTURE, PREG_SPLIT_OFFSET_CAPTURE, CONST_CS | CONST_PERSISTENT); @@ -310,6 +313,24 @@ } /* }}} */ +/* {{{ add_offset_pair + */ +static inline void add_offset_pair(zval *result, char *str, int len, int offset) +{ + zval *match_pair; + + ALLOC_ZVAL(match_pair); + array_init(match_pair); + INIT_PZVAL(match_pair); + + /* Add (match, offset) to the return value */ + add_next_index_stringl(match_pair, str, len, 1); + add_next_index_long(match_pair, offset); + + zend_hash_next_index_insert(Z_ARRVAL_P(result), match_pair, sizeof(zval *), +NULL); +} +/* }}} */ + /* {{{ php_pcre_match */ static void php_pcre_match(INTERNAL_FUNCTION_PARAMETERS, int global) @@ -335,6 +356,7 @@ int matched; /* Has anything matched */ int i; int subpats_order_val = 0; /* Integer value of subpats_order */ + int offset_capture = 0;/* If offsets should +be captured */ int g_notempty = 0;/* If the match should not be empty */ const char **stringlist;/* Used to hold list of subpatterns */ char*match; /* The current match */ @@ -363,11 +385,17 @@ /* Make sure subpats_order is a number */ convert_to_long_ex(subpats_order); - subpats_order_val = Z_LVAL_PP(subpats_order); - if (subpats_order_val PREG_PATTERN_ORDER || - subpats_order_val PREG_SET_ORDER) { - zend_error(E_WARNING, Wrong value for parameter 4 in call to preg_match_all()); - } +offset_capture = (Z_LVAL_PP(subpats_order) PREG_MATCH_OFFSET_CAPTURE); + + if (global) { + subpats_order_val = (Z_LVAL_PP(subpats_order) 1UL); + + if ((subpats_order_val PREG_PATTERN_ORDER) || + (subpats_order_val PREG_SET_ORDER)) { + zend_error(E_WARNING, Wrong value for parameter 4 +in call to preg_match_all()); + } +} + break; default: @@ -442,8 +470,13 @@ if (subpats_order_val == PREG_PATTERN_ORDER) { /* For each subpattern, insert it into the appropriate array. */ for (i = 0; i count; i++) { - add_next_index_stringl(match_sets[i], (char *)stringlist[i], -
[PHP-DEV] Re: [PATCH] preg_match(_all) support for capturing offsets
I will take a look at this soon, thanks. On Thu, 06 Jun 2002, David Brown wrote: Hi Andrei, all: (This is a re-send of a previous message that received no replies; my apologies if you've already seen/considered it) In a previous patch (http://news.php.net/article.php?group=php.devarticle=84281), support was added to preg_split for capturing offsets along with matches. The attached patch adds similar support to preg_match and preg_match_all via a new PREG_MATCH_OFFSET_CAPTURE flag. The code handles capturing offsets for both subpattern matches and whole pattern matches, using the previously-added add_offset_pair helper function. The flag is a new fourth (and optional) parameter for preg_match, and are or'd into the existing 'order' parameter for preg_match_all, above PREG_SET_ORDER and PREG_PATTERN_ORDER. The patch below is diffed against the CVS head - humbly sumbitted for application, rejection, suggestions, or extensive flaming. :) Thanks in advance, - Dave [EMAIL PROTECTED] --- ext/pcre/php_pcre.c.orig Tue Jun 4 13:02:50 2002 +++ ext/pcre/php_pcre.c Tue Jun 4 13:12:10 2002 @@ -35,7 +35,9 @@ #define PREG_PATTERN_ORDER 0 #define PREG_SET_ORDER 1 -#define PREG_SPLIT_NO_EMPTY (10) +#define PREG_MATCH_OFFSET_CAPTURE(12) + +#define PREG_SPLIT_NO_EMPTY (10) #define PREG_SPLIT_DELIM_CAPTURE (11) #define PREG_SPLIT_OFFSET_CAPTURE(12) @@ -99,6 +101,7 @@ REGISTER_LONG_CONSTANT(PREG_PATTERN_ORDER, PREG_PATTERN_ORDER, CONST_CS | CONST_PERSISTENT); REGISTER_LONG_CONSTANT(PREG_SET_ORDER, PREG_SET_ORDER, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT(PREG_MATCH_OFFSET_CAPTURE, PREG_MATCH_OFFSET_CAPTURE, CONST_CS | CONST_PERSISTENT); REGISTER_LONG_CONSTANT(PREG_SPLIT_NO_EMPTY, PREG_SPLIT_NO_EMPTY, CONST_CS | CONST_PERSISTENT); REGISTER_LONG_CONSTANT(PREG_SPLIT_DELIM_CAPTURE, PREG_SPLIT_DELIM_CAPTURE, CONST_CS | CONST_PERSISTENT); REGISTER_LONG_CONSTANT(PREG_SPLIT_OFFSET_CAPTURE, PREG_SPLIT_OFFSET_CAPTURE, CONST_CS | CONST_PERSISTENT); @@ -310,6 +313,24 @@ } /* }}} */ +/* {{{ add_offset_pair + */ +static inline void add_offset_pair(zval *result, char *str, int len, int offset) +{ + zval *match_pair; + + ALLOC_ZVAL(match_pair); + array_init(match_pair); + INIT_PZVAL(match_pair); + + /* Add (match, offset) to the return value */ + add_next_index_stringl(match_pair, str, len, 1); + add_next_index_long(match_pair, offset); + + zend_hash_next_index_insert(Z_ARRVAL_P(result), match_pair, sizeof(zval *), NULL); +} +/* }}} */ + /* {{{ php_pcre_match */ static void php_pcre_match(INTERNAL_FUNCTION_PARAMETERS, int global) @@ -335,6 +356,7 @@ int matched; /* Has anything matched */ int i; int subpats_order_val = 0; /* Integer value of subpats_order */ + int offset_capture = 0;/* If offsets should be captured */ int g_notempty = 0;/* If the match should not be empty */ const char **stringlist;/* Used to hold list of subpatterns */ char*match; /* The current match */ @@ -363,11 +385,17 @@ /* Make sure subpats_order is a number */ convert_to_long_ex(subpats_order); - subpats_order_val = Z_LVAL_PP(subpats_order); - if (subpats_order_val PREG_PATTERN_ORDER || - subpats_order_val PREG_SET_ORDER) { - zend_error(E_WARNING, Wrong value for parameter 4 in call to preg_match_all()); - } +offset_capture = (Z_LVAL_PP(subpats_order) PREG_MATCH_OFFSET_CAPTURE); + + if (global) { + subpats_order_val = (Z_LVAL_PP(subpats_order) 1UL); + + if ((subpats_order_val PREG_PATTERN_ORDER) || + (subpats_order_val PREG_SET_ORDER)) { + zend_error(E_WARNING, Wrong value for parameter 4 in call to preg_match_all()); + } +} + break; default: @@ -442,8 +470,13 @@ if (subpats_order_val == PREG_PATTERN_ORDER) { /* For each subpattern, insert it into the appropriate array. */ for (i = 0; i count; i++) { - add_next_index_stringl(match_sets[i], (char
RE: [PHP-DEV] Performance of Apache 2.0 Filter
A user posted [1] a benchmark today in the German PHP Newsgroup [2] stating that Apache 2.0 and PHP (current HEAD) are about 20% slower than Apache 1.3. On Thu, Jun 06, 2002 at 09:05:16AM -0700, Rasmus Lerdorf wrote: It doesn't really surprise me. The bucket brigade stuff adds overhead as does the thread stuff in PHP. There is nothing inherently faster about threaded apps. They tend to scale a little bit better in most cases, so under extreme load performance should be better. But under light loads I would expect a non-threaded Apache+PHP to be quicker. From: Aaron Bannert [mailto:[EMAIL PROTECTED]] Right, so I'd expect (hope) that at low load the performance is still reasonably fast, but at high concurrency and high load it still performs. Another thing that is gained in the new Apache 2.0 multithreaded architecture is memory conservation -- I've run a 500-thread system on under 20MB resident memory. Under Apache 1.3 that would require hundreds of MB of memory. This is a subject about which I still wonder. Multi-threading is a huge win for applications where the amount of computation is small, and most of the time is spent waiting on I/O. File servers are a classic example (NFS, SMB, FTP, file only HTTP) where multi-threading is a huge win. There are major downsides to multi-threading that need mention. For one making an application thread-safe requires substantial code, and the added code effectively imposes a run-time tax. For another applications that do a lot of computation are very often complex, and complex applications naturally contain more bugs. So a complex application - one with lots of computation between each context switch - may well be slower and less reliable when written as a multi-threaded application. Where is the cross-over point? Another question is the true memory footprint. Back in the late 1980's pretty much every Unix vendor added copy-on-write fork() semantics to their implementation. I believe Linux also uses the same copy-on-write (sometimes known as COW) behavior in fork(). Copy-on-write means that when you fork() a process, each process gets it's own virtual memory address space, but the physical memory is in fact *shared* between two processes. Immediately after fork() the contents of memory is exactly the same, so why store it twice? When a process writes to one of the shared pages a copy is made, and the virtual pages no longer share physical memory. Naturally the operating system still has to allocate virtual memory and swap space for the new process, but the amount of added physical memory used may in fact be very small. So the physical memory footprint for a multi-threaded application may in fact not be much different from a tradition Unix application that uses multiple processes. I don't know how to verify this - dig out the physical memory usage and check the copy-on-write behavior - on Linux. -- Preston L. Bannister http://members.cox.net/preston.bannister/ pbannister on Yahoo Messenger -- PHP Development Mailing List http://www.php.net/ To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DEV] Re: [Zend Engine 2] PHP in the future
I believe the OO level we have in ZE2 is the upper limit of what a scripting language should have. There's no doubt in my mind that going beyond that is going to complicate the language beyond what our average users want. I would have to disagree to this statement extremly. It would not complicate the language as those not interested would just ignore the new options and go along as normal. (i.e. all methods and variables being public by default) I sit in many PHP channels (IRC), and observe many class-based PHP networks (php-classes.org is one I monitor closely) and can say definatly that the majority of PHP users want *more* OO capabilities in PHP. Interfaces provide a simple framework for expansive web scripts, which currently can only be botched with extends... and multiple inheritance would help my current PHP (web-based) project. If these features are too complex for you to understand - ignore them! In my opinion the demand is certainly there, if a subset of people dont want to use it - we're not asking them to. What the masses are calling for (and they obviously are with the frequency of this kind of post appearing) is the option to decide. Although Im no expert on the PHP source code and the underlying ZE - is it really that complex to please everyone and give a choice? [for those concerned about the proposed stuff having performance impacts - then make it a configure option... --with-more-oop (or whatever)] -- Dan Hardiker [[EMAIL PROTECTED]] ADAM Software Systems Engineer First Creative Ltd -- PHP Development Mailing List http://www.php.net/ To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DEV] Re: [Zend Engine 2] PHP in the future
--- Zeev Suraski [EMAIL PROTECTED] wrote: At 08:26 PM 6/6/2002, brad lafountain wrote: --- Zeev Suraski [EMAIL PROTECTED] wrote: At 07:01 PM 6/6/2002, brad lafountain wrote: Please don't reply to this email saying Use Java... Because php is different than java and always will be even with these new features. Brad, I beg you, there's nothing anybody can say on this list that would lead this to closure. Nothing. I believe that adding the things you mentioned does indeed turn PHP into Java, just a messy Java, Java which is worse at being Java than the real one is, and torn apart when compared against it. Why do you think it would be messy. See Kristian's letters to php-dev. I really don't want to get into it at this point, mental exhaustion :) I do believe that making a fork or patches for php is a bad thing. It would lead into a big mess. But at the same time i believe more strongly that cs is a good thing, types are a good thing and stronger oo support is a good thing. To me these are more important. I don't think I can add anything about CS that I haven't already said. Adding type hints is something that we have talked about in the past, and haven't ruled out - we need to think much more about the implications. This is good to hear. I was totally against types, then i started thinking that it would acually be eaiser to use. But i wouldn't want to loose the floating types too. I believe the OO level we have in ZE2 is the upper limit of what a scripting language should have. There's no doubt in my mind that going beyond that is going to complicate the language beyond what our average users want. Average user.. maybe this is true.. but if you want to target more advance developers then you need to go the extra step and do some of the stuff. There's one thing that is clear to me - there's no way to 'find a solution', because we don't, at all, agree about the existence of the problem. If you believe these features belong in PHP and that it should import all (or most) of Java's features, we (and many others) have a fundamental gap in our perception of what PHP should be, and how it can stay competitive. This is exactly true. I really feel that php/zend engine could be a alot more than you must think it can be. No, it's not a matter of me settling for little, and you thinking we can do much better. Not at all. While I don't think we can become a better Java than Java, this is not the reason I'm so much against going down this path. If that was it, I would have said 'let's give it a try, what's the worse that can happen?' But that's not the case. I believe that by going down that route we're going to ruin PHP where it is already established as one of the most popular web platforms out there, and that's a price I'm not willing to pay. But you have one market.. Why not go for another.. You aren't going to loose the market that you have. I don't think people will stop using php for the web just because it has more options. For the most part the only argument against these is do we need it and it will make things slower. Maybe somepeople do maybe somepeople don't but if someone thinks they need it then probally others do too, how much slower will some of these changes make the engine? Maybe not much at all. True these kinda things will make the languge more complicated and some people don't think that php should get complicated but I do, I think that making these kinda changes can only make php better. FWIW, I think that performance only plays a second role in such decisions. It can indeed rule out certain features if they really slow things down without giving a significant benefit, but generally, functionality is more important than performance (good functionality does not necessarily mean more features but a good, usable platform, even if it means less features). For me, the key questions are Does that belong in the language?, i.e., would adding this feature to PHP make it a stronger/more popular/easier to use web platform than it already is, and Is it worth the price (if any)?. Why settle for just web platform. It has the potental to be any platform. So here is the question again. Does adding (some feature) to php make it a stronger/more popular/eaiser to use development platform than it already is. Does adding (more oo features) to php make it a stronger/more popular/eaiser to use development language? Yes. Does adding (types) to php make it a stronger/more popular/eaiser to use development language? Yes. ( i think this is true for the web-centric php too) Does adding (CS) to php make it a stronger/more popular/eaiser to use development language? Yes/Maybe. For the CS argument, my gut feeling was 'yes' for the first question (a long time ago) but when I tried to quantify it, it occurred to me that it
Re: [PHP-DEV] Re: [Zend Engine 2] PHP in the future
A couple of months ago it was agreed on how to get multiple inheritance like behavior in a way which could work with PHP. I just haven't had time to implement it yet. The talk was about aggregation of instances of classes with auto-proxy. So you'd do something like: class foo extends bar contains barbara, foobar { } $obj = new foo(); $obj-method(); /* would check foo and if method doesn't exist will auto-proxy to objects barbara and foobar in that order whatever matches first.*/ You could access the specific object by $obj-classname or $obj-barbara. Try and find it in the archives. Andi At 06:59 PM 6/6/2002 +0100, Dan Hardiker wrote: I believe the OO level we have in ZE2 is the upper limit of what a scripting language should have. There's no doubt in my mind that going beyond that is going to complicate the language beyond what our average users want. I would have to disagree to this statement extremly. It would not complicate the language as those not interested would just ignore the new options and go along as normal. (i.e. all methods and variables being public by default) I sit in many PHP channels (IRC), and observe many class-based PHP networks (php-classes.org is one I monitor closely) and can say definatly that the majority of PHP users want *more* OO capabilities in PHP. Interfaces provide a simple framework for expansive web scripts, which currently can only be botched with extends... and multiple inheritance would help my current PHP (web-based) project. If these features are too complex for you to understand - ignore them! In my opinion the demand is certainly there, if a subset of people dont want to use it - we're not asking them to. What the masses are calling for (and they obviously are with the frequency of this kind of post appearing) is the option to decide. Although Im no expert on the PHP source code and the underlying ZE - is it really that complex to please everyone and give a choice? [for those concerned about the proposed stuff having performance impacts - then make it a configure option... --with-more-oop (or whatever)] -- Dan Hardiker [[EMAIL PROTECTED]] ADAM Software Systems Engineer First Creative Ltd -- PHP Development Mailing List http://www.php.net/ To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Development Mailing List http://www.php.net/ To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DEV] Re: [Zend Engine 2] PHP in the future
Andi, Before you go ahead with this I would like to discuss it some more too. I'm wondering if we can fully support MI but i don't want to start this conversation now. btw: i like the contains better than aggergates. - brad --- Andi Gutmans [EMAIL PROTECTED] wrote: A couple of months ago it was agreed on how to get multiple inheritance like behavior in a way which could work with PHP. I just haven't had time to implement it yet. The talk was about aggregation of instances of classes with auto-proxy. So you'd do something like: class foo extends bar contains barbara, foobar { } $obj = new foo(); $obj-method(); /* would check foo and if method doesn't exist will auto-proxy to objects barbara and foobar in that order whatever matches first.*/ You could access the specific object by $obj-classname or $obj-barbara. Try and find it in the archives. Andi At 06:59 PM 6/6/2002 +0100, Dan Hardiker wrote: I believe the OO level we have in ZE2 is the upper limit of what a scripting language should have. There's no doubt in my mind that going beyond that is going to complicate the language beyond what our average users want. I would have to disagree to this statement extremly. It would not complicate the language as those not interested would just ignore the new options and go along as normal. (i.e. all methods and variables being public by default) I sit in many PHP channels (IRC), and observe many class-based PHP networks (php-classes.org is one I monitor closely) and can say definatly that the majority of PHP users want *more* OO capabilities in PHP. Interfaces provide a simple framework for expansive web scripts, which currently can only be botched with extends... and multiple inheritance would help my current PHP (web-based) project. If these features are too complex for you to understand - ignore them! In my opinion the demand is certainly there, if a subset of people dont want to use it - we're not asking them to. What the masses are calling for (and they obviously are with the frequency of this kind of post appearing) is the option to decide. Although Im no expert on the PHP source code and the underlying ZE - is it really that complex to please everyone and give a choice? [for those concerned about the proposed stuff having performance impacts - then make it a configure option... --with-more-oop (or whatever)] -- Dan Hardiker [[EMAIL PROTECTED]] ADAM Software Systems Engineer First Creative Ltd -- PHP Development Mailing List http://www.php.net/ To unsubscribe, visit: http://www.php.net/unsub.php __ Do You Yahoo!? Yahoo! - Official partner of 2002 FIFA World Cup http://fifaworldcup.yahoo.com -- PHP Development Mailing List http://www.php.net/ To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DEV] Re: [Zend Engine 2] PHP in the future
On Thu, 6 Jun 2002, Alex Black wrote: then PHP is pretty schitzo because someone made a GTK extensions for it that seems to be supported by the core group. That's for building GUI applications last I checked. (Actually the model was so good we're using it in binarycloud!) GTK is just a cute exception of the rule. :) I think it's time for PHP-core to make a decision: is this just a web scripting language or is is an application development language? This I think that decision was made already in another thread this week on php-dev list. You won't get any exact definition what PHP's vision/future is as it has to evolve like it has done so far: By people who contribute to it. (that's basically the answer I got to this question..or at least how I understood it) I think it's already an Application Development language but some people are having trouble letting go :) It's propably because they're not using PHP to write such application themselves..? --Jani -- PHP Development Mailing List http://www.php.net/ To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DEV] Snapshots not build correctly..
On 6 Jun 2002, Jim Winstead wrote: Andi Gutmans [EMAIL PROTECTED] wrote: At 09:25 PM 6/5/2002 +0300, Jani Taskinen wrote: On Wed, 5 Jun 2002, Andi Gutmans wrote: At 11:35 PM 6/4/2002 +0300, Jani Taskinen wrote: The source snapshots don't have the bison/flex generated files anymore..why is that? genfiles was broken but I fixed it in HEAD. Is this still not the case? I have no idea how the snapshots are generated..but latest I downloaded yesterday did not have those files. They are probably not generated with makedist then. Anyone know how they are created? ./buildconf --copy (andi, the whole thing is in /local/bin/update-snapshots on va1.php.net. you can do whatever needs to be done to fix it there.) Has this been fixed yet? Like I said before, I'd do it myself if I could..but without access to that machine it's not possible. Would it be possible to add that stuff which handles the snapshot generation to CVS ?? --Jani -- PHP Development Mailing List http://www.php.net/ To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DEV] Re: [Zend Engine 2] PHP in the future
Andi Gutmans wrote: The talk was about aggregation of instances of classes with auto-proxy. I think that's called delegation, not aggregation. Have a look at what the JavaLab guys at my University are doing under the term delegation: http://javalab.cs.uni-bonn.de/research/darwin/ and http://javalab.cs.uni-bonn.de/research/darwin/delegation_eng.html It'd be cool to have something like that in PHP :-) -- Sebastian Bergmann http://sebastian-bergmann.de/ http://phpOpenTracker.de/ Did I help you? Consider a gift: http://wishlist.sebastian-bergmann.de/ -- PHP Development Mailing List http://www.php.net/ To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DEV] Re: Performance of Apache 2.0 Filter
At 18:53 6-6-2002, Cliff Woolley shared with all of us: On Thu, 6 Jun 2002, Sebastian Bergmann wrote: A user posted [1] a benchmark today in the German PHP Newsgroup [2] stating that Apache 2.0 and PHP (current HEAD) are about 20% slower than Apache 1.3. Are there any official benchmarks out there? I can't quite believe this... None that I know of. But I'm not terribly surprised by this... Apache 2.0 itself tends to be a bit faster than 1.3 depending on the configuration, Actually - depending on the platform also: Apache 1.3.24 - 50 childs: = Document Path:/manual/mod/directives.html Document Length:17138 bytes Concurrency Level:40 Time taken for tests:484.882 seconds Complete requests:20 Failed requests:0 Total transferred:-789454894 bytes HTML transferred:-867257617 bytes Requests per second:412.47 Transfer rate:-1628.14 kb/s received Connnection Times (ms) min avg max Connect: 0 0 1752 Processing: 3 96 5433 Total: 3 96 7185 Apache 2.0.36 - per-thread, 3 childs, 50/per child == Document Path:/manual/mod/directives.html Document Length:17999 bytes Concurrency Level:40 Time taken for tests:2340.058 seconds Complete requests:20 Failed requests:0 Total transferred:-640847172 bytes HTML transferred:-694857432 bytes Requests per second:85.47 Transfer rate:-273.86 kb/s received Connnection Times (ms) min avg max Connect: 0 2 1999 Processing: 11 465 4612 Total: 11 467 6611 ab -w -n 20 -c 40 url Ap2 didn't have php compiled. Apache 1.3.24 did. but - I believe this to be a thread/DSO/signals issue. Would be interesting to see, if Debian has the same problems, as most answers, to problems on BSD/OS I've got from Debian postings :-) Not to mention: http://bugs.php.net/?id=17614 http://bugs.php.net/?id=17575 Met vriendelijke groeten / With kind regards, IDG.nl Melvyn Sopacua Webmaster -- PHP Development Mailing List http://www.php.net/ To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DEV] Re: Performance of Apache 2.0 Filter
Actually - depending on the platform also: What platform is this? I'm dubious of these results, given the negative numbers for transfered bytes and transfer rate. Also, be sure to run your tests from a different machine, and make sure that you aren't maxing out your client. Last note is you really should use the newest version of AB (and report the version you're using for these tests). I made some significant changes to AB recently that dramatically improved its ability to multiplex multiple connections. Thanks for the reports, -aaron -- PHP Development Mailing List http://www.php.net/ To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DEV] PHP in the future
Emacs!!! XEmacs!!! Emacs!!! XEmacs!!! Now seriosly kids. My opinion is that none of the modifications that have been discussed actually change the language into something better. Everything that you can do with the proposed modification, you can do without. Sure multiple inheritance makes this easier, but opens up cans of worms only solved in hundreds of development iterations. Sure typing (even optionally) keeps you from shooting yourself in the foot, or at least from hurting yourself too bad while doing it, but it also makes it just a little more difficult to program. Operator overloading makes it so that you don't have to type so much, but adds no functionality to the language (It bugged me too until I learned Java, and what is referred to as operator hell). Case Sensitivity just makes it so that if you can't remember if it's myFunction or MyFunction or myfunction or MYFunction or myFUNCTION (you get the picture) you have to go and look it up before your script will run. I propose that all discussion of adding to or changing the language itself be suspended until such time as it can be demonstrated that PHP can be maintained in and of itself in its current state, and this by use of the following milestones: * A complete regression test suite that is maintained concurrently with the development effort. Each bug that is fixed receives a test case to be checked with make test). A lot of extensions don't even have test suites. And last time I ran make test, the results were so useless and non-representative that I no longer try to run it. (Granted that was a couple of months ago.) * Nightly snapshot builds on the big three: Linux, Windows, and Solaris. I/My company can donate cycles to this task on some pretty nice machines if needed. * Complete core compatibility on all *NIX platforms as well as Windows. If a function cannot be implemented on any given platform, it should be deprecated/removed from the core. Register_Shutdown_function comes to mind. * Average new daily valid bug reports should be less than 10. Average daily open bug reports should be no more than 100. I've got ideas on how to help make this happen, and will release them to any who asks. * Extensions that do not compile and function on every platform should be removed to some non-core location. If it's not portable, then it's not PHP. * Complete documentation on every extension and function and structure and operator and nuance and etc of the PHP core. If and only if all of the above conditions are met can we think about extending/tweaking the language. If we do, any more than has already been done, before we have that solid base, PHP is going to be so top heavy, and so bottom weak that it will collapse. Joseph P.S. RANT Abstract=Why my company, and as a result, I won't be using PHP anymore, and why this discussion won't change that outcome.My work with php has come about because we decided that php would be the best platform in which to create a web application. We had experience with mod_perl, CGI, as well as Java, and by far the easiest to use and the quickest to develop in is PHP. The entire application was written procedurally. Only at the very end did I create a class, and that because I didn't feel like passing 6 or 7 parameters when I made a function call and I was being lazy. I never was upset because php didn't have this language feature or that OO nicety. What did get me was the non-portability of the supposedly portable Scripting Language, but there are open bugs on all of those issues. Nobody's even tried to touch those bugs, but they're open. Now, because of the gotchas we had with the first app, the next web application will be done in C/C++ because it turns out that PHP is not as portable as we were led to believe. This feature or that feature or the other may or may not be available on a given platform. We all have more important things to do: I'd really like the Register_Shutdown_function bug that's been around since the release of 4.1 to be fixed. Then while you're at it, get it working on Windows. That takes precedence over ANY language extensions in my mind, as do all of the open bugs in the bugs database. On a different vein: have you ever tried selling a PHP application to a customer? How about a customer that only has Windows/IIS in house and doesn't feel comfortable about bringing in a *NIX/Apache server in to deploy your product? They care not about whether it is case sensitive, or how Object Oriented it is. They want it to run, run well, and run without crashing. As a general rule, PHP/IIS is experimental at best, but nobody seems to want or to be able to work on it. So we lose sales... I've tried, but failed because I can't understand the Zend engine. What do those lost sales translate to? You guessed it, our next application will not be developed in PHP, and our current app probably will be rewritten in C. And I won't be able to contribute anymore. Such is
[PHP-DEV] Zend Engine unloading extension in the wrong order
I have been tracking down a core dump with my php extension when it is unloading some of its shared libraries. I have shared extension that is link against libexpat and will load fine if it is the only on in the php.ini. If I then load xml.so extension then my extension it works fine, but if it is my extension then xml.so it crashes while xml.so is unloading libexapt. What I have found is the Zend Engine is unloading extension in the same order it loaded them. load: foo_bar.so load: xml.so unload: foo_bar.so unload: xml.so I believe this is wrong and think it should be in reverse order. load: foo_bar.so load: xml.so unload: xml.so unload: foo_bar.so There are two ways to fix this problem. One is to push the modules to the head of the hash, but looking at the zend_hash_add function I decided to go with the second. Second way is to destroy them in reverse order. I created a zend_hash_reverse_destroy and call that instead of zend_hash_destroy. There may be a better way to do this, but this is the quick fix for me. I have included a patch below, should I submit a bug report as well? Thanks, Brian diff -rc php-4.2.1/Zend/zend.c *** php-4.2.1/Zend/zend.c Tue Feb 26 10:59:25 2002 --- php-4.2.1/Zend/zend.c Thu Jun 6 11:32:57 2002 *** *** 487,493 zend_destroy_rsrc_list(EG(persistent_list) TSRMLS_CC); #endif zend_destroy_rsrc_list_dtors(); ! zend_hash_destroy(module_registry); zend_hash_destroy(GLOBAL_FUNCTION_TABLE); free(GLOBAL_FUNCTION_TABLE); zend_hash_destroy(GLOBAL_CLASS_TABLE); --- 487,493 zend_destroy_rsrc_list(EG(persistent_list) TSRMLS_CC); #endif zend_destroy_rsrc_list_dtors(); ! zend_hash_reverse_destroy(module_registry); zend_hash_destroy(GLOBAL_FUNCTION_TABLE); free(GLOBAL_FUNCTION_TABLE); zend_hash_destroy(GLOBAL_CLASS_TABLE); diff -rc php-4.2.1/Zend/zend_hash.c *** php-4.2.1/Zend/zend_hash.c Mon Apr 22 23:53:26 2002 --- php-4.2.1/Zend/zend_hash.c Thu Jun 6 11:32:57 2002 *** *** 550,555 --- 550,579 SET_INCONSISTENT(HT_DESTROYED); } + ZEND_API void zend_hash_reverse_destroy(HashTable *ht) + { + Bucket *p, *q; + + IS_CONSISTENT(ht); + + SET_INCONSISTENT(HT_IS_DESTROYING); + + p = ht-pListTail; + while (p != NULL) { + q = p; + p = p-pLast; + if (ht-pDestructor) { + ht-pDestructor(q-pData); + } + if (!q-pDataPtr q-pData) { + pefree(q-pData, ht-persistent); + } + pefree(q, ht-persistent); + } + pefree(ht-arBuckets, ht-persistent); + + SET_INCONSISTENT(HT_DESTROYED); + } ZEND_API void zend_hash_clean(HashTable *ht) { -- PHP Development Mailing List http://www.php.net/ To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DEV] Re: [Zend Engine 2] PHP in the future
i really agree with brad. actually, im the kind of person that would like php to turn into java while still having the php look and feel. i did a few courses of java my employer send me to and i really appreciate OO now that i got a taste of it. because of these courses i started programingen OO in php, as much as this is possible and soon stumbled across al of php's short commings on this subject :( i don't think it will have any negative effects on php implementing more OO stuff. lots of people out there don't even know what it is and they will code just as happily as they were before. still you could say that those people would have problems reading other peoples code because it would be OO written, but than again, already lots of code is being written in php in an OO way so one could say that OO shouldn't have been implemented, however simple, in the first place as it has been. but the php devolopers did. so, in holland we have a saying: who says A must say B ;) in other words, if you give people a taste of the goodies they'll be banging on your door for more in no time... so here i am ;) At 10:26 6-6-2002 -0700, brad lafountain wrote: --- Zeev Suraski [EMAIL PROTECTED] wrote: At 07:01 PM 6/6/2002, brad lafountain wrote: Please don't reply to this email saying Use Java... Because php is different than java and always will be even with these new features. Brad, I beg you, there's nothing anybody can say on this list that would lead this to closure. Nothing. I believe that adding the things you mentioned does indeed turn PHP into Java, just a messy Java, Java which is worse at being Java than the real one is, and torn apart when compared against it. Why do you think it would be messy. Many others feel the same way. You don't think that way, and I respect it, and there are also others who feel the same way too. If you, or others, want to take PHP into that direction - non-web-centric, more complicated language - it's your right, and you can do it outside the scope of PHP (or fork). I believe it's a bad thing for PHP (both having these patches in general and forking), but you don't necessarily share this belief. I do believe that making a fork or patches for php is a bad thing. It would lead into a big mess. But at the same time i believe more strongly that cs is a good thing, types are a good thing and stronger oo support is a good thing. To me these are more important. There's one thing that is clear to me - there's no way to 'find a solution', because we don't, at all, agree about the existence of the problem. If you believe these features belong in PHP and that it should import all (or most) of Java's features, we (and many others) have a fundamental gap in our perception of what PHP should be, and how it can stay competitive. This is exactly true. I really feel that php/zend engine could be a alot more than you must think it can be. The thing is the stuff that I/many people have in mind won't harm php as it is, its just that some people don't want these new features. Types: ? string $var; int $int; $var = 123; // var will be a string $int = $var; // int will be a int $var2 = $var; // will be string NOTE: var2 wasn't declared $var2 = $int; // will be int // this is almost like a auto conversion... nothing more nothing less $ret = doSomething($var2, $var2); function doSomething(string $str, int $int) { } ? OO Support: interface thread { function run(); } class MyClass implements thread { function run() { yeahRight(); } function setSomething(string $test) { $this-something = $test; } opperator +(MyClass $class) { $this-something = $class-something; } opperator +(MyOtherClass $class) { $this-something = $class-otherSomething; } } class MyOtherClass extends MyClass { } MI: Someone posted a good mi example i don't recall where it may be class Person { function hello() { } } class OtherPerson { function hello() { } } class MulitPersonalites extends Person, otherPerson { var $currPerson; function MulitPersonalites() { parent::Person(Jake); parent::OtherPerson(Miles); } function Person::hello() { return super() . from multi; } function hello() { if($this-currPerson == Jake) $this-Person::hello(); else $this-OtherPerson::hello(); } } what ever the syntax should be don't forget about the public private Multi threading: I know this is a huge change but.. again i think it is a good thing. Case Sensitive: I know the reasons for and against this and i agree with both of them. But I would rather see CS. For the most part the only argument against these is do we need it and it will make things slower. Maybe somepeople do maybe somepeople don't but if someone thinks they need it then probally others do too, how much slower will some of these changes make the engine?
Re: [PHP-DEV] Re: [Zend Engine 2] PHP in the future
Aggregation sometimes involves delegation. The 'parent' object delegates requests to the right aggregated objects (in other cases, the 'parent' object returns its aggregated objects and you use them directly). Zeev At 10:43 PM 6/6/2002, Sebastian Bergmann wrote: Andi Gutmans wrote: The talk was about aggregation of instances of classes with auto-proxy. I think that's called delegation, not aggregation. Have a look at what the JavaLab guys at my University are doing under the term delegation: http://javalab.cs.uni-bonn.de/research/darwin/ and http://javalab.cs.uni-bonn.de/research/darwin/delegation_eng.html It'd be cool to have something like that in PHP :-) -- Sebastian Bergmann http://sebastian-bergmann.de/http://phpOpenTracker.de/ Did I help you? Consider a gift: http://wishlist.sebastian-bergmann.de/ -- PHP Development Mailing List http://www.php.net/ To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Development Mailing List http://www.php.net/ To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DEV] How do I access a hash from an extention/module?
I think that the best will be that somebody with a hole experience in PHP internals to write a book, I will sure buy it. Best regards, Emanuel Dejanu -Original Message- From: Eric Veldhuyzen [mailto:[EMAIL PROTECTED]] Sent: 6 iunie 2002 16:59 To: Markus Fischer Cc: fabwash; Eric Veldhuyzen; [EMAIL PROTECTED] Subject: Re: [PHP-DEV] How do I access a hash from an extention/module? On Thu, Jun 06, 2002 at 03:45:08PM +0200, Markus Fischer wrote: On Thu, Jun 06, 2002 at 09:36:29AM -0400, fabwash wrote : It would be nice it there was some REAL documentation about the API... Amen to that!!!.. I spent exactely 5 1/2 hours yesterday trying to create a resource that is a structure which contains a set of pointers to an array of objects (yeah it's complicated but it's great when it works !), then later retrieve the array, walk throught it, get the objects back from the hash, and do something with them. Works fine for now (although i'm sure i have major memory leaks for now because i'm not sure how to deallocate and when to do it, when to add references and remove references), but some documentation would have reduced my research, trial and error, multiple compilations, tests, other source reading, debugging time, etc.. I get great help from people here on specific issues, but i'd rather read some documentation before asking stupid questions. Actually, there is: http://www.php.net/manual/en/zend.php I've read that. Multiple times. But it is hardly anything close to real documentation. Claiming that this is real documentation is like explaining how to write a 'hello world' program in C is real documateion about how to write real programs in C. It is a nice primer, but nothing more than that. It explains how to werite a VERY basic extention and then stops. Not my idea of real documentation. I would settle for a small summary of all the functions one might want to call, with a short description of its function and the parameters it acceepts. That would be terrific. I've seen quite a few people in the last months writing extenions and therefore they know how it is for a newcommer. Yet no one asked if he can help out with the documentation. To write documentation you first have to know how it works. And I am nowhere near that. I have written some code that seems to work, but since none of tha parameters are described and there is hardly any comment in de PHP source code it is very hard to be able to understand how it all works. -- #!perl # Life ain't fair, but root passwords help. # Eric Veldhuyzen [EMAIL PROTECTED] $!=$;=$_+(++$_);($:,$~,$/,$^,$*,$@)=$!=~ # Perl Monger /.(.)...(.)(.)(.)..(.)..(.)/;`$^$~$/$: $^$*$@$~ $_$;` -- PHP Development Mailing List http://www.php.net/ To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Development Mailing List http://www.php.net/ To unsubscribe, visit: http://www.php.net/unsub.php