Re: [PHP-DEV] Help a beginner out please!!
Wrong list. You're looking for [EMAIL PROTECTED] This is a list for the development of the language itself, not with it. On Friday, March 7, 2003, at 12:44 AM, Ted Conn wrote: Hi well maybe this isnt the right place to put a beginners post but I will find out soon if its not I guess! -- PHP Development Mailing List http://www.php.net/ To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DEV] Question about zend_compile
Look at apc. It tracks per-file function and class tables. http://apc.communityconnect.com/ (v2.0) pear/PECL/apc (v1.x) Both versions do the thing you wish for. -- PHP Development Mailing List http://www.php.net/ To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DEV] Re: [Zend Engine 2] FYI: PHP/threads
Both of these examples could be realized using fork() or socket_select(), though the first is not portable and the latter produces unnecessary overhead. Just to nit-pick: non-blocking io is much more efficient than threads, -- PHP Development Mailing List http://www.php.net/ To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DEV] Doing something with an each opcode as zend_execute() handles it
Essentially, I want to be able to produce a sort of serialized representation of the opcodes, but as they are executed, not all in one big chunk after they are compiled. This isn't for any actually useful production code, just some debugging/messing around/exploring engine internals. There's no good way to do this as a zend_extension in ZE1 (that I know of). You need to patch the engine (which is trivial). -- PHP Development Mailing List http://www.php.net/ To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DEV] Re: #22527 [Opn-Bgs]: Modulus returned negative value
Interesting. I don't know what the ISO standard say, but mathematically a a % b will always return you an integer 0 = a%b b (since there are no negative numbers in canonical representation of Z/bZ). I guess perl/python/tcl ddecided to adhere to the mathematical definition. On Tuesday, March 4, 2003, at 02:37 AM, Rasmus Lerdorf wrote: This is actually an interesting question. Should we be truncating towards zero? I'd say yes, but then I tested Perl, Python and Tcl, and they all say that -27 % 7 is 1 which means they truncate towards negative infinity. -- PHP Development Mailing List http://www.php.net/ To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DEV] Re: #22527 [Opn-Bgs]: Modulus returned negative value
On Tuesday, March 4, 2003, at 10:33 AM, Sascha Schumann wrote: On Tue, 4 Mar 2003, George Schlossnagle wrote: Interesting. I don't know what the ISO standard say, but mathematically a a % b will always return you an integer 0 = a%b b (since there are no negative numbers in canonical representation of Z/bZ). I guess perl/python/tcl ddecided to adhere to the mathematical definition. ISO C truncates towards zero. It specifically says in 6.5.5 Multiplicative Operators: If the quotient a/b is representable, the expression (a/b)*b + a%b shall equal a. So -27 % 7 yields -6. Yeah, I read that in the bug report and confirmed that as the intended behavior in C. What I meant was 'regardless of what the ISO standard says, thats not a standard mathematical definition.' -- PHP Development Mailing List http://www.php.net/ To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DEV] Tie'ing variables
Having this sort of functionaility in general would be great. I know you can affect this with objects via overload, but it is useful for scalars and arrays and streams as well. It is pretty 'magical' though. George On Saturday, March 1, 2003, at 11:26 AM, Sterling Hughes wrote: I was wondering if it might be possible to tie these arrays to a function (if you don't understand that, look at Perl for a definition). One could populate them as an overloaded object, and then array accesses would work - I guess. But I would prefer a cleaner mechanism. -- PHP Development Mailing List http://www.php.net/ To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DEV] session extension question
Any feelings on a patch to the session extension so that if session_set_save_handler is passed a class or namespace as it's sole argument, it auto-registers class::open, class::close, class::read, class::write, class::destory and class::gc? George -- PHP Development Mailing List http://www.php.net/ To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DEV] Weak references in PHP
Can anybody tell me if such features are available in PHP (I failed to find them myself). Look at __destruct method for classes in ZE2. They wopn't tell you the reference count, but the do get called when the ref count goes to 0. -- PHP Development Mailing List http://www.php.net/ To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DEV] #php.bugs invite only?
#php.bugs seems to be invite only now. How do I go about getting myself invited? -- PHP Development Mailing List http://www.php.net/ To unsubscribe, visit: http://www.php.net/unsub.php
Re: Re[2]: [PHP-DEV] Weak references in PHP
Using __destruct method (thanks to George) it may be possible to implement what I need, but only if object cache is implemented in C (and so is not visible for PHP garbage collector). So no pure PHP solution exits. Unfortunately I didn't fins any reference to __destruct method in PHP manual and do not understand how it works. If I just declare __destruct method in class, it is not invoked when object is destructed. It's in ZE2 have a look at Zend/ZEND_CHANGES in the source tree for details (you'll need to be running php5/HEAD). And it's a userland method, so the cache can be implemented in PHP. -- PHP Development Mailing List http://www.php.net/ To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DEV] Re: [PHP] Threading
On Thursday, February 27, 2003, at 01:50 PM, Braulio JosX Solano Rojas wrote: Hi! Dave Viner [EMAIL PROTECTED] escribiÛ en el mensaje news:[EMAIL PROTECTED] would semaphores provide the mutual exclusion zone you need? I do not know yet, I should studie it, but it is likely so. Are there semaphores in PHP? Yes. I'd recommend a reading of the fine manual. Of course if you're actually writing an extension it doesn't matter much if the semaphores are implemented in PHP or not, since you'll probably just want to use the sysv ipc support of the os yourself, without taking it through php userland functions. george -- PHP Development Mailing List http://www.php.net/ To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DEV] Of string constants, bytecode, and concatenation
It's the job of an optimizer, not of a compiler. And because PHP doesn't have an internal optimizer, this is not optimized out. You can either check the ZendOptimiser (I can't show you the opcodes that that generates) or PEAR::Optimizer, which is in Pecl (which might not do this optimization yet btw). It does. -- PHP Development Mailing List http://www.php.net/ To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DEV] include() and sessions
Interesting, I get the same hang when I do this on OSX with head php 'foo.php?a=b' Foo is any php script (including an empty file). This returns no such file foo.php?a=b on linux. Will open a bug. George On Tuesday, February 11, 2003, at 05:31 PM, Lindsey Simon wrote: Hey Chris, sorry - I only included it on this list because of the server timeout thing. When I pass the session id and name my server hangs on the include. I thought it might be pertinent. Also, as a guess to your problem, when you include a resource by URL, you are going to receive the same output that a browser would (when you view source), so any PHP code in that resource is going to be executed prior to receipt. If this is a local file, you should use the filesystem path instead. For example: include '/home/lindsey/public_html/foo.php'; instead of: include 'http://www.example.org/~lindsey/foo.php'; This is correct, I want the code to be executed. Specifically, I want to pass GET variables along with the include that are not the same as the current state of the GET variables on the page I'm calling include from. If you must use a URL and you want to retain session, you will have to pass your session identifier on the URL. (see above) Chris --- Lindsey Simon [EMAIL PROTECTED] wrote: I have a situation involving my session and an include(). I'm trying to include() a page using the full path. My session is registered and I can verify all is well with it. I want to retain the session from within the page I'm including. So: I'm pasting my code here (please ignore the variables except the session stuff at the end. $this_URL = $URL . index.php?modu=display_shotsshow_ident= . $_REQUEST['select_ident'] . select_ident= . $_REQUEST['select_ident'] .. noheader=1nofooter=1no_print_link=1add_record=1 . session_name() . = . session_id(); include($this_URL); my webserver just hangs and I have to restart it in order to get any more pages from anywhere on the server. I've tested this in 4.2.3 and 4.3. Is my syntax correct in terms of what I should append to the URL when include()ing it? I'm basing it on what I read about passing SID (which I can't use since it's returning empty on the page where I have the include() line) Thanks for your help, -l -- 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] Mono PHP
On Wednesday, February 5, 2003, at 05:22 PM, Stig S. Bakken wrote: On Mon, 3 Feb 2003, Sebastian Bergmann wrote: Sterling Hughes wrote: I'll be adding it into PECL in a little bit Why PECL and not add it to ext/rpc? ext/rpc should be able to load rpc backend modules, or PECL is the only sensible place to put it (especially when it's experimental!). We really don't want to mix java, mono, xmlrpc, soap and whatnot into a single package. Nor (as cool as it may be), is there a reason it should be in the 'core' (extension-wise) of php. -- PHP Development Mailing List http://www.php.net/ To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DEV] OO in PHP5 (was zend_API.c on php-dev)
On Monday, February 3, 2003, at 03:20 PM, Harald Radi wrote: Hrmfpsd, while commiting a new functions the parameter parsing API i appearently brought up a discussion about the meaning of life and stuff :) As asked by Andi i'm bringing the discussion to php5-dev with a short summary: andrei's point: extensions should stick to either functional or oo API PEAR wrappers can be provided my point: extensions should expose both APIs (if desired) can be done by aliasing functions to class methods - no duplicate c code when called as function - print warning when called as method - throw exception What do you guys think of this ? I like your method. I've implemented it for a coupe extensions (except for the exception vs. error thing), and I found it to be quite manageable and very little work. regards, Harald Radi -- nme - we can heal you http://www.nme.at Ortner Radi Schwenk GnbR Tumpenweg 528 5084 Grossgmain, Salzburg Austria -Original Message- From: Andi Gutmans [mailto:[EMAIL PROTECTED]] Sent: Monday, February 03, 2003 9:10 PM To: Harald Radi; 'Andrei Zmievski' Cc: [EMAIL PROTECTED] Subject: Re: [PHP-DEV] RE: zend_API.c Hey, I think the discussion you guys are having is much broader than just mysqli. We should probably come up with a general approach which we will use consistently for PHP 5. I suggest we move this discussion to the PHP 5 dev list and try and come up with a good solution. Obviously we will keep the functional support for all extensions like PHP 4. The only question is, if and how we support an OO paradigm. Andi -- 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: Mandatory File Locking in PHP?
On Thursday, January 30, 2003, at 04:28 AM, Ananth Kesari wrote: So, as of now, do we restrict PHP script to use only advisory file locking? Mandatory locking is an OS thing, not a PHP userspace thing. Given appropriate mount options on your fs (certainly out of the scope of php's responsibility), and appropriate permissions on the file (doable from within php of course, but seems odd to have to internally check and chmod a file as part of a locking procedure), then fcntl locks will be mandatory. Assuming that your filesystem is mounted -o mand, you can just do this: function mandatoryLock($file) { // go through the arcane dance of setting g+s, g-x $mode = (stat($file)[2)]; $mode = $mode ^ 0010; $mode = $mode | 02000; chmod($file, $mode); // lock it $fp = open($file, a+); flock($fp, LOCK_EX); } The point I'm trying to make, is that you can already set up your system so that you can do mandatory locks from within php (on systems supporting it), but it is close to impossible to have php do all the setup work for you (remounting a file system -o mand should be out of the scope of php, imho). George -- PHP Development Mailing List http://www.php.net/ To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DEV] Re: Mandatory File Locking in PHP?
Aside from this being on the wrong list (this should go to php-general), it's worth noting that mandatory locking support is pretty inconsistently implemented across most OSs. George On Wednesday, January 29, 2003, at 10:59 AM, J Smith wrote: Try the direct I/O extension, specifically dio_fcntl(). Just make sure the filesystem you're using the locks on was mounted with -o mand, and the locks will be mandatory by default. J Ananth Kesari wrote: Hi, From the PHP manual I find that the flock() function does a advisory file locking. Is there a way to do mandatory file locking where we do strict locking? That is once a file is locked, no other process or thread is allowed to edit the file untill the lock owner is done with his job and he has removed the lock. Thanks, Ananth. -- 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: Mandatory File Locking in PHP?
On Wednesday, January 29, 2003, at 07:11 PM, Marcus Börger wrote: The real question is why you need mandatory locks and not advisory locks. If everyone is playing on the same team, advisory locks should provide all the semantics you need (and are very portable). Mandatory locks (on linux at least) require not only special mount options, but special perms to the file (g-x, g+s, I believe). That seems like a lot to require inside an extension. The dba solution so far is based on flock() and where not appropriate use fctnl(). I tried to have the lock stuff working on as many systems as possible. Right. Both of these are pretty portable, one being present on all BSD-style systems and the other on POSIX systems. They are also advisory locks. Mandatory locks actually prevent read and write calls from _anyone_ else succeeding on that file. On linux, mandatory locks are set with fcntl, but it's not part of the standard POSIX standard. -- PHP Development Mailing List http://www.php.net/ To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DEV] Reducing the number of system calls for includes
I like this solution. On Saturday, January 25, 2003, at 09:08 AM, Andi Gutmans wrote: Hi, I think the best solution to this problem, without breaking functionality, is to use a cache for realpath() in virtual_file_ex(). -- PHP Development Mailing List http://www.php.net/ To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DEV] Reducing the number of system calls for includes
Perhaps make it configurable because on Linux there already is a dcache right in the kernel which is likely to be faster than anything we can do. On linux you still have to make all those stat calls (they just return fast). A hashlookup inside TSRM will almost certainly return much faster. As far as I know, Linux is the only OS with such a kernel-level cache. Isn't solaris' dnlc similar in function to linux's dcache? -- PHP Development Mailing List http://www.php.net/ To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DEV] Reducing the number of system calls for includes
Eliminating realpath for fully qualified paths make sense to me. But... don't you Y! guys use php-a? Shouldn't this hide that overhead completely from you by completely eliminating all the stats on a require/include after the initial compilation? Or is this just a 'greater good' optimization? George -- PHP Development Mailing List http://www.php.net/ To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DEV] Reducing the number of system calls for includes
On Friday, January 24, 2003, at 10:19 PM, Rasmus Lerdorf wrote: Eliminating realpath for fully qualified paths make sense to me. But... don't you Y! guys use php-a? Shouldn't this hide that overhead completely from you by completely eliminating all the stats on a require/include after the initial compilation? Or is this just a It doesn't eliminate it at all, no. These checks are still done even on accelerated includes in both zend cache and ioncube. Weird. That was totally contrary to the way I remember it working. In trying to figure out why I remembered incorrectly, I realized the reason why you (in general) want to resolve the path to a canonical path is that you can seriously break include_once and require_once if you dont. Otherwise require_once wont correctly work if you do ? require_once(/home/george/foo.php); require_once(/home/george/../george/foo.php); ? (of course you can put together a less contrived example). -- PHP Development Mailing List http://www.php.net/ To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DEV] Distributing Extensions
On Thursday, January 23, 2003, at 12:17 AM, Brian Moon wrote: Is PECL ready for this stuff? Yes. -- PHP Development Mailing List http://www.php.net/ To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DEV] request data filter
You consider running the apache_hooks code? This should be simple there. -- PHP Development Mailing List http://www.php.net/ To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DEV] request data filter
You could have your custom C extension be called as one of the hooks. On Wednesday, January 15, 2003, at 09:42 PM, Rasmus Lerdorf wrote: On Wed, 15 Jan 2003, George Schlossnagle wrote: You consider running the apache_hooks code? This should be simple there. You mean do the filtering straight from a PHP script that gets called from a hook? That's a lot of looping through a bunch of arrays. This has to happen on every request on the busiest site in the world; it needs to be written in C. You could have your custom C extension be called as one of the hooks. Shouldn't be any slower than what you proposed. -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
Re: [PHP-DEV] Statistical analysis extension
Have you looked on netlib? http://www.netlib.org/ I am now thinking perhaps the best way to go is to implement the C library of statistical recipes that I need in a library that would be compatible with the PHP license. Anyone know of an existing lib that is already available? Ideally this library should have an object oriented interface that would make it very intuitive for PHP developers to use. -- PHP Development Mailing List http://www.php.net/ To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DEV] PHP in 2003 (leading to PHP 5)
I think this would make releasing new versions of php much more manageable. Do you? Not every extension has a named maintainer .. At worst, the maintenance would be as it is now. Or is the worry that some extensions will go unmaintained if they are moved into PECL? My take on that would be that any extension that would die if it was moved out of core should be moved out of core for just that reason. George -- PHP Development Mailing List http://www.php.net/ To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DEV] Update: Quoting behaviour exposed
Wow... top 10. And to think my guidance counselor said I would never amount to anything . And the top 10 again (messages with a ratio = 3): ... George Schlossnagleavg of 11.78 in 4 postings ... -- PHP Development Mailing List http://www.php.net/ To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DEV] Update: Quoting behaviour exposed
Guess I should add visible sarcasm/sarcasm tokens in the future, eh? And if it has not been obvious, the top 10 should be taken with a grain of salt. - Sascha -- PHP Development Mailing List http://www.php.net/ To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DEV] Update: Quoting behaviour exposed
Then my hopes for also being on the top 10 list of correct users of nomenclature are shot. Those are called tags, remember the importance of effective communication! -- PHP Development Mailing List http://www.php.net/ To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DEV] emalloc() troubles
qmail devs == djb, right? If his support doesn't suffice (and you cant find it in the enormous un-merged patch contributions that seem to litter the qmail community websites), might I suggest a new MTA? Exim works quite nicely. George On Friday, December 27, 2002, at 10:49 AM, Ari Pollak wrote: The problem is that there are no qmail devs, and it's easier to fix in PHP than in qmail. -- 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] option to start in PHP mode
+0. Or as Zeev might prefer: I like this idea. I also find it a hassle to have to put start tags at the beginning of cli scripts. It does pose some problems though with using includes between cli and web scripts, no? On Friday, December 27, 2002, at 02:11 PM, Andrei Zmievski wrote: We've talked about this in the past, but let's bring it up again. It is a bit awkward to use CLI when it requires those ?php and ? tags. We should probably have a command-line option that tells the parser to start in PHP mode instead of HTML/text. Any thoughts on this? -Andrei http://www.gravitonic.com/ * What were the first 15 billion years of the universe like for you? * -- 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] CGI and CLI
I'm with Shane, that sounds like a really poor idea. On Wednesday, December 18, 2002, at 04:38 PM, Shane Caraveo wrote: Robin Thellend wrote: On Wed, 18 Dec 2002, Derick Rethans wrote: [...] I didn't say that it should be changed from php to php-cgi, as I do think that would be bad. Derick Why don't you just add a simple check in the CLI code to exec() the CGI binary if it is called as a CGI? if(getenv(GATEWAY_INTERFACE) != NULL) execv(/path/to/php-cgi, argv); Lets not compound one bad idea with another. Shane -- 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] Single quotes VS. Double quotes
What version of php did you try this with Brian? There were some lexer changes implemented (that I believe are only in HEAD for ZE1 and ZE2 and not in 4.3) that should equalize this difference. There was a thread about this on php-dev not long ago that explains why this occurs - search the archives for ZEND_ADD_STRING. George On Friday, December 13, 2002, at 11:35 AM, Andrey Hristov wrote: See this : http://phpxpath.sourceforge.net/benchmark/phpBench.php And show it to the guy. Andrey - Original Message - From: Brian Moon [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Friday, December 13, 2002 6:29 PM Subject: [PHP-DEV] Single quotes VS. Double quotes This is of really low importance, but I found it interesting. A new guy on the Phorum dev team decided to convert all double quotes to single quotes for speed in CVS. The common assumption is that single quotes are faster than double quotes. However, I am of the mind set of using double always as it creates less headaches later to add a variable to the string. In an attempt to show him the marginal savings of this, I did some benchmarks. The results were confusing. $var=This is test number $x; was really slow. but, $var=This is test number .$x; and $var='This is test number '.$x; we basically identical. Andi, Zeev, if you want waste some energy on exanding on why this is and if anything in ZE2 will change it I would find it a good read. Brian Moon dealnews.com -- 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 Development Mailing List http://www.php.net/ To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DEV] Single quotes VS. Double quotes
Oops, contrary to my earlier statement, the lexer patch for this problem seems to be in 4.3.0rc2 and 4.3.0rc3. George On Friday, December 13, 2002, at 11:43 AM, Brian Moon wrote: I am using 4.2.2-dev. Must be a stable build from snaps.php.net. I will read the archives. Brian Moon dealnews.com - Original Message - From: George Schlossnagle [EMAIL PROTECTED] To: Andrey Hristov [EMAIL PROTECTED] Cc: Brian Moon [EMAIL PROTECTED]; [EMAIL PROTECTED] Sent: Friday, December 13, 2002 10:40 AM Subject: Re: [PHP-DEV] Single quotes VS. Double quotes | What version of php did you try this with Brian? There were some lexer | changes implemented (that I believe are only in HEAD for ZE1 and ZE2 | and not in 4.3) that should equalize this difference. There was a | thread about this on php-dev not long ago that explains why this occurs | - search the archives for ZEND_ADD_STRING. | | George | | On Friday, December 13, 2002, at 11:35 AM, Andrey Hristov wrote: | | See this : | http://phpxpath.sourceforge.net/benchmark/phpBench.php | | And show it to the guy. | | Andrey | | - Original Message - | From: Brian Moon [EMAIL PROTECTED] | To: [EMAIL PROTECTED] | Sent: Friday, December 13, 2002 6:29 PM | Subject: [PHP-DEV] Single quotes VS. Double quotes | | | This is of really low importance, but I found it interesting. A new | guy | on | the Phorum dev team decided to convert all double quotes to single | quotes | for speed in CVS. The common assumption is that single quotes are | faster | than double quotes. However, I am of the mind set of using double | always | as | it creates less headaches later to add a variable to the string. In | an | attempt to show him the marginal savings of this, I did some | benchmarks. | The results were confusing. | | $var=This is test number $x; was really slow. | | but, | | $var=This is test number .$x; | | and | | $var='This is test number '.$x; | | we basically identical. | | Andi, Zeev, if you want waste some energy on exanding on why this is | and | if | anything in ZE2 will change it I would find it a good read. | | Brian Moon | dealnews.com | | | | | -- | 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 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: bug of the day: $this
Why do the (cheap) checks implemented in debug_backtrace not work for this? George On Friday, December 6, 2002, at 04:11 PM, Stig S. Bakken wrote: It won't be different in ZE2. This is not a bug though, but a tricky design issue. The problem is figuring out at runtime when to set $this or not in a method. What most people would probably find intuitive, is that $this was set only in methods called in the object, but this would require pretty expensive checks for every method call. Andi can shed more light on this if needed. - Stig On Wed, 2002-12-04 at 00:25, Markus Fischer wrote: I think issue is/will be adressed in ZendEngine2 but I could be wrong. I suggest inquiring at the engine2 list. On Tue, Dec 03, 2002 at 08:53:25PM +, Ivan Ristic wrote : Balazs Nagy wrote: Hi, $this stays defined when an instantatiated member function calls a non-instantiated member function. Correct. I actually find it quite interesting. :) It can be useful at times, I have used it in my libraries as a feature. There is an interesting article on the subject: http://www.advogato.org/article/470.html -- 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] [PATCH] Changes to ext_skel for C++
J Smith wrote: That's what I was thinking. The new patch updates skeleton.c a bit and fixes ext_skel to either add extern C stuff to skeleton.c or get rid of it. I think it would be simpler for extension first-timers to not worry about what __cplusplus means, or why extern C is there in the first place, etc. It could always be (horror of horrors) comemented in the code. /* if we're using c++, we need some 'glue' */ #ifdef __cplusplus J Sterling Hughes wrote: Is there any reason the ifdef __cplusplus doesn't work? There shouldn't be any need for extra processing or config options. well, i think c++ code might confuse people just starting out writing a C extension... -Sterling -- PHP Development Mailing List http://www.php.net/ To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DEV] Zend fast cache
How does searching the freelist work in this? How is this faster than say a 3-level page table implementation? That said, I do think that if we can get very fast code to pre-allocate zval's it would be a good idea (hopefully we could get more than 5% increase). I already have an idea for how I would want such an API to look like and I was planning to write it. It would also be useful for Zend objects which are preallocated today but if a realloc() were to be reached it would take quite some time (although one or two realloc()'s wouldn't be terrible). My idea is a two dimensional array. We'd allocate 2^n of memory blocks and assign it to array[0]. Once these are full we'd allocate another 2^n memory blocks and realloc() array to size of 2 and make array[1] point to it. The index to a block would be X and to find the right position it'd be array[X/2^n][X%2^n] of course as the length of each array is a power of two we wouldn't actually need to use division and modulo so it'd be fast. As we don't have templates in C we might be able to put all of this inline in a header file and with macros create such a fast allocating pool for some of the most used types specifically I think it'd be useful for zval's, objects and possible hash tables. I wouldn't overdo the amount of types I'd add to this pool because unless they are allocated and freed extremely often we wouldn't notice a speed difference. But remember what I said about 5% :) Andi -- 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] Zend fast cache
The problem I see with an array approach from an api perspective is simply when a bucket is free'd, in order to have efficient memory usage, we'd need a second level array scan for every ALLOC_ZVAL(). Perhaps a linked list would be a better choice for this, as we can just be smart about bucket access, and eliminate the need for a scan (could be possible I'm missing something?) A number of memory allocators use a multi-tiered page table for this. basically for each object type you have a array of N pointers to level 1 objects and a freelist for them, basically tier one has N elements that each contain a freelist bitmask value and an array of pointers to level 2 objects. Level 2 objects have a freelist of N allocations for the desired object type and pointers to each of them. This may be what Andi was talking about, but it wasn't clear to me from his description. So you get N^3 aloocations you can track, and a freelist search involves looking at 3 bitmasks. Significantly faster than a linked list implementation. By keeping a separate tree for each allocation type (or at least allocation size), you also end up with basically no fragmentation. -Sterling -- 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] Zend fast cache
A little off-list discussion has sold me on the linked list implementation. Seems very fast and very simple. George On Saturday, November 30, 2002, at 07:53 PM, Daniel Cowgill wrote: On Saturday, November 30, 2002, at 07:17 PM, Sterling Hughes wrote: The problem I see with an array approach from an api perspective is simply when a bucket is free'd, in order to have efficient memory usage, we'd need a second level array scan for every ALLOC_ZVAL(). Perhaps a linked list would be a better choice for this, as we can just be smart about bucket access, and eliminate the need for a scan (could be possible I'm missing something?) I agree, a singly linked list seems like a no-brainer; it's an ideal memory-pool data structure because inserts and deletes occur only at the front of the list (so they're constant-time), the links are free, and the implementation is straightforward. -- 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] Reusing PHP string value pointers
Or use the overload extension in ZE1. The real question is why you really need/want to do this. George On Thursday, November 28, 2002, at 04:37 PM, l0t3k wrote: if you have the option of using ZE2, make the thing an object and use the property get/set handlers to take care of things for you Marshall A. Greenblatt [EMAIL PROTECTED] wrote in message 000d01c296fe$b0ff82f0$6601a8c0@Marshall">news:000d01c296fe$b0ff82f0$6601a8c0@Marshall... From: Zeev Suraski [EMAIL PROTECTED] When a PHP string variable is changed via a PHP script, such as: $foo = 'new value'; what happens to the `value.str.val' pointer internally? Is it possible to have the new value assigned to the same `value.str.val' pointer that the variable is currently using instead of having that pointer replaced by a pointer to the new value? No, it's not possible (not in a reliable way anyway). What about being able to register a callback function for variable assignment? That way I can keep track of the pointer myself and copy the new value to it when the variable value is changed in the PHP script. Would anybody else be interested in this functionality? Zeev Thanks, Marshall -- 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] C++ extensions and ext_skel
I concur, that would be cool. Patches should be against HEAD. George On Thursday, November 28, 2002, at 05:33 PM, Shane Caraveo wrote: I think that would be quite cool, save me from having to do it manualy. Shane J Smith wrote: A couple of times a month, I get questions about from people looking to use C++ with PHP. Apparently, a lot of people end up reading some post I made to php.dev or something a year or so ago about C++, and although it worked at the time, the procedure I describe has become stale. I messed around a bit with ext_skel and ext/skeleton today and added an option to ext_skel (--cpp) that creates a basic C++ extension rather than the standard C extension. The C++ extension is pretty much the same as the standard C extension, with the exception of some extern C linkage, modifications to config.m4 and Makefile.in and a small C++ class thrown in for fun. Would this be worth adding to PHP proper? I have patches available for 4.2.3, but if it's worthy, I can whip it up for 4.3 or whatever. It'll save me some email bandwidth if it could be used. J -- 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] call_stack
debug_backtrace was backported into ze1. 4.3 will sstill use ze1. George Phil Dier wrote: On Wed, 27 Nov 2002 15:41:25 +0100 (CET) Derick Rethans [EMAIL PROTECTED] wrote: On Wed, 27 Nov 2002, Miham KEREKES wrote: Hi! I'm new to this list, I want to know if there is any function which could return the actual call stack, or is it planned to be added? It could be very useful (for example in my case, now :-). debug_backtrace() will be available in PHP 4.3.0 and higher. Derick I thought debug_backtrace() was a ze2 thing. Does that mean 4.3 is going to use ze2? Phil Dier -- PHP Development Mailing List http://www.php.net/ To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DEV] call_stack
I'll do it, if you want. Andi Gutmans wrote: At 07:23 PM 11/27/2002 +0100, Derick Rethans wrote: On Wed, 27 Nov 2002, Andi Gutmans wrote: At 03:41 PM 11/27/2002 +0100, Derick Rethans wrote: On Wed, 27 Nov 2002, Miham KEREKES wrote: debug_backtrace() will be available in PHP 4.3.0 and higher. if someone has time to implement debug_print_backtrace() that would be cool. Using the raw debug_backtrace() is a bitch. If you're trying to volunteer me it's not going to work :P Damn! Maybe someone else? :) Andi -- PHP Development Mailing List http://www.php.net/ To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DEV] call_stack
Hmmm any hints on how to get the variable name out of the stack? The code in debug_backtrace seems to only extract the value. George Andi Gutmans wrote: I'd probably go for class::function($arg1, $arg2). Also take into consideration that the args aren't always available. Andi At 02:58 PM 11/27/2002 -0500, George Schlossnagle wrote: Is there a concensus on how arguments should be printed out? I'm shooting right now for a 'cluck' style backtrave class::function() called at file:line Perhaps class::function() called at file:line Arguments: print_r(args) ?? Andi Gutmans wrote: That'd be cool. At 01:32 PM 11/27/2002 -0500, George Schlossnagle wrote: I'll do it, if you want. Andi Gutmans wrote: At 07:23 PM 11/27/2002 +0100, Derick Rethans wrote: On Wed, 27 Nov 2002, Andi Gutmans wrote: At 03:41 PM 11/27/2002 +0100, Derick Rethans wrote: On Wed, 27 Nov 2002, Miham KEREKES wrote: debug_backtrace() will be available in PHP 4.3.0 and higher. if someone has time to implement debug_print_backtrace() that would be cool. Using the raw debug_backtrace() is a bitch. If you're trying to volunteer me it's not going to work :P Damn! Maybe someone else? :) Andi -- PHP Development Mailing List http://www.php.net/ To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DEV] call_stack
Ok... but that looks nasty when you are passed an array or an object. Andi Gutmans wrote: At 03:13 PM 11/27/2002 -0500, George Schlossnagle wrote: Hmmm any hints on how to get the variable name out of the stack? The code in debug_backtrace seems to only extract the value. There's no way but I don't think it's needed. When I wrote $arg1 I meant the value not the name of the variable. Sorry if I wasn't clear. Andi George Andi Gutmans wrote: I'd probably go for class::function($arg1, $arg2). Also take into consideration that the args aren't always available. Andi At 02:58 PM 11/27/2002 -0500, George Schlossnagle wrote: Is there a concensus on how arguments should be printed out? I'm shooting right now for a 'cluck' style backtrave class::function() called at file:line Perhaps class::function() called at file:line Arguments: print_r(args) ?? Andi Gutmans wrote: That'd be cool. At 01:32 PM 11/27/2002 -0500, George Schlossnagle wrote: I'll do it, if you want. Andi Gutmans wrote: At 07:23 PM 11/27/2002 +0100, Derick Rethans wrote: On Wed, 27 Nov 2002, Andi Gutmans wrote: At 03:41 PM 11/27/2002 +0100, Derick Rethans wrote: On Wed, 27 Nov 2002, Miham KEREKES wrote: debug_backtrace() will be available in PHP 4.3.0 and higher. if someone has time to implement debug_print_backtrace() that would be cool. Using the raw debug_backtrace() is a bitch. If you're trying to volunteer me it's not going to work :P Damn! Maybe someone else? :) Andi -- PHP Development Mailing List http://www.php.net/ To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DEV] call_stack
Here's first shot at a patch. The output it generates is ugly as sin if you use objects though. I though about flattening them out, but that gets long and nasty (and requires specialized print functions which while easy seem to be of marginal use elsewhere.) George Index: Zend/zend_builtin_functions.c === RCS file: /repository/Zend/zend_builtin_functions.c,v retrieving revision 1.127 diff -u -3 -r1.127 zend_builtin_functions.c --- Zend/zend_builtin_functions.c 27 Nov 2002 20:11:39 - 1.127 +++ Zend/zend_builtin_functions.c 27 Nov 2002 22:42:57 - @@ -68,6 +68,7 @@ static ZEND_FUNCTION(get_extension_funcs); static ZEND_FUNCTION(get_defined_constants); static ZEND_FUNCTION(debug_backtrace); +static ZEND_FUNCTION(debug_print_backtrace); #if ZEND_DEBUG static ZEND_FUNCTION(zend_test_func); #endif @@ -122,6 +123,7 @@ ZEND_FE(get_extension_funcs,NULL) ZEND_FE(get_defined_constants, NULL) ZEND_FE(debug_backtrace,NULL) + ZEND_FE(debug_print_backtrace, NULL) #if ZEND_DEBUG ZEND_FE(zend_test_func, NULL) #endif @@ -1171,6 +1173,151 @@ add_next_index_zval(arg_array, *arg); } return arg_array; +} + + +void debug_print_backtrace_args(zval *arg_array) +{ +zval **tmp; +HashPosition iterator; +int i = 0; + +zend_hash_internal_pointer_reset_ex(arg_array-value.ht, iterator); +while (zend_hash_get_current_data_ex(arg_array-value.ht, (void **) tmp, +iterator) == SUCCESS) { + if(i++) { + ZEND_PUTS(,); + } + zend_print_zval_r(*tmp, 4); + zend_hash_move_forward_ex(arg_array-value.ht, iterator); +} +} + +/* {{{ proto void debug_backtrace(void) + Prints out a backtrace */ +ZEND_FUNCTION(debug_print_backtrace) +{ + zend_execute_data *ptr; + int lineno; + char *function_name; + char *filename; + char *class_name; + char *call_type; + char *include_filename = NULL; + zval *stack_frame; + zval *arg_array; + void **cur_arg_pos = EG(argument_stack).top_element; + void **args = cur_arg_pos; + int arg_stack_consistent = 0; + int frames_on_stack = 0; + int indent = 0; + int i; + + if (ZEND_NUM_ARGS()) { + ZEND_WRONG_PARAM_COUNT(); + } + + while (--args = EG(argument_stack).elements) { + if (*args--) { + break; + } + args -= *(ulong*)args; + frames_on_stack++; + + if (args == EG(argument_stack).elements) { + arg_stack_consistent = 1; + break; + } + } + + ptr = EG(current_execute_data); + + /* skip debug_backtrace() */ + ptr = ptr-prev_execute_data; + cur_arg_pos -= 2; + frames_on_stack--; + + array_init(return_value); + + while (ptr) { + if (ptr-op_array) { + filename = ptr-op_array-filename; + lineno = ptr-opline-lineno; + } else { + filename = NULL; + } + + function_name = ptr-function_state.function-common.function_name; + + if (function_name) { + if (ptr-ce) { + class_name = ptr-ce-name; + call_type = ::; + } else if (ptr-object.ptr) { + class_name = ptr-object.ptr-value.obj.ce-name; + call_type = -; + } else { + class_name = NULL; + call_type = NULL; + } + if ((! ptr-opline) || ((ptr-opline-opcode == +ZEND_DO_FCALL_BY_NAME) || (ptr-opline-opcode == ZEND_DO_FCALL))) { + if (arg_stack_consistent (frames_on_stack 0)) { + arg_array = +debug_backtrace_get_args(cur_arg_pos TSRMLS_CC); + frames_on_stack--; + } + } + } else { + /* i know this is kinda ugly, but i'm trying to avoid extra +cycles in the main execution loop */ + zend_bool build_filename_arg = 1; + + switch (ptr-opline-op2.u.constant.value.lval) { + case ZEND_EVAL: + function_name = eval; + build_filename_arg = 0; + break; + case ZEND_INCLUDE: + function_name = include; +
Re: [PHP-DEV] call_stack
And here is a version which flattens the calling args onto a single line (similar to sebastians usersapce script). Longer, but a bit prettier output. Index: Zend/zend.c === RCS file: /repository/Zend/zend.c,v retrieving revision 1.163 diff -u -3 -r1.163 zend.c --- Zend/zend.c 17 Nov 2002 13:26:36 - 1.163 +++ Zend/zend.c 27 Nov 2002 23:07:00 - @@ -138,6 +138,35 @@ } +static void print_flat_hash(HashTable *ht) +{ + zval **tmp; + char *string_key; + HashPosition iterator; + ulong num_key; + uint str_len; + int i = 0; + + zend_hash_internal_pointer_reset_ex(ht, iterator); + while (zend_hash_get_current_data_ex(ht, (void **) tmp, iterator) == +SUCCESS) { + if(i++ 0) { + ZEND_PUTS(,); + } + ZEND_PUTS([); + switch (zend_hash_get_current_key_ex(ht, string_key, str_len, +num_key, 0, iterator)) { + case HASH_KEY_IS_STRING: + ZEND_PUTS(string_key); + break; + case HASH_KEY_IS_LONG: + zend_printf(%ld, num_key); + break; + } + ZEND_PUTS(] = ); + zend_print_flat_zval_r(*tmp); + zend_hash_move_forward_ex(ht, iterator); + } +} + ZEND_API void zend_make_printable_zval(zval *expr, zval *expr_copy, int *use_copy) { if (expr-type==IS_STRING) { @@ -215,6 +244,43 @@ } +ZEND_API void zend_print_flat_zval_r(zval *expr) +{ + zend_write_func_t write_func = zend_write; + + switch(expr-type) { + case IS_ARRAY: + ZEND_PUTS(Array (); + if (++expr-value.ht-nApplyCount1) { + ZEND_PUTS( *RECURSION*); + expr-value.ht-nApplyCount--; + return; + } + print_flat_hash(expr-value.ht); + ZEND_PUTS()); + expr-value.ht-nApplyCount--; + break; + case IS_OBJECT: + { + zend_object *object = Z_OBJ_P(expr); + + if (++object-properties-nApplyCount1) { + ZEND_PUTS( *RECURSION*); + object-properties-nApplyCount--; + return; + } + zend_printf(%s Object (, object-ce-name); + print_flat_hash(object-properties); + ZEND_PUTS()); + object-properties-nApplyCount--; + break; + } + default: + zend_print_variable(expr); + break; + } +} + ZEND_API void zend_print_zval_r(zval *expr, int indent) { zend_print_zval_r_ex(zend_write, expr, indent); @@ -253,6 +319,7 @@ break; } } + static FILE *zend_fopen_wrapper(const char *filename, char **opened_path) Index: Zend/zend.h === RCS file: /repository/Zend/zend.h,v retrieving revision 1.166 diff -u -3 -r1.166 zend.h --- Zend/zend.h 17 Nov 2002 13:26:36 - 1.166 +++ Zend/zend.h 27 Nov 2002 23:07:00 - @@ -383,6 +383,7 @@ ZEND_API int zend_print_zval(zval *expr, int indent); ZEND_API int zend_print_zval_ex(zend_write_func_t write_func, zval *expr, int indent); ZEND_API void zend_print_zval_r(zval *expr, int indent); +ZEND_API void zend_print_flat_zval_r(zval *expr); ZEND_API void zend_print_zval_r_ex(zend_write_func_t write_func, zval *expr, int indent); ZEND_API void zend_output_debug_string(zend_bool trigger_break, char *format, ...); Index: Zend/zend_builtin_functions.c === RCS file: /repository/Zend/zend_builtin_functions.c,v retrieving revision 1.127 diff -u -3 -r1.127 zend_builtin_functions.c --- Zend/zend_builtin_functions.c 27 Nov 2002 20:11:39 - 1.127 +++ Zend/zend_builtin_functions.c 27 Nov 2002 23:07:00 - @@ -68,6 +68,7 @@ static ZEND_FUNCTION(get_extension_funcs); static ZEND_FUNCTION(get_defined_constants); static ZEND_FUNCTION(debug_backtrace); +static ZEND_FUNCTION(debug_print_backtrace); #if ZEND_DEBUG static ZEND_FUNCTION(zend_test_func); #endif @@ -122,6 +123,7 @@ ZEND_FE(get_extension_funcs,NULL) ZEND_FE(get_defined_constants, NULL) ZEND_FE(debug_backtrace,NULL) + ZEND_FE(debug_print_backtrace, NULL) #if ZEND_DEBUG
Re: [PHP-DEV] [PATCH] Redirect on Error
I'm not really arguing for or against this, but since when did speaking english become a corollary of being intelligent? And even if we accept the rather ridiculous hypotheis that all php developers can comprehend english, what if they don't want to, or are more confident using their native tongue in day-to-day work? Why deny that to them on prinicple? Plenty of products support multi-lingual errors in the way John describes. In fact there's an argument that constant-based error codes are even easier to describe than verobose english descriptions, as they leave no room for ambiguity due to re-phrasing. Daniel Lorch wrote: hi, Daniel, Sterling is arguing in favor of having localized error messages. s/agree/disagree/ :) Do what you think is right. However, I think it just adds another level of unnecessary complexity. We can safely assume a certain level of intelligence when dealing with php developers (developers as in developing IN PHP). PHP is not a application as in Windows XP or Media Player, but it's a development environment where the users necessarily has to be confronted with a couple of error messages. For the sake of brevity, these are kept in english and this shouldn't change, IMAO. Developers don't have to be spoon-fed. Really. -daniel -- PHP Development Mailing List http://www.php.net/ To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DEV] [PATCH] Redirect on Error
Is your claim that db2 has no international error messages? It does, or did last I checked. Or was it that SQLServer doesn't either (it does as well). On Monday, November 25, 2002, at 08:24 PM, Ilia A. wrote: On November 25, 2002 08:15 pm, Maxim Maletsky wrote: On Tue, 26 Nov 2002 00:30:55 +0200 (EET) Jani Taskinen [EMAIL PROTECTED] wrote: Just forget this. I'm not native english speaker, but I REALLY don't want to see any errors in any other language but english. (does Perl/Python/etc have multi-lingual errors btw?) --Jani The world's most powerful database server does - Oracle. And, just type something out of the place and you will get them dozens :) That's arguable, there are many people who would say the same about IBM's DB2. According to TPC (http://www.tpc.org/tpcc/results/tpcc_perf_results.asp) Microsoft SQL Server 2000 is faster and has lower cost per transaction. So claims about greatness of Oracle and greatly exaggerated. Ilia -- 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] [PATCH] Redirect on Error
MySQL also supports error message internationalization - one more RDBMS to annoy Sterling, I guess. George On Monday, November 25, 2002, at 08:47 PM, Maxim Maletsky wrote: It was to say that these three (Oracle, SQL and DB2) do have internationalized error reporting. I meant them as an example for the one PHP has. -- Maxim Maletsky [EMAIL PROTECTED] On Mon, 25 Nov 2002 20:44:03 -0500 George Schlossnagle [EMAIL PROTECTED] wrote: Is your claim that db2 has no international error messages? It does, or did last I checked. Or was it that SQLServer doesn't either (it does as well). On Monday, November 25, 2002, at 08:24 PM, Ilia A. wrote: On November 25, 2002 08:15 pm, Maxim Maletsky wrote: On Tue, 26 Nov 2002 00:30:55 +0200 (EET) Jani Taskinen [EMAIL PROTECTED] wrote: Just forget this. I'm not native english speaker, but I REALLY don't want to see any errors in any other language but english. (does Perl/Python/etc have multi-lingual errors btw?) --Jani The world's most powerful database server does - Oracle. And, just type something out of the place and you will get them dozens :) That's arguable, there are many people who would say the same about IBM's DB2. According to TPC (http://www.tpc.org/tpcc/results/tpcc_perf_results.asp) Microsoft SQL Server 2000 is faster and has lower cost per transaction. So claims about greatness of Oracle and greatly exaggerated. Ilia -- 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 Development Mailing List http://www.php.net/ To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DEV] [PATCH] Redirect on Error
Oh, I'm sorry, I didn't realize you were going off-topic to pick at parts of Maxim's argument. My mistake. George On Monday, November 25, 2002, at 08:52 PM, Ilia A. wrote: On November 25, 2002 08:44 pm, George Schlossnagle wrote: Is your claim that db2 has no international error messages? It does, or did last I checked. Or was it that SQLServer doesn't either (it does as well). Uhm, did I say anything about i18n in DB2 or SQLServer, no. I merely pointed out that Oracle's status as most powerful database is in the eye of the beholder. Ilia On Monday, November 25, 2002, at 08:24 PM, Ilia A. wrote: On November 25, 2002 08:15 pm, Maxim Maletsky wrote: On Tue, 26 Nov 2002 00:30:55 +0200 (EET) Jani Taskinen [EMAIL PROTECTED] wrote: Just forget this. I'm not native english speaker, but I REALLY don't want to see any errors in any other language but english. (does Perl/Python/etc have multi-lingual errors btw?) --Jani The world's most powerful database server does - Oracle. And, just type something out of the place and you will get them dozens :) That's arguable, there are many people who would say the same about IBM's DB2. According to TPC (http://www.tpc.org/tpcc/results/tpcc_perf_results.asp) Microsoft SQL Server 2000 is faster and has lower cost per transaction. So claims about greatness of Oracle and greatly exaggerated. Ilia -- 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 Development Mailing List http://www.php.net/ To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DEV] [PATCH] Redirect on Error
By the way, could you please advise by how much I will need to increase the power of my server(s) to maintain the same level of performance? Why would this need to kill your performance if you're not throwing errors? -- PHP Development Mailing List http://www.php.net/ To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DEV] [PATCH] Redirect on Error
There is no proposed patch to affect all these changes. There are fine ways to print errors that don't necessitate having them loaded at run time. They could be in a dbm file, or even a flat file hierarchy and loaded on demand. This would not be as fast as a hash table, but when you're actually printing errors, a slight overhead seems acceptable (to me, ymmv) On Monday, November 25, 2002, at 10:27 PM, Ilia A. wrote: On November 25, 2002 09:59 pm, George Schlossnagle wrote: By the way, could you please advise by how much I will need to increase the power of my server(s) to maintain the same level of performance? Why would this need to kill your performance if you're not throwing errors? Because errors need to be loaded into memory by some mechanism, stored in a hash table? Meaning that during startup I will be penalized for this process. Hash table has it own overhead as well meaning that PHP memory usage will increase, for a server running 200-300 apache children constantly even a small increase will count. This will also make PHP shell scripting impractical due to the high start costs of a PHP binary. Ilia -- PHP Development Mailing List http://www.php.net/ To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DEV] [PATCH] Redirect on Error
On Monday, November 25, 2002, at 10:43 PM, Ilia A. wrote: On November 25, 2002 10:30 pm, George Schlossnagle wrote: There is no proposed patch to affect all these changes. There are fine ways to print errors that don't necessitate having them loaded at run time. They could be in a dbm file, or even a flat file hierarchy and loaded on demand. This would not be as fast as a hash table, but when you're actually printing errors, a slight overhead seems acceptable (to me, ymmv) If we were talking about a one time script that is execute and forget then you are absolutely right. But what about if a web server enviroment where a child/thread can remain in memory indefinitely. Or a web hosting enviroment where the admin has no control over the script of the users, loading (unloading?) of the error messages database will add overall overhead non the less. dbm lookups are fast, as are (to a lesser extent) file system lookups. Neither consume any process memory. Neither require an entire database to be loaded, simply to have the entry looked up in them. And if you're running an hosting service for users, performance is sort of out the window anyway. This is also not as easy as it sounds, for example a gettext a commonly used tool for localizations, is not thread safe, so we are looking at having to design a error localization mechanism with a thread safe disk database system. Well, fortunately, this being an open-source project this burden need not lie with you if you don't want it to. I'm somewhere between +0 and +1 on this issue. I think it would be helpful, a nice feature to have. and generally increase accessibility. I don't think that an implementation would necessarily incur overhead unless error functions are being called. George -- PHP Development Mailing List http://www.php.net/ To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DEV] [PATCH] Redirect on Error
On Monday, November 25, 2002, at 11:29 PM, Ilia A. wrote: On November 25, 2002 10:57 pm, George Schlossnagle wrote: On Monday, November 25, 2002, at 10:43 PM, Ilia A. wrote: On November 25, 2002 10:30 pm, George Schlossnagle wrote: There is no proposed patch to affect all these changes. There are fine ways to print errors that don't necessitate having them loaded at run time. They could be in a dbm file, or even a flat file hierarchy and loaded on demand. This would not be as fast as a hash table, but when you're actually printing errors, a slight overhead seems acceptable (to me, ymmv) If we were talking about a one time script that is execute and forget then you are absolutely right. But what about if a web server enviroment where a child/thread can remain in memory indefinitely. Or a web hosting enviroment where the admin has no control over the script of the users, loading (unloading?) of the error messages database will add overall overhead non the less. dbm lookups are fast, as are (to a lesser extent) file system lookups. Neither consume any process memory. Neither require an entire database to be loaded, simply to have the entry looked up in them. Nearly any singular operation is fast, the question is what happens when it is done often. For a database stored on disk we are talking at least 2-3 drive seeks + reading of meta information at the start of the database. While it may be negligible for a single process it does add up. Given that this done rarely (hopefuly) it would not result in major performance loss, however there will be a performance loss non the less. If you're throwing errors your script isn't working right anyway. syslog() logging is also extremely slow, especially if you're logging to a network host, but that's still supported in php. There are plenty of shocking inefficiencies in php. Adding one in the case of user error (which if you're running a site where an extra 3 drive seeks per error is a serious issue you should be disciplined enough not to be having at all) seems like a pittance to me. Well, fortunately, this being an open-source project this burden need not lie with you if you don't want it to. I dislike the idea because I believe this idea is going to make PHP more confusing and ultimately harder to use, which is the exact opposite of what this change attempts to accomplish. Fortunately this being an open-source project it is also possible to make your own version free of bloat :) It's hard for me to decide whether this is bloat or not. 2700-some builtin functions shipping with php seems much more like bloat to me than providing option i18n error messages to people who would prefer to read them. -- PHP Development Mailing List http://www.php.net/ To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DEV] Capturing headers with output buffering?
What are you trying to accomplish? On Sunday, November 24, 2002, at 05:40 PM, David Brown wrote: Hi: Architecturally speaking, is there any simple way to modify an sapi backend to return HTTP headers through the output buffering mechanism? As far as I can tell, headers are managed seperately by main/output.c, with php_ub_body_write_no_header being substituted in once the HTTP headers are sent. Pointers to anything would be greatly appreciated. TIA, - Dave -- 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] Capturing headers with output buffering?
Bad idea or not (I don't think it will be fast and there are some problems with some of the ideas you want to pull off, imho) I certainly believe that reinventing the wheel can be a healthy exercise. That having been said, most of what you want to accomplish here requires a single lon-living process. php only sends headers once per request/c[lg]i invocations , so this won't do what you're hoping for. Seems to me that you would want to do something like this, using the cli: startup listen while 1: accept read request set buffering true use a userspace function to generate headers use a userspace function to generate body capture buffer close buffer send captured buffer over socket You should be able to modify the sapi functions to buffer headers as well, but a) then your server is written in C, not in php and b) I think this isn't useful for too many applications. George On Sunday, November 24, 2002, at 06:06 PM, David Brown wrote: Hi George: It's something that's probably better solved in user-space, but I figured I'd poke around anyway. :) I'm attempting to write a little prefork HTTP server entirely in PHP. The script instansiates an 'application class', which is persistent across requests. Output of the application is captured with an ob_* callback function, and then stuffed down a socket. I'm hoping for free in-memory opcode caching and database connection persistence (by virtue of recycling the same interpreter across multiple requests), and possibly the elimination of a lot of application-specific startup time. Of course, this whole thing could very well just be a bad idea. :) Anyway, headers aren't currently included in the buffered output, which causes the header() function to print to stdout, effectively doing nothing. I could just wrap header() with a user-space function, but that would prevent a lot of scripts from running as-is. Bad idea? Maybe. There's also the matter of getting it to parse POST/GET without completely reinventing the wheel... - Dave On Sun, Nov 24, 2002 at 05:57:33PM -0500, George Schlossnagle wrote: | What are you trying to accomplish? | | | On Sunday, November 24, 2002, at 05:40 PM, David Brown wrote: | | Hi: | | Architecturally speaking, is there any simple way to modify an sapi | backend to return HTTP headers through the output buffering mechanism? | | As far as I can tell, headers are managed seperately by main/output.c, | with php_ub_body_write_no_header being substituted in once the HTTP | headers are sent. | | Pointers to anything would be greatly appreciated. | | TIA, | - Dave | | | -- | 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] ZEND_ADD_STRING patch
Hi, There is a problem with the patch committed. It incorrectly tokenizes things like $foo = %-{$bar} (this breaks the PEAR installer, amongst other things) I've attached a fix for it. Also, it looks like you didn't accept the part of the fix that allows for enhanced handling of heredocs. Is there a reason why? I'm sticking that in this patch again, in case you merged my last change by hand and missed that accidentally. On Friday, November 15, 2002, at 06:48 PM, George Schlossnagle wrote: Much sexier indeed. There are some flaws with it: o Tokenizes heredocs on whitespace o Doesn't count lines correctly for debug (since strings now have newlines in them) Here's a revised patch to yours that fixes those (heredocs are tokenized on newlines - I think that is best case) Andi Gutmans wrote: I propose something like the following: (not tested) It's definitely a sexier patch :) Andi RCS file: /repository/ZendEngine2/zend_language_scanner.l,v retrieving revision 1.62 diff -u -u -r1.62 zend_language_scanner.l --- zend_language_scanner.l 5 Nov 2002 22:01:35 - 1.62 +++ zend_language_scanner.l 15 Nov 2002 23:22:34 - @@ -474,6 +474,7 @@ EXPONENT_DNUM (({LNUM}|{DNUM})[eE][+-]?{LNUM}) HNUM 0x[0-9a-fA-F]+ LABEL [a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]* +ENCAPSED_STRING ([a-zA-Z0-9_\x7f-\xff \t\n\r #'.:;,()|^+/*=%!~?@]|-[^])+ WHITESPACE [ \n\r\t]+ TABS_AND_SPACES [ \t]* TOKENS [;:,.\[\]()|^+-/*=%!~$?@] @@ -1076,6 +1077,12 @@ return T_VARIABLE; } +ST_DOUBLE_QUOTES,ST_BACKQUOTE{ENCAPSED_STRING} { + zendlval-value.str.val = (char *)estrndup(yytext, yyleng); + zendlval-value.str.len = yyleng; + zendlval-type = IS_STRING; + return T_STRING; +} ST_IN_SCRIPTING{LABEL} { zendlval-value.str.val = (char *)estrndup(yytext, yyleng); @@ -1085,7 +1092,7 @@ } -ST_DOUBLE_QUOTES,ST_BACKQUOTE,ST_HEREDOC{LABEL} { +ST_HEREDOC{LABEL} { zendlval-value.str.val = (char *)estrndup(yytext, yyleng); zendlval-value.str.len = yyleng; zendlval-type = IS_STRING; @@ -1374,7 +1381,7 @@ } -ST_DOUBLE_QUOTES,ST_BACKQUOTE,ST_HEREDOC{ESCAPED_AND_WHITESPACE} { +ST_HEREDOC{ESCAPED_AND_WHITESPACE} { HANDLE_NEWLINES(yytext, yyleng); zendlval-value.str.val = (char *) estrndup(yytext, yyleng); zendlval-value.str.len = yyleng; Andi Index: Zend/zend_language_scanner.l === RCS file: /repository/Zend/zend_language_scanner.l,v retrieving revision 1.54 diff -u -3 -r1.54 zend_language_scanner.l --- Zend/zend_language_scanner.l 13 Nov 2002 03:28:23 - 1.54 +++ Zend/zend_language_scanner.l 15 Nov 2002 23:47:29 - @@ -95,7 +95,7 @@ \ while (pboundary) { \ if (*p == '\n') { \ - CG(zend_lineno)++; \ + CG(zend_lineno)++; \ } else if ((*p == '\r') (p+1 boundary) (*(p+1) != '\n')) { \ CG(zend_lineno)++; \ } \ @@ -707,6 +707,8 @@ EXPONENT_DNUM (({LNUM}|{DNUM})[eE][+-]?{LNUM}) HNUM 0x[0-9a-fA-F]+ LABEL [a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]* +ENCAPSED_STRING ([a-zA-Z0-9_\x7f-\xff \t #'.:;,()|^+/*=%!~?@]|-[^])+ +ENCAPSED_STRING_WITH_NEWLINE ([a-zA-Z0-9_\x7f-\xff \t\n\r #'.:;,()|^+/*=%!~?@]|-[^])+ WHITESPACE [ \n\r\t]+ TABS_AND_SPACES [ \t]* TOKENS [;:,.\[\]()|^+-/*=%!~$?@] @@ -1287,6 +1289,13 @@ return T_VARIABLE; } +ST_DOUBLE_QUOTES,ST_BACKQUOTE{ENCAPSED_STRING_WITH_NEWLINE} { + HANDLE_NEWLINES(yytext, yyleng); + zendlval-value.str.val = (char *)estrndup(yytext, yyleng); + zendlval-value.str.len = yyleng; + zendlval-type = IS_STRING; + return T_STRING; +} ST_IN_SCRIPTING{LABEL} { zend_copy_value(zendlval, yytext, yyleng); @@ -1295,7 +1304,7 @@ } -ST_DOUBLE_QUOTES,ST_BACKQUOTE,ST_HEREDOC{LABEL} { +ST_HEREDOC{ENCAPSED_STRING} { zend_copy_value(zendlval, yytext, yyleng); zendlval-type = IS_STRING; return T_STRING; @@ -1598,7 +1607,7 @@ } -ST_DOUBLE_QUOTES,ST_BACKQUOTE,ST_HEREDOC{ESCAPED_AND_WHITESPACE} { +ST_HEREDOC{ESCAPED_AND_WHITESPACE} { HANDLE_NEWLINES(yytext, yyleng); zendlval-value.str.val = (char *) estrndup(yytext, yyleng); zendlval-value.str.len = yyleng; -- 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] ZEND_ADD_STRING patch
Here's the patch. Looks like everything but the heredoc part is in cvs now. -- PHP Development Mailing List http://www.php.net/ To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DEV] ZEND_ADD_STRING patch
George Schlossnagle wrote: I'm a tool. I sent the wrong patch to the list. Thanks to Andrei for pointing it out. Here is the _right_ patch (finally). diff -u -3 -r1.53 zend_language_scanner.l --- zend_language_scanner.l8 Nov 2002 13:40:54 -1.53 +++ zend_language_scanner.l15 Nov 2002 20:20:33 - -37,6 +37,7 %x ST_BACKQUOTE %x ST_HEREDOC %x ST_LOOKING_FOR_PROPERTY +%x ST_EXPECTING_OBJECT %x ST_LOOKING_FOR_VARNAME %x ST_COMMENT %x ST_ONE_LINE_COMMENT -692,6 +693,7 HNUM0x[0-9a-fA-F]+ LABEL[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]* WHITESPACE [ \n\r\t]+ +LABEL_OR_WHITESPACE [a-zA-Z0-9_\x7f-\xff \t\n\r #'.:;,()|^+-/*=%!~?]+ TABS_AND_SPACES [ \t]* TOKENS [;:,.\[\]()|^+-/*=%!~$?] ENCAPSED_TOKENS [\[\]{}$] -823,13 +825,25 return T_EXTENDS; } -ST_IN_SCRIPTING,ST_DOUBLE_QUOTES,ST_BACKQUOTE,ST_HEREDOC- { +ST_DOUBLE_QUOTES,ST_BACKQUOTE,ST_HEREDOC${LABEL}-{LABEL} { +yy_push_state(ST_EXPECTING_OBJECT TSRMLS_CC); +yyless(0); +} + + +ST_IN_SCRIPTING,ST_EXPECTING_OBJECT- { yy_push_state(ST_LOOKING_FOR_PROPERTY TSRMLS_CC); return T_OBJECT_OPERATOR; } ST_LOOKING_FOR_PROPERTY{LABEL} { -yy_pop_state(TSRMLS_C); +if(yy_top_state(TSRMLS_C) == ST_EXPECTING_OBJECT) { +yy_pop_state(TSRMLS_C); +yy_pop_state(TSRMLS_C); +} +else { +yy_pop_state(TSRMLS_C); +} zend_copy_value(zendlval, yytext, yyleng); zendlval-value.str.len = yyleng; zendlval-type = IS_STRING; -1265,7 +1279,7 return T_INLINE_HTML; } -ST_IN_SCRIPTING,ST_DOUBLE_QUOTES,ST_HEREDOC,ST_BACKQUOTE${LABEL} { +ST_EXPECTING_OBJECT,ST_IN_SCRIPTING,ST_DOUBLE_QUOTES,ST_HEREDOC,ST_BACKQUOTE${LABEL} { zend_copy_value(zendlval, (yytext+1), (yyleng-1)); zendlval-type = IS_STRING; return T_VARIABLE; -1278,13 +1292,26 return T_STRING; } - -ST_DOUBLE_QUOTES,ST_BACKQUOTE,ST_HEREDOC{LABEL} { +ST_DOUBLE_QUOTES,ST_BACKQUOTE{LABEL_OR_WHITESPACE} { +HANDLE_NEWLINES(yytext, yyleng); zend_copy_value(zendlval, yytext, yyleng); zendlval-type = IS_STRING; return T_STRING; } +ST_HEREDOC{LABEL} { +zend_copy_value(zendlval, yytext, yyleng); +zendlval-type = IS_STRING; +return T_STRING; +} + +ST_HEREDOC{ESCAPED_AND_WHITESPACE} { +HANDLE_NEWLINES(yytext, yyleng); +zendlval-value.str.val = (char *) estrndup(yytext, yyleng); +zendlval-value.str.len = yyleng; +zendlval-type = IS_STRING; +return T_ENCAPSED_AND_WHITESPACE; +} ST_IN_SCRIPTING{WHITESPACE} { zendlval-value.str.val = yytext; /* no copying - intentional */ -1581,14 +1608,6 } } - -ST_DOUBLE_QUOTES,ST_BACKQUOTE,ST_HEREDOC{ESCAPED_AND_WHITESPACE} { -HANDLE_NEWLINES(yytext, yyleng); -zendlval-value.str.val = (char *) estrndup(yytext, yyleng); -zendlval-value.str.len = yyleng; -zendlval-type = IS_STRING; -return T_ENCAPSED_AND_WHITESPACE; -} ST_SINGLE_QUOTE([^'\\]|\\[^'\\])+ { HANDLE_NEWLINES(yytext, yyleng); -- PHP Development Mailing List http://www.php.net/ To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DEV] ZEND_ADD_STRING patch
Andi Gutmans wrote: Try it out and let me know how the results are. Also *please* send diffs also as attachments so that when people apply them we won't get bad whitespace in our sources. php-dev seems to eat my attachments -- PHP Development Mailing List http://www.php.net/ To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DEV] ZEND_ADD_STRING patch
Much sexier indeed. There are some flaws with it: o Tokenizes heredocs on whitespace o Doesn't count lines correctly for debug (since strings now have newlines in them) Here's a revised patch to yours that fixes those (heredocs are tokenized on newlines - I think that is best case) Andi Gutmans wrote: I propose something like the following: (not tested) It's definitely a sexier patch :) Andi RCS file: /repository/ZendEngine2/zend_language_scanner.l,v retrieving revision 1.62 diff -u -u -r1.62 zend_language_scanner.l --- zend_language_scanner.l 5 Nov 2002 22:01:35 - 1.62 +++ zend_language_scanner.l 15 Nov 2002 23:22:34 - -474,6 +474,7 EXPONENT_DNUM (({LNUM}|{DNUM})[eE][+-]?{LNUM}) HNUM 0x[0-9a-fA-F]+ LABEL [a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]* +ENCAPSED_STRING ([a-zA-Z0-9_\x7f-\xff \t\n\r #'.:;,()|^+/*=%!~?]|-[^])+ WHITESPACE [ \n\r\t]+ TABS_AND_SPACES [ \t]* TOKENS [;:,.\[\]()|^+-/*=%!~$?] -1076,6 +1077,12 return T_VARIABLE; } +ST_DOUBLE_QUOTES,ST_BACKQUOTE{ENCAPSED_STRING} { + zendlval-value.str.val = (char *)estrndup(yytext, yyleng); + zendlval-value.str.len = yyleng; + zendlval-type = IS_STRING; + return T_STRING; +} ST_IN_SCRIPTING{LABEL} { zendlval-value.str.val = (char *)estrndup(yytext, yyleng); -1085,7 +1092,7 } -ST_DOUBLE_QUOTES,ST_BACKQUOTE,ST_HEREDOC{LABEL} { +ST_HEREDOC{LABEL} { zendlval-value.str.val = (char *)estrndup(yytext, yyleng); zendlval-value.str.len = yyleng; zendlval-type = IS_STRING; -1374,7 +1381,7 } -ST_DOUBLE_QUOTES,ST_BACKQUOTE,ST_HEREDOC{ESCAPED_AND_WHITESPACE} { +ST_HEREDOC{ESCAPED_AND_WHITESPACE} { HANDLE_NEWLINES(yytext, yyleng); zendlval-value.str.val = (char *) estrndup(yytext, yyleng); zendlval-value.str.len = yyleng; Andi Index: Zend/zend_language_scanner.l === RCS file: /repository/Zend/zend_language_scanner.l,v retrieving revision 1.54 diff -u -3 -r1.54 zend_language_scanner.l --- Zend/zend_language_scanner.l13 Nov 2002 03:28:23 - 1.54 +++ Zend/zend_language_scanner.l15 Nov 2002 23:47:29 - -95,7 +95,7 \ while (pboundary) { \ if (*p == '\n') { \ - CG(zend_lineno)++; \ + CG(zend_lineno)++; + \ } else if ((*p == '\r') (p+1 boundary) (*(p+1) != '\n')) { \ CG(zend_lineno)++; \ } \ -707,6 +707,8 EXPONENT_DNUM (({LNUM}|{DNUM})[eE][+-]?{LNUM}) HNUM 0x[0-9a-fA-F]+ LABEL [a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]* +ENCAPSED_STRING ([a-zA-Z0-9_\x7f-\xff \t #'.:;,()|^+/*=%!~?]|-[^])+ +ENCAPSED_STRING_WITH_NEWLINE ([a-zA-Z0-9_\x7f-\xff \t\n\r +#'.:;,()|^+/*=%!~?]|-[^])+ WHITESPACE [ \n\r\t]+ TABS_AND_SPACES [ \t]* TOKENS [;:,.\[\]()|^+-/*=%!~$?] -1287,6 +1289,13 return T_VARIABLE; } +ST_DOUBLE_QUOTES,ST_BACKQUOTE{ENCAPSED_STRING_WITH_NEWLINE} { + HANDLE_NEWLINES(yytext, yyleng); + zendlval-value.str.val = (char *)estrndup(yytext, yyleng); + zendlval-value.str.len = yyleng; + zendlval-type = IS_STRING; + return T_STRING; +} ST_IN_SCRIPTING{LABEL} { zend_copy_value(zendlval, yytext, yyleng); -1295,7 +1304,7 } -ST_DOUBLE_QUOTES,ST_BACKQUOTE,ST_HEREDOC{LABEL} { +ST_HEREDOC{ENCAPSED_STRING} { zend_copy_value(zendlval, yytext, yyleng); zendlval-type = IS_STRING; return T_STRING; -1598,7 +1607,7 } -ST_DOUBLE_QUOTES,ST_BACKQUOTE,ST_HEREDOC{ESCAPED_AND_WHITESPACE} { +ST_HEREDOC{ESCAPED_AND_WHITESPACE} { HANDLE_NEWLINES(yytext, yyleng); zendlval-value.str.val = (char *) estrndup(yytext, yyleng); zendlval-value.str.len = yyleng; -- PHP Development Mailing List http://www.php.net/ To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DEV] Re: apache_hooks
So I will take this course of action after 4.3.0 is branched. Any objections? George On Sunday, November 10, 2002, at 09:40 PM, Rasmus Lerdorf wrote: Hrm.. That's not a bad idea. An ApacheHooks SAPI module sounds like the right approach to me. -R On Sun, 10 Nov 2002, George Schlossnagle wrote: While most of the code in main/ is changed minimally, the changes to the SAPI/apache stuff are pretty extensive. It may make sense to ifdef the changes in main and create a new SAPI module for this. I bend to the majority though. :) On Sunday, November 3, 2002, at 03:49 AM, Rasmus Lerdorf wrote: Well, since 99% of the code is the same, I'd be worried about people remembering to merge fixes across. At least if it is ifdef'ed people see the code. But yes, I agree, that's not pretty either. -R On Sun, 3 Nov 2002, George Schlossnagle wrote: Either way works for me. Psychologically, I think it may get higher exposure if it is #ifdef'd, but I have style reservations about doing that. How has this sort of thing been done in the past? Is it undesirable to fork the apache sapi into a new 'apache_hooks' sapi? That may be easiest. George On Saturday, November 2, 2002, at 05:58 PM, Rasmus Lerdorf wrote: What do you think would be the best way to make the apache_hooks code more accessible to people? A tarball with the relevant files that overwrites the standard files, or perhaps it is time to #ifdef it into the main branch? -Rasmus // George Schlossnagle // Principal Consultant // OmniTI, Inc http://www.omniti.com // (c) 240.460.5234 (e) [EMAIL PROTECTED] // 1024D/1100A5A0 1370 F70A 9365 96C9 2F5E 56C2 B2B9 262F 1100 A5A0 -- 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] [RFC] adding sapi_module_struct.pretty_name to $_SERVER
How do people feel about adding the pretty name as $_SERVER['SAPI']? -- PHP Development Mailing List http://www.php.net/ To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DEV] ZEND_ADD_STRING patch
Hi Andi, The last patch I submitted was broken as well. Following that, I had the bright idea to run the prospective changes through the unit-tester to ensure correct performance. Here's a patch which achieves that. It does not work for heredocs (i.e. they are tokenized as before, but behave correctly from a language perspective), but otherwise optimizes correctly. Here you go: diff -u -3 -r1.53 zend_language_scanner.l --- Zend/zend_language_scanner.l8 Nov 2002 13:40:54 -1.53 +++ Zend/zend_language_scanner.l12 Nov 2002 22:11:31 - -37,6 +37,7 %x ST_BACKQUOTE %x ST_HEREDOC %x ST_LOOKING_FOR_PROPERTY +%x ST_EXPECTING_OBJECT %x ST_LOOKING_FOR_VARNAME %x ST_COMMENT %x ST_ONE_LINE_COMMENT -692,6 +693,7 HNUM0x[0-9a-fA-F]+ LABEL[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]* WHITESPACE [ \n\r\t]+ +LABEL_OR_WHITESPACE [a-zA-Z0-9_\x7f-\xff \t\n\r #'.:;,()|^+-/*=%!~?]+ TABS_AND_SPACES [ \t]* TOKENS [;:,.\[\]()|^+-/*=%!~$?] ENCAPSED_TOKENS [\[\]{}$] -823,13 +825,22 return T_EXTENDS; } -ST_IN_SCRIPTING,ST_DOUBLE_QUOTES,ST_BACKQUOTE,ST_HEREDOC- { +ST_DOUBLE_QUOTES,ST_BACKQUOTE,ST_HEREDOC${LABEL}-{LABEL} { +yy_push_state(ST_EXPECTING_OBJECT TSRMLS_CC); +yyless(0); +} + + +ST_IN_SCRIPTING,ST_EXPECTING_OBJECT- { yy_push_state(ST_LOOKING_FOR_PROPERTY TSRMLS_CC); return T_OBJECT_OPERATOR; } ST_LOOKING_FOR_PROPERTY{LABEL} { yy_pop_state(TSRMLS_C); +if(yy_top_state(TSRMLS_C) == ST_EXPECTING_OBJECT) { +yy_pop_state(TSRMLS_C); +} zend_copy_value(zendlval, yytext, yyleng); zendlval-value.str.len = yyleng; zendlval-type = IS_STRING; -1265,7 +1276,7 return T_INLINE_HTML; } -ST_IN_SCRIPTING,ST_DOUBLE_QUOTES,ST_HEREDOC,ST_BACKQUOTE${LABEL} { +ST_EXPECTING_OBJECT,ST_IN_SCRIPTING,ST_DOUBLE_QUOTES,ST_HEREDOC,ST_BACKQUOTE${LABEL} { zend_copy_value(zendlval, (yytext+1), (yyleng-1)); zendlval-type = IS_STRING; return T_VARIABLE; -1278,13 +1289,26 return T_STRING; } - -ST_DOUBLE_QUOTES,ST_BACKQUOTE,ST_HEREDOC{LABEL} { +ST_DOUBLE_QUOTES,ST_BACKQUOTE{LABEL_OR_WHITESPACE} { +HANDLE_NEWLINES(yytext, yyleng); zend_copy_value(zendlval, yytext, yyleng); zendlval-type = IS_STRING; return T_STRING; } +ST_HEREDOC{LABEL} { +zend_copy_value(zendlval, yytext, yyleng); +zendlval-type = IS_STRING; +return T_STRING; +} + +ST_HEREDOC{ESCAPED_AND_WHITESPACE} { +HANDLE_NEWLINES(yytext, yyleng); +zendlval-value.str.val = (char *) estrndup(yytext, yyleng); +zendlval-value.str.len = yyleng; +zendlval-type = IS_STRING; +return T_ENCAPSED_AND_WHITESPACE; +} ST_IN_SCRIPTING{WHITESPACE} { zendlval-value.str.val = yytext; /* no copying - intentional */ -1581,14 +1605,6 } } - -ST_DOUBLE_QUOTES,ST_BACKQUOTE,ST_HEREDOC{ESCAPED_AND_WHITESPACE} { -HANDLE_NEWLINES(yytext, yyleng); -zendlval-value.str.val = (char *) estrndup(yytext, yyleng); -zendlval-value.str.len = yyleng; -zendlval-type = IS_STRING; -return T_ENCAPSED_AND_WHITESPACE; -} ST_SINGLE_QUOTE([^'\\]|\\[^'\\])+ { HANDLE_NEWLINES(yytext, yyleng); -- PHP Development Mailing List http://www.php.net/ To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DEV] ZEND_ADD_STRING patch
The patch I submitted included BACKQUOTES in the token matching as well. I'm not convinced that is bad, but I will try to thoroughly test it tomorrow, and if it's broken, I'll just case it for and heredocs. George On Monday, November 11, 2002, at 01:56 AM, Andi Gutmans wrote: OH I missed that. I'll check it out this evening as I have to go now. Andi At 01:48 AM 11/11/2002 -0500, George Schlossnagle wrote: Unless I misunderstand the way this works, it's not a problem that it returns a T_STRING, only possibly that it does so inside a BACKQUOTES. Function names and constants aren't available as barewords in DOUBLE_QUOTES or HEREDOCs, right? On Monday, November 11, 2002, at 01:12 AM, Andi Gutmans wrote: Hi, A patch which improves on this would be welcome. However, this patch at first glance is bogus. You are returning T_STRING with possible spaces and other non A-Za-z_ chars. This token is also used as tokens such as constants and function names . Andi At 06:31 PM 11/10/2002 -0500, George Schlossnagle wrote: that would be my debugging from my 'clean' cvs copy. :) You don't want that. Sorry. Here's a better patch: Index: zend_language_scanner.l === RCS file: /repository/Zend/zend_language_scanner.l,v retrieving revision 1.51 diff -u -3 -r1.51 zend_language_scanner.l --- zend_language_scanner.l 2 Nov 2002 16:32:26 - 1.51 +++ zend_language_scanner.l 10 Nov 2002 23:30:28 - @@ -686,6 +686,7 @@ HNUM 0x[0-9a-fA-F]+ LABEL [a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]* WHITESPACE [ \n\r\t]+ +LABEL_OR_WHITESPACE [a-zA-Z0-9_\x7f-\xff \n\t\r #'.:;,()|^+-/*=%!~?@]+ TABS_AND_SPACES [ \t]* TOKENS [;:,.\[\]()|^+-/*=%!~$?@] ENCAPSED_TOKENS [\[\]{}$] @@ -1269,7 +1270,7 @@ } -ST_DOUBLE_QUOTES,ST_BACKQUOTE,ST_HEREDOC{LABEL} { +ST_DOUBLE_QUOTES,ST_BACKQUOTE,ST_HEREDOC{LABEL_OR_WHITESPACE} { zend_copy_value(zendlval, yytext, yyleng); zendlval-type = IS_STRING; return T_STRING; @@ -1569,15 +1570,6 @@ zendlval-type = IS_STRING; return T_STRING; } -} - - -ST_DOUBLE_QUOTES,ST_BACKQUOTE,ST_HEREDOC{ESCAPED_AND_WHITESPACE} { - HANDLE_NEWLINES(yytext, yyleng); - zendlval-value.str.val = (char *) estrndup(yytext, yyleng); - zendlval-value.str.len = yyleng; - zendlval-type = IS_STRING; - return T_ENCAPSED_AND_WHITESPACE; } ST_SINGLE_QUOTE([^'\\]|\\[^'\\])+ { On Sunday, November 10, 2002, at 06:25 PM, Moriyoshi Koizumi wrote: --snip +fprintf(stderr, %s:%d\n, __FILE__,__LINE__); What's this fprintf()? This seems to be put just for debugging purpose. Moriyosh return T_STRING; } -ST_DOUBLE_QUOTES,ST_BACKQUOTE,ST_HEREDOC{LABEL_OR_WHITESPACE} { +ST_DOUBLE_QUOTES,ST_BACKQUOTE,ST_HEREDOC{LABEL} { zend_copy_value(zendlval, yytext, yyleng); zendlval-type = IS_STRING; +fprintf(stderr, %s:%d\n, __FILE__,__LINE__); return T_STRING; } @@ -1572,6 +1573,15 @@ } } + +ST_DOUBLE_QUOTES,ST_BACKQUOTE,ST_HEREDOC{ESCAPED_AND_WHITESPACE } { + HANDLE_NEWLINES(yytext, yyleng); + zendlval-value.str.val = (char *) estrndup(yytext, yyleng); + zendlval-value.str.len = yyleng; + zendlval-type = IS_STRING; + return T_ENCAPSED_AND_WHITESPACE; +} + ST_SINGLE_QUOTE([^'\\]|\\[^'\\])+ { HANDLE_NEWLINES(yytext, yyleng); zend_copy_value(zendlval, yytext, yyleng); On Sunday, November 10, 2002, at 06:05 PM, Paul Nicholson wrote: -BEGIN PGP SIGNED MESSAGE- Hash: SHA1 It's the list, I don't think they allow attachmentsdo you have web space you could upload to? On Sunday 10 November 2002 05:16 pm, Derick Rethans wrote: On Sun, 10 Nov 2002, George Schlossnagle wrote: For those who came to Dan my or Derick's talk at the Int. PHP Conference, we both covered the bad inefficiency in the parser that results in strings with variables in them being tokenized on whitespace. This results in a huge number of unnecessary opcodes in strings. Attached (hopefully, as my new MUA seems to be fickle) is a first shot at a fix to the parser to keep this from happening, so that you don't need an optimizer to clear up this issue. I've tested this locally. It still introduces a single unnecessary opcode after variable in certain cases, but it works for me. hmm, your MUA is getting senile :) no attachment... Derick - -- ~Paul Nicholson Design Specialist @ WebPower Design The webthe way you want it! [EMAIL PROTECTED] www.webpowerdesign.net It said uses Windows 98 or better, so I loaded Linux! Registered Linux User #183202 using Register Linux System # 81891 -BEGIN PGP SIGNATURE- Version: GnuPG v1.0.6 (GNU/Linux) Comment: For info see http://www.gnupg.org iD8DBQE9zuZNDyXNIUN3+UQRAlYEAJ9PE5IKScOc+7/Kk1a71jJ87o7+EgCfV9z7 u+KZNZj2lZWzXmRiZmYrq4U= =ChWV -END PGP SIGNATURE- -- PHP
Re: [PHP-DEV] ZEND_ADD_STRING patch
Hi, You're right. This patch should address that concern: diff -u -3 -r1.51 zend_language_scanner.l --- zend_language_scanner.l 2 Nov 2002 16:32:26 - 1.51 +++ zend_language_scanner.l 11 Nov 2002 22:17:09 - @@ -32,6 +32,7 @@ %} %x ST_IN_SCRIPTING +%x ST_EXPECTING_OBJECT %x ST_DOUBLE_QUOTES %x ST_SINGLE_QUOTE %x ST_BACKQUOTE @@ -686,6 +687,7 @@ HNUM 0x[0-9a-fA-F]+ LABEL [a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]* WHITESPACE [ \n\r\t]+ +LABEL_OR_WHITESPACE [a-zA-Z0-9_\x7f-\xff \n\t\r #'.:;,()|^+-/*=%!~?@]+ TABS_AND_SPACES [ \t]* TOKENS [;:,.\[\]()|^+-/*=%!~$?@] ENCAPSED_TOKENS [\[\]{}$] @@ -817,7 +819,13 @@ return T_EXTENDS; } -ST_IN_SCRIPTING,ST_DOUBLE_QUOTES,ST_BACKQUOTE,ST_HEREDOC- { +ST_IN_SCRIPTING,ST_DOUBLE_QUOTES,ST_BACKQUOTE,ST_HEREDOC${LABEL}- {LABEL} { +yy_push_state(ST_EXPECTING_OBJECT TSRMLS_CC); +yyless(0); +} + +ST_EXPECTING_OBJECT,ST_IN_SCRIPTING,ST_DOUBLE_QUOTES,ST_BACKQUOTE,ST_H EREDOC- { +fprintf(stderr, matched T_OBJECT_OPERATOR\n); yy_push_state(ST_LOOKING_FOR_PROPERTY TSRMLS_CC); return T_OBJECT_OPERATOR; } @@ -830,7 +838,7 @@ return T_STRING; } -ST_LOOKING_FOR_PROPERTY{ANY_CHAR} { +ST_EXPECTING_OBJECT,ST_LOOKING_FOR_PROPERTY{ANY_CHAR} { yyless(0); yy_pop_state(TSRMLS_C); } @@ -1255,7 +1263,7 @@ return T_INLINE_HTML; } -ST_IN_SCRIPTING,ST_DOUBLE_QUOTES,ST_HEREDOC,ST_BACKQUOTE${LABEL} { +ST_EXPECTING_OBJECT,ST_IN_SCRIPTING,ST_DOUBLE_QUOTES,ST_HEREDOC,ST_BAC KQUOTE${LABEL} { zend_copy_value(zendlval, (yytext+1), (yyleng-1)); zendlval-type = IS_STRING; return T_VARIABLE; @@ -1269,7 +1277,7 @@ } -ST_DOUBLE_QUOTES,ST_BACKQUOTE,ST_HEREDOC{LABEL} { +ST_DOUBLE_QUOTES,ST_BACKQUOTE,ST_HEREDOC{LABEL_OR_WHITESPACE} { zend_copy_value(zendlval, yytext, yyleng); zendlval-type = IS_STRING; return T_STRING; @@ -1569,15 +1577,6 @@ zendlval-type = IS_STRING; return T_STRING; } -} - - -ST_DOUBLE_QUOTES,ST_BACKQUOTE,ST_HEREDOC{ESCAPED_AND_WHITESPACE} { - HANDLE_NEWLINES(yytext, yyleng); - zendlval-value.str.val = (char *) estrndup(yytext, yyleng); - zendlval-value.str.len = yyleng; - zendlval-type = IS_STRING; - return T_ENCAPSED_AND_WHITESPACE; } ST_SINGLE_QUOTE([^'\\]|\\[^'\\])+ { On Monday, November 11, 2002, at 02:44 PM, Andi Gutmans wrote: Hi, I still think the patch isn't good. encaps_list which is the main parser rule can parse: T_VARIABLE T_OBJECT_OPERATOR T_STRING Your version of T_STRING would break this. Again I might be missing something but my hunch is that it would break. Andi At 03:06 AM 11/11/2002 -0500, George Schlossnagle wrote: The patch I submitted included BACKQUOTES in the token matching as well. I'm not convinced that is bad, but I will try to thoroughly test it tomorrow, and if it's broken, I'll just case it for and heredocs. George On Monday, November 11, 2002, at 01:56 AM, Andi Gutmans wrote: OH I missed that. I'll check it out this evening as I have to go now. Andi At 01:48 AM 11/11/2002 -0500, George Schlossnagle wrote: Unless I misunderstand the way this works, it's not a problem that it returns a T_STRING, only possibly that it does so inside a BACKQUOTES. Function names and constants aren't available as barewords in DOUBLE_QUOTES or HEREDOCs, right? On Monday, November 11, 2002, at 01:12 AM, Andi Gutmans wrote: Hi, A patch which improves on this would be welcome. However, this patch at first glance is bogus. You are returning T_STRING with possible spaces and other non A-Za-z_ chars. This token is also used as tokens such as constants and function names . Andi At 06:31 PM 11/10/2002 -0500, George Schlossnagle wrote: that would be my debugging from my 'clean' cvs copy. :) You don't want that. Sorry. Here's a better patch: Index: zend_language_scanner.l == = RCS file: /repository/Zend/zend_language_scanner.l,v retrieving revision 1.51 diff -u -3 -r1.51 zend_language_scanner.l --- zend_language_scanner.l 2 Nov 2002 16:32:26 - 1.51 +++ zend_language_scanner.l 10 Nov 2002 23:30:28 - @@ -686,6 +686,7 @@ HNUM 0x[0-9a-fA-F]+ LABEL [a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]* WHITESPACE [ \n\r\t]+ +LABEL_OR_WHITESPACE [a-zA-Z0-9_\x7f-\xff \n\t\r #'.:;,()|^+-/*=%!~?@]+ TABS_AND_SPACES [ \t]* TOKENS [;:,.\[\]()|^+-/*=%!~$?@] ENCAPSED_TOKENS [\[\]{}$] @@ -1269,7 +1270,7 @@ } -ST_DOUBLE_QUOTES,ST_BACKQUOTE,ST_HEREDOC{LABEL} { +ST_DOUBLE_QUOTES,ST_BACKQUOTE,ST_HEREDOC{LABEL_OR_WHITESPACE} { zend_copy_value(zendlval, yytext, yyleng); zendlval-type = IS_STRING; return T_STRING; @@ -1569,15 +1570,6 @@ zendlval-type = IS_STRING; return T_STRING; } -} - - - ST_DOUBLE_QUOTES,ST_BACKQUOTE,ST_HEREDOC{ESCAPED_AND_WHITESPACE} { - HANDLE_NEWLINES
Re: [PHP-DEV] turning strlen() into an opcode
Funny, it's in the message my mua said it sent (the 2nd time). How is this? It's also in pear/PECL/optimizer/zend.patch On Sunday, November 10, 2002, at 06:11 AM, Derick Rethans wrote: On Sat, 9 Nov 2002, George Schlossnagle wrote: Hehe. I should attach the patch, eh? Yes, you should... but you still didn't do that :-) Derick -- --- Derick Rethans http://derickrethans.nl/ JDI Media Solutions --[ if you hold a unix shell to your ear, do you hear the c? ]- -- PHP Development Mailing List http://www.php.net/ To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DEV] ZEND_ADD_STRING patch
For those who came to Dan my or Derick's talk at the Int. PHP Conference, we both covered the bad inefficiency in the parser that results in strings with variables in them being tokenized on whitespace. This results in a huge number of unnecessary opcodes in strings. Attached (hopefully, as my new MUA seems to be fickle) is a first shot at a fix to the parser to keep this from happening, so that you don't need an optimizer to clear up this issue. I've tested this locally. It still introduces a single unnecessary opcode after variable in certain cases, but it works for me. George -- PHP Development Mailing List http://www.php.net/ To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DEV] ZEND_ADD_STRING patch
On Sunday, November 10, 2002, at 05:06 PM, George Schlossnagle wrote: For those who came to Dan my or Derick's talk at the Int. PHP Conference, we both covered the bad inefficiency in the parser that results in strings with variables in them being tokenized on whitespace. This results in a huge number of unnecessary opcodes in strings. Attached (hopefully, as my new MUA seems to be fickle) is a first shot at a fix to the parser to keep this from happening, so that you don't need an optimizer to clear up this issue. I've tested this locally. It still introduces a single unnecessary opcode after variable in certain cases, but it works for me. George -- 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] ZEND_ADD_STRING patch
I got the second attachment mail ok but I'll just inline it here: --- Zend/zend_language_scanner.l2002-11-10 16:53:27.0 -0500 +++ /Users/george/src/php4/Zend/zend_language_scanner.l 2002-11-10 16:39:11.0 -0500 @@ -686,7 +686,6 @@ HNUM 0x[0-9a-fA-F]+ LABEL [a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]* WHITESPACE [ \n\r\t]+ -LABEL_OR_WHITESPACE [a-zA-Z0-9_\x7f-\xff \n\t\r #'.:;,()|^+-/*=%!~?@]+ TABS_AND_SPACES [ \t]* TOKENS [;:,.\[\]()|^+-/*=%!~$?@] ENCAPSED_TOKENS [\[\]{}$] @@ -1266,13 +1265,15 @@ ST_IN_SCRIPTING{LABEL} { zend_copy_value(zendlval, yytext, yyleng); zendlval-type = IS_STRING; +fprintf(stderr, %s:%d\n, __FILE__,__LINE__); return T_STRING; } -ST_DOUBLE_QUOTES,ST_BACKQUOTE,ST_HEREDOC{LABEL_OR_WHITESPACE} { +ST_DOUBLE_QUOTES,ST_BACKQUOTE,ST_HEREDOC{LABEL} { zend_copy_value(zendlval, yytext, yyleng); zendlval-type = IS_STRING; +fprintf(stderr, %s:%d\n, __FILE__,__LINE__); return T_STRING; } @@ -1572,6 +1573,15 @@ } } + +ST_DOUBLE_QUOTES,ST_BACKQUOTE,ST_HEREDOC{ESCAPED_AND_WHITESPACE} { + HANDLE_NEWLINES(yytext, yyleng); + zendlval-value.str.val = (char *) estrndup(yytext, yyleng); + zendlval-value.str.len = yyleng; + zendlval-type = IS_STRING; + return T_ENCAPSED_AND_WHITESPACE; +} + ST_SINGLE_QUOTE([^'\\]|\\[^'\\])+ { HANDLE_NEWLINES(yytext, yyleng); zend_copy_value(zendlval, yytext, yyleng); On Sunday, November 10, 2002, at 06:05 PM, Paul Nicholson wrote: -BEGIN PGP SIGNED MESSAGE- Hash: SHA1 It's the list, I don't think they allow attachmentsdo you have web space you could upload to? On Sunday 10 November 2002 05:16 pm, Derick Rethans wrote: On Sun, 10 Nov 2002, George Schlossnagle wrote: For those who came to Dan my or Derick's talk at the Int. PHP Conference, we both covered the bad inefficiency in the parser that results in strings with variables in them being tokenized on whitespace. This results in a huge number of unnecessary opcodes in strings. Attached (hopefully, as my new MUA seems to be fickle) is a first shot at a fix to the parser to keep this from happening, so that you don't need an optimizer to clear up this issue. I've tested this locally. It still introduces a single unnecessary opcode after variable in certain cases, but it works for me. hmm, your MUA is getting senile :) no attachment... Derick - -- ~Paul Nicholson Design Specialist @ WebPower Design The webthe way you want it! [EMAIL PROTECTED] www.webpowerdesign.net It said uses Windows 98 or better, so I loaded Linux! Registered Linux User #183202 using Register Linux System # 81891 -BEGIN PGP SIGNATURE- Version: GnuPG v1.0.6 (GNU/Linux) Comment: For info see http://www.gnupg.org iD8DBQE9zuZNDyXNIUN3+UQRAlYEAJ9PE5IKScOc+7/Kk1a71jJ87o7+EgCfV9z7 u+KZNZj2lZWzXmRiZmYrq4U= =ChWV -END PGP SIGNATURE- -- PHP Development Mailing List http://www.php.net/ To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DEV] ZEND_ADD_STRING patch
that would be my debugging from my 'clean' cvs copy. :) You don't want that. Sorry. Here's a better patch: Index: zend_language_scanner.l === RCS file: /repository/Zend/zend_language_scanner.l,v retrieving revision 1.51 diff -u -3 -r1.51 zend_language_scanner.l --- zend_language_scanner.l 2 Nov 2002 16:32:26 - 1.51 +++ zend_language_scanner.l 10 Nov 2002 23:30:28 - @@ -686,6 +686,7 @@ HNUM 0x[0-9a-fA-F]+ LABEL [a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]* WHITESPACE [ \n\r\t]+ +LABEL_OR_WHITESPACE [a-zA-Z0-9_\x7f-\xff \n\t\r #'.:;,()|^+-/*=%!~?@]+ TABS_AND_SPACES [ \t]* TOKENS [;:,.\[\]()|^+-/*=%!~$?@] ENCAPSED_TOKENS [\[\]{}$] @@ -1269,7 +1270,7 @@ } -ST_DOUBLE_QUOTES,ST_BACKQUOTE,ST_HEREDOC{LABEL} { +ST_DOUBLE_QUOTES,ST_BACKQUOTE,ST_HEREDOC{LABEL_OR_WHITESPACE} { zend_copy_value(zendlval, yytext, yyleng); zendlval-type = IS_STRING; return T_STRING; @@ -1569,15 +1570,6 @@ zendlval-type = IS_STRING; return T_STRING; } -} - - -ST_DOUBLE_QUOTES,ST_BACKQUOTE,ST_HEREDOC{ESCAPED_AND_WHITESPACE} { - HANDLE_NEWLINES(yytext, yyleng); - zendlval-value.str.val = (char *) estrndup(yytext, yyleng); - zendlval-value.str.len = yyleng; - zendlval-type = IS_STRING; - return T_ENCAPSED_AND_WHITESPACE; } ST_SINGLE_QUOTE([^'\\]|\\[^'\\])+ { On Sunday, November 10, 2002, at 06:25 PM, Moriyoshi Koizumi wrote: --snip +fprintf(stderr, %s:%d\n, __FILE__,__LINE__); What's this fprintf()? This seems to be put just for debugging purpose. Moriyosh return T_STRING; } -ST_DOUBLE_QUOTES,ST_BACKQUOTE,ST_HEREDOC{LABEL_OR_WHITESPACE} { +ST_DOUBLE_QUOTES,ST_BACKQUOTE,ST_HEREDOC{LABEL} { zend_copy_value(zendlval, yytext, yyleng); zendlval-type = IS_STRING; +fprintf(stderr, %s:%d\n, __FILE__,__LINE__); return T_STRING; } @@ -1572,6 +1573,15 @@ } } + +ST_DOUBLE_QUOTES,ST_BACKQUOTE,ST_HEREDOC{ESCAPED_AND_WHITESPACE} { + HANDLE_NEWLINES(yytext, yyleng); + zendlval-value.str.val = (char *) estrndup(yytext, yyleng); + zendlval-value.str.len = yyleng; + zendlval-type = IS_STRING; + return T_ENCAPSED_AND_WHITESPACE; +} + ST_SINGLE_QUOTE([^'\\]|\\[^'\\])+ { HANDLE_NEWLINES(yytext, yyleng); zend_copy_value(zendlval, yytext, yyleng); On Sunday, November 10, 2002, at 06:05 PM, Paul Nicholson wrote: -BEGIN PGP SIGNED MESSAGE- Hash: SHA1 It's the list, I don't think they allow attachmentsdo you have web space you could upload to? On Sunday 10 November 2002 05:16 pm, Derick Rethans wrote: On Sun, 10 Nov 2002, George Schlossnagle wrote: For those who came to Dan my or Derick's talk at the Int. PHP Conference, we both covered the bad inefficiency in the parser that results in strings with variables in them being tokenized on whitespace. This results in a huge number of unnecessary opcodes in strings. Attached (hopefully, as my new MUA seems to be fickle) is a first shot at a fix to the parser to keep this from happening, so that you don't need an optimizer to clear up this issue. I've tested this locally. It still introduces a single unnecessary opcode after variable in certain cases, but it works for me. hmm, your MUA is getting senile :) no attachment... Derick - -- ~Paul Nicholson Design Specialist @ WebPower Design The webthe way you want it! [EMAIL PROTECTED] www.webpowerdesign.net It said uses Windows 98 or better, so I loaded Linux! Registered Linux User #183202 using Register Linux System # 81891 -BEGIN PGP SIGNATURE- Version: GnuPG v1.0.6 (GNU/Linux) Comment: For info see http://www.gnupg.org iD8DBQE9zuZNDyXNIUN3+UQRAlYEAJ9PE5IKScOc+7/Kk1a71jJ87o7+EgCfV9z7 u+KZNZj2lZWzXmRiZmYrq4U= =ChWV -END PGP SIGNATURE- -- 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 Development Mailing List http://www.php.net/ To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DEV] Re: apache_hooks
While most of the code in main/ is changed minimally, the changes to the SAPI/apache stuff are pretty extensive. It may make sense to ifdef the changes in main and create a new SAPI module for this. I bend to the majority though. :) On Sunday, November 3, 2002, at 03:49 AM, Rasmus Lerdorf wrote: Well, since 99% of the code is the same, I'd be worried about people remembering to merge fixes across. At least if it is ifdef'ed people see the code. But yes, I agree, that's not pretty either. -R On Sun, 3 Nov 2002, George Schlossnagle wrote: Either way works for me. Psychologically, I think it may get higher exposure if it is #ifdef'd, but I have style reservations about doing that. How has this sort of thing been done in the past? Is it undesirable to fork the apache sapi into a new 'apache_hooks' sapi? That may be easiest. George On Saturday, November 2, 2002, at 05:58 PM, Rasmus Lerdorf wrote: What do you think would be the best way to make the apache_hooks code more accessible to people? A tarball with the relevant files that overwrites the standard files, or perhaps it is time to #ifdef it into the main branch? -Rasmus // George Schlossnagle // Principal Consultant // OmniTI, Inc http://www.omniti.com // (c) 240.460.5234 (e) [EMAIL PROTECTED] // 1024D/1100A5A0 1370 F70A 9365 96C9 2F5E 56C2 B2B9 262F 1100 A5A0 -- PHP Development Mailing List http://www.php.net/ To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DEV] ZEND_ADD_STRING patch
Unless I misunderstand the way this works, it's not a problem that it returns a T_STRING, only possibly that it does so inside a BACKQUOTES. Function names and constants aren't available as barewords in DOUBLE_QUOTES or HEREDOCs, right? On Monday, November 11, 2002, at 01:12 AM, Andi Gutmans wrote: Hi, A patch which improves on this would be welcome. However, this patch at first glance is bogus. You are returning T_STRING with possible spaces and other non A-Za-z_ chars. This token is also used as tokens such as constants and function names . Andi At 06:31 PM 11/10/2002 -0500, George Schlossnagle wrote: that would be my debugging from my 'clean' cvs copy. :) You don't want that. Sorry. Here's a better patch: Index: zend_language_scanner.l === RCS file: /repository/Zend/zend_language_scanner.l,v retrieving revision 1.51 diff -u -3 -r1.51 zend_language_scanner.l --- zend_language_scanner.l 2 Nov 2002 16:32:26 - 1.51 +++ zend_language_scanner.l 10 Nov 2002 23:30:28 - @@ -686,6 +686,7 @@ HNUM 0x[0-9a-fA-F]+ LABEL [a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]* WHITESPACE [ \n\r\t]+ +LABEL_OR_WHITESPACE [a-zA-Z0-9_\x7f-\xff \n\t\r #'.:;,()|^+-/*=%!~?@]+ TABS_AND_SPACES [ \t]* TOKENS [;:,.\[\]()|^+-/*=%!~$?@] ENCAPSED_TOKENS [\[\]{}$] @@ -1269,7 +1270,7 @@ } -ST_DOUBLE_QUOTES,ST_BACKQUOTE,ST_HEREDOC{LABEL} { +ST_DOUBLE_QUOTES,ST_BACKQUOTE,ST_HEREDOC{LABEL_OR_WHITESPACE} { zend_copy_value(zendlval, yytext, yyleng); zendlval-type = IS_STRING; return T_STRING; @@ -1569,15 +1570,6 @@ zendlval-type = IS_STRING; return T_STRING; } -} - - -ST_DOUBLE_QUOTES,ST_BACKQUOTE,ST_HEREDOC{ESCAPED_AND_WHITESPACE} { - HANDLE_NEWLINES(yytext, yyleng); - zendlval-value.str.val = (char *) estrndup(yytext, yyleng); - zendlval-value.str.len = yyleng; - zendlval-type = IS_STRING; - return T_ENCAPSED_AND_WHITESPACE; } ST_SINGLE_QUOTE([^'\\]|\\[^'\\])+ { On Sunday, November 10, 2002, at 06:25 PM, Moriyoshi Koizumi wrote: --snip +fprintf(stderr, %s:%d\n, __FILE__,__LINE__); What's this fprintf()? This seems to be put just for debugging purpose. Moriyosh return T_STRING; } -ST_DOUBLE_QUOTES,ST_BACKQUOTE,ST_HEREDOC{LABEL_OR_WHITESPACE} { +ST_DOUBLE_QUOTES,ST_BACKQUOTE,ST_HEREDOC{LABEL} { zend_copy_value(zendlval, yytext, yyleng); zendlval-type = IS_STRING; +fprintf(stderr, %s:%d\n, __FILE__,__LINE__); return T_STRING; } @@ -1572,6 +1573,15 @@ } } + +ST_DOUBLE_QUOTES,ST_BACKQUOTE,ST_HEREDOC{ESCAPED_AND_WHITESPACE} { + HANDLE_NEWLINES(yytext, yyleng); + zendlval-value.str.val = (char *) estrndup(yytext, yyleng); + zendlval-value.str.len = yyleng; + zendlval-type = IS_STRING; + return T_ENCAPSED_AND_WHITESPACE; +} + ST_SINGLE_QUOTE([^'\\]|\\[^'\\])+ { HANDLE_NEWLINES(yytext, yyleng); zend_copy_value(zendlval, yytext, yyleng); On Sunday, November 10, 2002, at 06:05 PM, Paul Nicholson wrote: -BEGIN PGP SIGNED MESSAGE- Hash: SHA1 It's the list, I don't think they allow attachmentsdo you have web space you could upload to? On Sunday 10 November 2002 05:16 pm, Derick Rethans wrote: On Sun, 10 Nov 2002, George Schlossnagle wrote: For those who came to Dan my or Derick's talk at the Int. PHP Conference, we both covered the bad inefficiency in the parser that results in strings with variables in them being tokenized on whitespace. This results in a huge number of unnecessary opcodes in strings. Attached (hopefully, as my new MUA seems to be fickle) is a first shot at a fix to the parser to keep this from happening, so that you don't need an optimizer to clear up this issue. I've tested this locally. It still introduces a single unnecessary opcode after variable in certain cases, but it works for me. hmm, your MUA is getting senile :) no attachment... Derick - -- ~Paul Nicholson Design Specialist @ WebPower Design The webthe way you want it! [EMAIL PROTECTED] www.webpowerdesign.net It said uses Windows 98 or better, so I loaded Linux! Registered Linux User #183202 using Register Linux System # 81891 -BEGIN PGP SIGNATURE- Version: GnuPG v1.0.6 (GNU/Linux) Comment: For info see http://www.gnupg.org iD8DBQE9zuZNDyXNIUN3+UQRAlYEAJ9PE5IKScOc+7/Kk1a71jJ87o7+EgCfV9z7 u+KZNZj2lZWzXmRiZmYrq4U= =ChWV -END PGP SIGNATURE- -- 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 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 Development Mailing
Re: [PHP-DEV] turning strlen() into an opcode
Here's the patch that Dan and I put together for the optimizer we talked about at the conference. It basically provides a defaulted-to-null function pointer that is the default case for the main execute() loop. This allows people to define their own opcodes without having to copy the source code for execute part and parcel into their own zend_execute() just to add a new opcodes. This is useful both for optimizers (like the one now in PECL/optimizer), as well as for implementing custom opcodes like what you want here without a huge engine patch. George On Friday, November 8, 2002, at 05:18 PM, Andrei Zmievski wrote: On Sat, 09 Nov 2002, Andi Gutmans wrote: I am very much against anything like this. Improving strlen()'s performance only will have a negligible performance impact on a real world script. With the same kind of argument you could probably find 10-20 functions which would be faster if you'd make opcodes for them. That's not really what you'd want to do. Also, the patch isn't quite the same functionality wise because strlen in your patch is a reserved word. This isn't my main problem though as it could be solved. Just out of curiousity, what are the problems with making it a reserved word and how could it be solved? If you want to really help improve performance of real-world scripts then try and find a way to improve performance of *all* function calls, i.e., of the extension API; and not by moving functions from the extension API into the core. No big deal. This just came up at the PHP conference in Germany during a chat with George and Thies. -Andrei http://www.gravitonic.com/ * If Bill Gates had a nickel for every time Windows crashed.. Oh, wait.. * -- PHP Development Mailing List http://www.php.net/ To unsubscribe, visit: http://www.php.net/unsub.php // George Schlossnagle // Principal Consultant // OmniTI, Inc http://www.omniti.com // (c) 240.460.5234 (e) [EMAIL PROTECTED] // 1024D/1100A5A0 1370 F70A 9365 96C9 2F5E 56C2 B2B9 262F 1100 A5A0 -- PHP Development Mailing List http://www.php.net/ To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DEV] turning strlen() into an opcode
Hehe. I should attach the patch, eh? On Saturday, November 9, 2002, at 09:15 PM, George Schlossnagle wrote: Here's the patch that Dan and I put together for the optimizer we talked about at the conference. It basically provides a defaulted-to-null function pointer that is the default case for the main execute() loop. This allows people to define their own opcodes without having to copy the source code for execute part and parcel into their own zend_execute() just to add a new opcodes. This is useful both for optimizers (like the one now in PECL/optimizer), as well as for implementing custom opcodes like what you want here without a huge engine patch. George On Friday, November 8, 2002, at 05:18 PM, Andrei Zmievski wrote: On Sat, 09 Nov 2002, Andi Gutmans wrote: I am very much against anything like this. Improving strlen()'s performance only will have a negligible performance impact on a real world script. With the same kind of argument you could probably find 10-20 functions which would be faster if you'd make opcodes for them. That's not really what you'd want to do. Also, the patch isn't quite the same functionality wise because strlen in your patch is a reserved word. This isn't my main problem though as it could be solved. Just out of curiousity, what are the problems with making it a reserved word and how could it be solved? If you want to really help improve performance of real-world scripts then try and find a way to improve performance of *all* function calls, i.e., of the extension API; and not by moving functions from the extension API into the core. No big deal. This just came up at the PHP conference in Germany during a chat with George and Thies. -Andrei http://www.gravitonic.com/ * If Bill Gates had a nickel for every time Windows crashed.. Oh, wait.. * -- PHP Development Mailing List http://www.php.net/ To unsubscribe, visit: http://www.php.net/unsub.php // George Schlossnagle // Principal Consultant // OmniTI, Inc http://www.omniti.com // (c) 240.460.5234 (e) [EMAIL PROTECTED] // 1024D/1100A5A0 1370 F70A 9365 96C9 2F5E 56C2 B2B9 262F 1100 A5A0 -- 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: apache_hooks
Either way works for me. Psychologically, I think it may get higher exposure if it is #ifdef'd, but I have style reservations about doing that. How has this sort of thing been done in the past? Is it undesirable to fork the apache sapi into a new 'apache_hooks' sapi? That may be easiest. George On Saturday, November 2, 2002, at 05:58 PM, Rasmus Lerdorf wrote: What do you think would be the best way to make the apache_hooks code more accessible to people? A tarball with the relevant files that overwrites the standard files, or perhaps it is time to #ifdef it into the main branch? -Rasmus // George Schlossnagle // Principal Consultant // OmniTI, Inc http://www.omniti.com // (c) 240.460.5234 (e) [EMAIL PROTECTED] // 1024D/1100A5A0 1370 F70A 9365 96C9 2F5E 56C2 B2B9 262F 1100 A5A0 -- PHP Development Mailing List http://www.php.net/ To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DEV] I hope this is the last email about this :)
That was +1 for changing it to off. :) On Sunday, October 27, 2002, at 09:37 PM, George Schlossnagle wrote: +1 unless it is set as an INI_ANY, then +0. George On Sunday, October 27, 2002, at 09:05 PM, Zeev Suraski wrote: Thank you for the detailed explanation, I'm sure everybody understands it now. Let's go for the voting phase. I vote we keep PHP-CLI with implicit_flush on by default. You vote against. Can we get some other votes now (not opinions, everything was already said a dozen times, just votes to get this over with). Thanks! Zeev At 15:11 25/10/2002, Yasuo Ohgaki wrote: Zeev Suraski wrote: At 09:15 25/10/2002, Yasuo Ohgaki wrote: Zeev Suraski wrote: You print something, it doesn't print out. How is it trivial to solve this? If you happen to know that there's IO buffering and that there's a function called flush() then maybe it trivial, but then there are the other million users who don't. Hence the idea of setting is to implicit flush for the masses, who not only don't know about the existence of flush(), but also don't know why it's even necessary. Ok. If we are argue about what is mass or not Don't forget about - millions(?) of _current_ PHP users who are used to implicit_flush=off by default. Few of them use CLI. As I mentioned already, people are used to implicit_off=off and it's the default of other SAPIs, therefore, it's not intuitive for existing users. If we aren't care about much about existing users base, I think we should set short_tag=Off by default, but you're insisting it should be on even if much fewer people are using. I'm confused. People expects PHP/CLI behave like Apache SAPI, CGI SAPI, etc. Well, if I weren't developer and didn't know discussion, I'll certainly write bug report that implicit flush is enabled wrongly. - millions of decent programmers who are used to _usual_ behavior. I consider myself a decent programmer, and I also consider the need to flush explicitly extremely annoying. Moreover, many PHP programmers (if not most) aren't used to this 'usual' behavior, because they either never programmed in another language, or they still didn't bump into that specific behavior. Don't you think flushing is needed only very limited applications? i.e. We don't write interactive CUI applications much now a days. - millions of scripts/echo/print don't need automatic flush at all. i.e. much fewer number of script/echo/print need auto flushing. It doesn't matter. When you're screwed by the lack of implicit flush, it's much worse than a mere slow down. Hmm. Since console is line buffered. There aren't many thing that is missed by implicit flushing. Please list programming languages (i.e. not shell) that do automatic/inefficient/unneeded flushing by default in program mode. Read my fingertips - PHP IN CLI MODE. There's one, that's the only one I care about. My point is we should learn from many smart peoples designs' of languages. If we are argue about difficulty of flushing, We're not. We're arguing about the obscurity of the problem. implicit_flush=On is obscure for current users. Suppose not flushing is extremely obscure, but default is better to set which is better/suitable for more occasions and is better to be consistent with other SAPIs. Is this the main point of auto flushing? If there are other points, please list them. -- Yasuo Ohgaki -- PHP Development Mailing List http://www.php.net/ To unsubscribe, visit: http://www.php.net/unsub.php // George Schlossnagle // Principal Consultant // OmniTI, Inc http://www.omniti.com // (c) 240.460.5234 (e) [EMAIL PROTECTED] // 1024D/1100A5A0 1370 F70A 9365 96C9 2F5E 56C2 B2B9 262F 1100 A5A0 -- 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] I hope this is the last email about this :)
Indeed it appears to be... +0 then. :) On Monday, October 28, 2002, at 07:44 AM, Zeev Suraski wrote: At 18:37 27/10/2002, George Schlossnagle wrote: +1 unless it is set as an INI_ANY, then +0. It's already INI_ANY... -- PHP Development Mailing List http://www.php.net/ To unsubscribe, visit: http://www.php.net/unsub.php // George Schlossnagle // Principal Consultant // OmniTI, Inc http://www.omniti.com // (c) 240.460.5234 (e) [EMAIL PROTECTED] // 1024D/1100A5A0 1370 F70A 9365 96C9 2F5E 56C2 B2B9 262F 1100 A5A0 -- PHP Development Mailing List http://www.php.net/ To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DEV] RFC: CLI behave like SH or PERL/RUBY/PYTHON?
I'm not a big fan of doing things the smart way. How hard is it to just set ob_implicit_flush() on and off? If you want it off, just set it off (or on, as the default ends up set) at the head of your script. George On Wednesday, October 23, 2002, at 04:11 AM, Kristian Koehntopp wrote: On Wednesday 23 October 2002 09:41, Edin Kadribasic wrote: OTOH, having implicit_flush turned on makes writing interactive command line programs easier. Some programs (like pear installer) might even depend on it. The proper way around this, as I see it, is to flush at the end of line, and before each read operation on an interactive tty. This would give you the performance of implicit_flush off with the proper interactive behaviour. I'd like to call this implicit_flush = smart. Kristian -- PHP Development Mailing List http://www.php.net/ To unsubscribe, visit: http://www.php.net/unsub.php // George Schlossnagle // Principal Consultant // OmniTI, Inc http://www.omniti.com // (c) 240.460.5234 (e) [EMAIL PROTECTED] // 1024D/1100A5A0 1370 F70A 9365 96C9 2F5E 56C2 B2B9 262F 1100 A5A0 -- PHP Development Mailing List http://www.php.net/ To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DEV] RFC: CLI behave like SH or PERL/RUBY/PYTHON?
Not to be snarky, but I for one would prefer PHP to behave like PHP. ;) Without having to make everyone here sort through the commit messages, can you briefly list out the proposed changes? George On Wednesday, October 23, 2002, at 02:26 AM, Yasuo Ohgaki wrote: I thought it's obvious choice, but it seems it's not. Which one you prefer CLI behave like SH or PERL/RUBY/PYTHON -- Yasuo Ohgaki -- PHP Development Mailing List http://www.php.net/ To unsubscribe, visit: http://www.php.net/unsub.php // George Schlossnagle // Principal Consultant // OmniTI, Inc http://www.omniti.com // (c) 240.460.5234 (e) [EMAIL PROTECTED] // 1024D/1100A5A0 1370 F70A 9365 96C9 2F5E 56C2 B2B9 262F 1100 A5A0 -- PHP Development Mailing List http://www.php.net/ To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DEV] RFC: CLI behave like SH or PERL/RUBY/PYTHON?
That statement about character devices being line bufffered isn't quite true, but otherwise I would say +0. Line buffering stdout and unbuffering stderr seems to be the default of most languages. On Wednesday, October 23, 2002, at 02:45 AM, Yasuo Ohgaki wrote: George Schlossnagle wrote: Not to be snarky, but I for one would prefer PHP to behave like PHP. ;) Without having to make everyone here sort through the commit messages, can you briefly list out the proposed changes? Oops. Sorry, I forgot. It's about flushing output every output statement. SH and current CLI does fflush() on stdout with echo A while others don't. And this setting cannot be changed by php.ini. User has to pass -D implicit_flush=Off as command line option. As we all know, character devices flushes by newline, so flushing is not really needed. If user would like to do flush, flush() function may be used (or change php.ini) -- Yasuo Ohgaki George On Wednesday, October 23, 2002, at 02:26 AM, Yasuo Ohgaki wrote: I thought it's obvious choice, but it seems it's not. Which one you prefer CLI behave like SH or PERL/RUBY/PYTHON -- Yasuo Ohgaki -- PHP Development Mailing List http://www.php.net/ To unsubscribe, visit: http://www.php.net/unsub.php // George Schlossnagle // Principal Consultant // OmniTI, Inc http://www.omniti.com // (c) 240.460.5234 (e) [EMAIL PROTECTED] // 1024D/1100A5A0 1370 F70A 9365 96C9 2F5E 56C2 B2B9 262F 1100 A5A0 -- 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] Xerces?
Has anyone started any work work on this? On Wednesday, October 16, 2002, at 05:59 PM, Rasmus Lerdorf wrote: There is only Sablotron support. No Xerces. Feel free to contribute the code to support Xerces. -Rasmus On Wed, 16 Oct 2002, Alex Black wrote: Hi all, I have done limited looking but as far as I can tell Xerces is not supported by PHP. A) hopefully I am wrong and just didn't look hard enough. B) If not, any validating parsers that are supported that do DTD validation? It looks like there's an experimental Xalan ext out there, but no Xerces. I have a vague memory of the XML setup being generalized to allow (x) parsers, did that happen, etc? In any case, if there aren't any validating parsers supported by PHP... There should be :) Please respond to the binarycloud-dev list also... Thanks, _alex -- 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 // George Schlossnagle // Principal Consultant // OmniTI, Inc http://www.omniti.com // (c) 240.460.5234 (e) [EMAIL PROTECTED] // 1024D/1100A5A0 1370 F70A 9365 96C9 2F5E 56C2 B2B9 262F 1100 A5A0 -- PHP Development Mailing List http://www.php.net/ To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DEV] Segfaults in Zend
Can you give the source for that function and the arguments it's being passed/context it is used in? Jan Schneider wrote: Zitat von Yasuo Ohgaki [EMAIL PROTECTED]: 0x4055778f in _efree (ptr=0x83476e4) at /home/jan/software/php4/Zend/zend_alloc.c:229 229 REMOVE_POINTER_FROM_LIST(p); (gdb) bt #0 0x4055778f in _efree (ptr=0x83476e4) at /home/jan/software/php4/Zend/zend_alloc.c:229 #1 0x405664a1 in _zval_dtor (zvalue=0x83456bc) at /home/jan/software/php4/Zend/zend_variables.c:44 #2 0x4055e4c1 in _zval_ptr_dtor (zval_ptr=0x40605714) at /home/jan/software/php4/Zend/zend_execute_API.c:293 #3 0x4057516d in execute (op_array=0x835c0c4) If you could tell us what execute() is trying to execute, it would be useful. (gdb) frame 3 #3 0x4057516d in execute (op_array=0x8353ebc) at /home/jan/software/php4/Zend/zend_execute_locks.h:26 26 zval_ptr_dtor(EG(garbage)[--EG(garbage_ptr)]); (gdb) print (char *)(executor_globals.function_state_ptr-function)-common.function_name $1 = 0x82f313c flist flist() is the function mentioned earlier, that segfaults while returning to the calling function. Did you read my email? (and the URL?) http://bugs.php.net/bugs-generating-backtrace.php Sorry, I didn't know that it has been updated with instructions on how to locate the segfaulting function. Jan. -- http://www.horde.org - The Horde Project http://www.ammma.de - discover your knowledge http://www.tip4all.de - Deine private Tippgemeinschaft -- PHP Development Mailing List http://www.php.net/ To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DEV] Feature ./ correction to design flaw request
One reason would be to allow for a product like APD to do JIT swapping of executors to enable tracing on demand. I imagine you could come up with a clever way of letting Zend (En|De)coder be used for oly prticular clients in a large vhosting operation as well (although I don't really know how that product works.) George Andi Gutmans wrote: If there's no concrete reason it is needed I think things should stay as they are. One reason - it's slower, probably not noticeable but it still is. Andi At 03:06 PM 10/14/2002 +0100, Nick Lindridge wrote: why would one want to have different executors/compilers in different threads? I can't answer this question Thies, and one could achieve it as-is by having a thread safe delegator, but as far as possible I'd suggest that publicly exposed features of the engine should work across supported platforms, and isn't the case with these hooks. I remember the days when myself and other kids were writing machine code non-flicker software on Sinclair ZX80's, and that was thought of as 'impossible' (as the CRT hardware was driven by software and any operations caused flicker), but actually this was possible if you'd a Z80 handbook to hand and didn't mind counting instruction cyles on all the possible branch paths, and pulled some tricks. This is just in my view and experience, but people will always use features and do things that designers of said features could never have conceived. Equally people will solve problems in different ways to others, and one has to mindful of this and accordingly endeavour to design without artificial constraints. If one knows that modifiable globals should be made thread safe on a threaded server then unless there's a good reason to not do it, it should be done, and not omitted just because the developer 'didn't think that it would be useful'. Genuine omissions, as was probably the case here, are fine, and we all make them, but should then be scheduled for correction once discovered for the benefit of future developments, and to improve the quality of the product as a whole. -- 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] Feature ./ correction to design flaw request
As I just told Nick in private mail, I personally like my bubble. It has nice translucent walls, keeps me dry when it's wet, and warm when it's cold. All talk of bubbles aside though it seems like there are potential applications for this. Andi Gutmans wrote: At 09:49 PM 10/14/2002 +0100, Nick Lindridge wrote: One reason would be to allow for a product like APD to do JIT swapping of executors to enable tracing on demand. I imagine you could come up with a clever way of letting Zend (En|De)coder be used for oly prticular clients in a large vhosting operation as well (although I don't really know how that product works.) Bingo! Well done George :) Nice to see someone thinking beyond their bubble. Thanks for the compliment. Andi -- PHP Development Mailing List http://www.php.net/ To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DEV] auto_prepend/append: does the PHP engine cache the
Just as a note about all this: if you have a deep 'standard' include tree (same 30-40 files), there is a decent amount of overhead just from parsing all the include files, even with inexpensive code. Your OS should do a reasonable job (or a really good job if it's Unix based) at caching the file contents and the ZE is pretty fast at spotting inline HTML in your php files, so I wouldn't worry so much about the performance of this aspect, unless you have some real CPU-intensive code in your frequently included files, or a large number of hits. If that is the case, consider using APC (if you don't want to pay money), or the Zend Accelerator (if you have some money, or if your site is a non-commerical community site - see zend.com for details). --Wez. -- PHP Development Mailing List http://www.php.net/ To unsubscribe, visit: http://www.php.net/unsub.php // George Schlossnagle // Principal Consultant // OmniTI, Inc http://www.omniti.com // (c) 240.460.5234 (e) [EMAIL PROTECTED] // 1024D/1100A5A0 1370 F70A 9365 96C9 2F5E 56C2 B2B9 262F 1100 A5A0 -- PHP Development Mailing List http://www.php.net/ To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DEV] php/embed
very cool. On Saturday, September 28, 2002, at 10:56 PM, Edin Kadribasic wrote: Hello, I have just committed initial work on enabling embedding PHP into C/C++ applications. It is mostly complete, but there a few pieces missing, namely the installation part. The modification of the build system adds another target, so in order to test the new functionality you need to configure php in the usual manner, and then do make, make install and make libs. Since libs are not installed by make install you need to copy libphp.so manually to appropriate directory. The best way to explain how this works is to show you some code examples. pembed.c #include php_embed.h int main(int argc, char **argv) { char *php_code = echo \Hello, World!\\n\;; PHP_EMBED_START_BLOCK(argc, argv); zend_eval_string(php_code, NULL, Embedded code TSRMLS_CC); PHP_EMBED_END_BLOCK(); return 0; } Makefile (unix) === LIBS=-lphp $(shell php-config --libs) INCLUDES=$(shell php-config --includes) LIBDIRS=-L$(shell php-config --prefix)/lib PHP_EXE=$(shell php-config --prefix)/bin/php CC=gcc CFLAGS=-g -Wall pembed: pembed.o $(CC) $(CFLAGS) $(LIBDIRS) -o pembed $(LIBS) pembed.o pembed.o: pembed.c $(CC) $(CFLAGS) $(INCLUDES) -c pembed.c clean: rm -f *.o pembed Makefile (win32) # Put your compiled php source here ROOT=u:\projects\php\php4.sdk LIBS=php4ts.lib phpembed.lib INCLUDES=-I $(ROOT) -I $(ROOT)\main -I $(ROOT)\Zend -I $(ROOT)\TSRM LIBDIRS=/libpath:$(ROOT)\Release_TS CC=cl LD=link CFLAGS=-MD -D ZTS -D PHP_WIN32 -D ZEND_WIN32 pembed.exe: pembed.obj $(LD) $(LIBDIRS) /out:pembed.exe $(LIBS) pembed.obj pembed.obj: pembed.c $(CC) $(CFLAGS) $(INCLUDES) -c pembed.c clean: -del *.obj -del pembed.exe As you can see from the example pembed.c file it is not very difficult to get the PHP engine started using php/embed. There are some things that you need to notice: you should think of PHP_EMBED_START_BLOCK() and PHP_EMBED_END_BLOCK() as {} block, so take care not to intersect with other {} blocks. If this is too great a limitiation, functions int php_embed_init(int argc, char **argv PTSRMLS_DC); void php_embed_shutdown(TSRMLS_D); should be used instead. I'm looking forward to your feedback and help to get the make install part working. Edin -- PHP Development Mailing List http://www.php.net/ To unsubscribe, visit: http://www.php.net/unsub.php // George Schlossnagle // Principal Consultant // OmniTI, Inc http://www.omniti.com // (c) 240.460.5234 (e) [EMAIL PROTECTED] // 1024D/1100A5A0 1370 F70A 9365 96C9 2F5E 56C2 B2B9 262F 1100 A5A0 -- PHP Development Mailing List http://www.php.net/ To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DEV] dl() question
Is there a reason why dl() does not support absolute paths for so's? I'm writing an Inline_C extension (similar to perl's Inline::C), that compiles functions on the fly. Obviously allowing the webserver to write to your extensions dir is a problem, but dl() (which is needed to load the on-the-fly-generated module) seems only to read from there. Is there a good reason for taht, and if not, would a patch to allow dl() to take absolute paths be looked upon favorably? George // George Schlossnagle // Principal Consultant // OmniTI, Inc http://www.omniti.com // (c) 240.460.5234 (e) [EMAIL PROTECTED] // 1024D/1100A5A0 1370 F70A 9365 96C9 2F5E 56C2 B2B9 262F 1100 A5A0 -- PHP Development Mailing List http://www.php.net/ To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DEV] anyone care to poke holes in the apache_hooks stuff
The apache_hooks stuff is about at the stage where people poking holes/finding bugs/making suggestions would be very beneficial. Any feedback would be appreciated. // George Schlossnagle // Principal Consultant // OmniTI, Inc http://www.omniti.com // (c) 240.460.5234 (e) [EMAIL PROTECTED] // 1024D/1100A5A0 1370 F70A 9365 96C9 2F5E 56C2 B2B9 262F 1100 A5A0 -- PHP Development Mailing List http://www.php.net/ To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DEV] anyone care to poke holes in the apache_hooks stuff
://www.php.net/ To unsubscribe, visit: http://www.php.net/unsub.php // George Schlossnagle // Principal Consultant // OmniTI, Inc http://www.omniti.com // (c) 240.460.5234 (e) [EMAIL PROTECTED] // 1024D/1100A5A0 1370 F70A 9365 96C9 2F5E 56C2 B2B9 262F 1100 A5A0 -- PHP Development Mailing List http://www.php.net/ To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DEV] Re: cgi and mod_php
Daniel Lorch wrote: hi, Yes, it would look like this: 1. ./configure appropiate stuff 2. make 3. make clean 4. goto 1 - Sascha So we do not have the possibility to build all three without make clean in one go. I would very much appreciate that since it would make developers life much easier... Use the force, luke. #!/bin/bash for mode in apache cli cgi; do ./configure --with-${mode} make make clean done Maybe this script doesn't work, but you get the idea :) I think the point isn't that it's not scriptable, but that it would be nice if there was a 'canned' way of doing it. I use the apache sapi and the cli, and it would be nice to be able to build them with a single make. Clearly there are ways to build them both (easily), but it should be easy for a basic user to have it build multiple targets. This is especially true with the cli, as there are abundant reasons to have it and one of the web-centric sapi's cohabitating on a system. George -- PHP Development Mailing List http://www.php.net/ To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DEV] Re: cgi and mod_php
It sure does seem to, doesn't it. ;) Mike Hall wrote: I'm sure PHP 4.3.0 builds the CLI as well as any other SAPI you specify, doesn't it? - Original Message - From: George Schlossnagle [EMAIL PROTECTED] To: Daniel Lorch [EMAIL PROTECTED] Cc: [EMAIL PROTECTED]; [EMAIL PROTECTED]; [EMAIL PROTECTED] Sent: Wednesday, August 28, 2002 9:54 PM Subject: Re: [PHP-DEV] Re: cgi and mod_php I think the point isn't that it's not scriptable, but that it would be nice if there was a 'canned' way of doing it. I use the apache sapi and the cli, and it would be nice to be able to build them with a single make. Clearly there are ways to build them both (easily), but it should be easy for a basic user to have it build multiple targets. This is especially true with the cli, as there are abundant reasons to have it and one of the web-centric sapi's cohabitating on a system. -- PHP Development Mailing List http://www.php.net/ To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DEV] adding persistent toggle to zend_stack implementation
Hi, I'd like to use the zend_stack stuff for stacked handlers in the new apache_hooks sapi stuff, but right now, it emalloc's everything, which is unacceptable for my usage. I could write my own stack implementation just for the sapi stuf, but thats seems less productive than making zend_stack more universally useable. I've added a persistent attribute to the struct so that it behaves more like zend_hash, added a zend_stack_init_ex which allows setting of this flag, and #define'd zend_stack_init to do a non-persistent zend_stack_init_ex. Patches are attached. If this is somehow undesireable, please let me know and I will just reimplement stacks for sapi. George Index: Zend/zend_stack.c === RCS file: /repository/Zend/zend_stack.c,v retrieving revision 1.11 diff -u -3 -r1.11 zend_stack.c --- Zend/zend_stack.c 6 Jan 2002 15:21:09 - 1.11 +++ Zend/zend_stack.c 27 Aug 2002 15:15:37 - -21,10 +21,11 #include zend.h #include zend_stack.h -ZEND_API int zend_stack_init(zend_stack *stack) +ZEND_API int zend_stack_init_ex(zend_stack *stack, int persistent) { stack-top = 0; - stack-elements = (void **) emalloc(sizeof(void **) * STACK_BLOCK_SIZE); +stack-persistent = persistent; + stack-elements = (void **) pemalloc(sizeof(void **) * STACK_BLOCK_SIZE, +persistent); if (!stack-elements) { return FAILURE; } else { -36,13 +37,13 ZEND_API int zend_stack_push(zend_stack *stack, void *element, int size) { if (stack-top = stack-max) { /* we need to allocate more memory */ - stack-elements = (void **) erealloc(stack-elements, - (sizeof(void **) * (stack-max += STACK_BLOCK_SIZE))); + stack-elements = (void **) perealloc(stack-elements, + (sizeof(void **) * (stack-max += +STACK_BLOCK_SIZE)), stack-persistent); if (!stack-elements) { return FAILURE; } } - stack-elements[stack-top] = (void *) emalloc(size); + stack-elements[stack-top] = (void *) pemalloc(size, stack-persistent); memcpy(stack-elements[stack-top], element, size); return stack-top++; } -63,7 +64,7 ZEND_API int zend_stack_del_top(zend_stack *stack) { if (stack-top 0) { - efree(stack-elements[--stack-top]); + pefree(stack-elements[--stack-top], stack-persistent); } return SUCCESS; } -96,11 +97,11 register int i; for (i = 0; i stack-top; i++) { - efree(stack-elements[i]); + pefree(stack-elements[i], stack-persistent); } if (stack-elements) { - efree(stack-elements); + pefree(stack-elements, stack-persistent); } return SUCCESS; } Index: Zend/zend_stack.h === RCS file: /repository/Zend/zend_stack.h,v retrieving revision 1.13 diff -u -3 -r1.13 zend_stack.h --- Zend/zend_stack.h 6 Jan 2002 15:21:09 - 1.13 +++ Zend/zend_stack.h 27 Aug 2002 15:15:37 - -22,14 +22,14 #define ZEND_STACK_H typedef struct _zend_stack { - int top, max; + int top, max, persistent; void **elements; } zend_stack; #define STACK_BLOCK_SIZE 64 - -ZEND_API int zend_stack_init(zend_stack *stack); +#define zend_stack_init(a) zend_stack_init_ex(a, 0); +ZEND_API int zend_stack_init_ex(zend_stack *stack, int persistent); ZEND_API int zend_stack_push(zend_stack *stack, void *element, int size); ZEND_API int zend_stack_top(zend_stack *stack, void **element); ZEND_API int zend_stack_del_top(zend_stack *stack); -- PHP Development Mailing List http://www.php.net/ To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DEV] Re: [rfc] apache_hooks update (yet incomplete)
A little update on all of this. I changed the way that the handlers are created in the apache config from php_value uri_handler /tmp/foo.php to phpUriHandler /tmp/foo.php and logically separated them from the ini structure. This eliminates some unnecessary work that was being done before and allows for stacked handlers more easily. I have the stacked handler code all working correctly, but I'm waiting on approval/disapproval of my zend_stack patch I posted earlier before I commit (my changes assume that patch at the moment). A couple new things are supported as well phpRequire /tmp/bar.php which effectively 'require's a file before any work is done in a request (since scope is shared throughout all stages of the request this is available everywhere). And phpResponseHandler /tmp/foofoo.php Which is a very experimental AddHandler response-time handler (similair to perl PerlHandler) Both of these are stackable, so you can do phpRequire /tmp/bar.php phpRequire /tmp/bar2.php in the same section and have them both run (same for all the handlers). I will wait a while to see if the zend_stack changes are accepted, if not I will just implement my own stack locally and use that instead. George Edin Kadribasic wrote: Ok, this has all been added to the apache_hooks branch, which is now up-to-date. Very nice. IMHO this should be merged into HEAD as soon as PHP_4_3_0 is branched off. Edin -- PHP Development Mailing List http://www.php.net/ To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DEV] Re: [rfc] apache_hooks update (yet incomplete)
Here's an incremental patch on Lukas' patch which tries to address a couple issues: o The startup sequence has been changed to allow for post-data to make it through if any hooks before full post-data is read are called o works under register_globals Off ($request is now available in the SERVER var hash when register globals is enabled) o all hooks and the 'main' content handler all share a common scope (there is only one call to zend_startup, and only one shutdown). This is significantly cheaper plus it allows for handy stuff like creating data structures in a hook and magicall passing them to other hooks or into the main script. This is experimental and may break some of the other sapi modules as-is (though that clearly wasn't the intention ;) George Lukas Schroeder wrote: hi, here's another shot of the current apache_hooks code. there are some issues with startup and cleanup currently. and the patch messes a bit with php's startup procedure. still missing is access to array_header (think headers_in, headers_out, headers_err) and table slot in request_rec, as is access to the whole connection structure of the request. but the string and int fields can be read and where appropriate written to. and there are some methods that wrap the ap_ family. regards, -lukas diff -u3 -r php4-lucas3/main/SAPI.c php4-george/main/SAPI.c --- php4-lucas3/main/SAPI.c Mon Aug 26 11:44:12 2002 +++ php4-george/main/SAPI.c Mon Aug 26 12:05:51 2002 -382,6 +382,7 SG(sapi_headers).mimetype = NULL; } sapi_send_headers_free(TSRMLS_C); +SG(sapi_started) = 0; } diff -u3 -r php4-lucas3/main/SAPI.h php4-george/main/SAPI.h --- php4-lucas3/main/SAPI.h Mon Aug 26 11:44:12 2002 +++ php4-george/main/SAPI.h Mon Aug 26 12:04:04 2002 -117,6 +117,7 HashTable *rfc1867_uploaded_files; long post_max_size; int options; +zend_bool sapi_started; } sapi_globals_struct; diff -u3 -r php4-lucas3/main/main.c php4-george/main/main.c --- php4-lucas3/main/main.c Mon Aug 26 11:45:03 2002 +++ php4-george/main/main.c Mon Aug 26 12:42:10 2002 -816,54 +816,52 /* {{{ php_request_startup */ int php_request_startup(TSRMLS_D) -{ - int retval = SUCCESS; - +{ +int retval = SUCCESS; #if PHP_SIGCHILD - signal(SIGCHLD, sigchld_handler); -#endif - - zend_try { - PG(during_request_startup) = 1; - - php_output_activate(TSRMLS_C); - - /* initialize global variables */ - PG(modules_activated) = 0; - PG(header_is_being_sent) = 0; - PG(connection_status) = PHP_CONNECTION_NORMAL; - - zend_activate(TSRMLS_C); - sapi_activate(TSRMLS_C); - - zend_set_timeout(EG(timeout_seconds)); - - if (PG(expose_php)) { - sapi_add_header(SAPI_PHP_VERSION_HEADER, sizeof(SAPI_PHP_VERSION_HEADER)-1, 1); - } - - if (PG(output_handler) PG(output_handler)[0]) { - php_start_ob_buffer_named(PG(output_handler), 0, 1 TSRMLS_CC); - } - else if (PG(output_buffering)) { - php_start_ob_buffer(NULL, 0, 1 TSRMLS_CC); - } - else if (PG(implicit_flush)) { - php_start_implicit_flush(TSRMLS_C); - } - - /* We turn this off in php_execute_script() */ - /* PG(during_request_startup) = 0; */ - - php_hash_environment(TSRMLS_C); - zend_activate_modules(TSRMLS_C); - PG(modules_activated)=1; - } zend_catch { - retval = FAILURE; - } zend_end_try(); +signal(SIGCHLD, sigchld_handler); +#endif +if(!SG(sapi_started)) { +zend_try { +PG(during_request_startup) = 1; + +/* initialize global variables */ +PG(modules_activated) = 0; +PG(header_is_being_sent) = 0; +PG(connection_status) = PHP_CONNECTION_NORMAL; + +zend_activate(TSRMLS_C); +zend_set_timeout(EG(timeout_seconds)); +zend_activate_modules(TSRMLS_C); +PG(modules_activated)=1; +} zend_catch { +retval = FAILURE; +} zend_end_try(); +SG(sapi_started) = 1; +} +php_output_activate(TSRMLS_C); +sapi_activate(TSRMLS_C); +php_hash_environment(TSRMLS_C); +zend_try { +if (PG(expose_php)) { +sapi_add_header(SAPI_PHP_VERSION_HEADER, +sizeof(SAPI_PHP_VERSION_HEADER)-1, 1); +} +if (PG(output_handler) PG(output_handler)[0]) { +php_start_ob_buffer_named(PG(output_handler), 0, 1 TSRMLS_CC); +} +else if (PG(output_buffering)) { +php_start_ob_buffer(NULL, 0, 1 TSRMLS_CC); +}
Re: [PHP-DEV] Re: [rfc] apache_hooks update (yet incomplete)
All of this work was off HEAD. Should a new_apache_hooks branch be tagged? Rasmus Lerdorf wrote: I say commit it. This stuff is very experimental as it is and lives in its own branch. You are not going to destabilize anything. (I just made sure you had enough karma for the commit) -Rasmus -- PHP Development Mailing List http://www.php.net/ To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DEV] Re: [rfc] apache_hooks update (yet incomplete)
I wasn't proposing putting it in HEAD, just that the work was done against HEAD not against your apache_hooks. Lukas redid all the php-apache request object work fresh off of head, and I made changes off of that, so it contains nothing from your apache_hooks branch. Rasmus Lerdorf wrote: I think if we put this in 4.3 we are going to delay 4.3 even further. Although, I suppose if we are careful and make sure we #ifdef it nicely and only turn it on with a configure option, we can put it in HEAD. So, is your patch my apache_hooks stuff + Lukas's work and then your stuff on top? On Mon, 26 Aug 2002, George Schlossnagle wrote: All of this work was off HEAD. Should a new_apache_hooks branch be tagged? Rasmus Lerdorf wrote: I say commit it. This stuff is very experimental as it is and lives in its own branch. You are not going to destabilize anything. (I just made sure you had enough karma for the commit) -Rasmus -- PHP Development Mailing List http://www.php.net/ To unsubscribe, visit: http://www.php.net/unsub.php