[PHP-DEV] Freeing memory
Hi, I am getting the following output from a php script that calls an extension I am writing (I have compiled the extension with --enable-debug) /home/phpcvs/php4_head/ext/pipe/pipe.c(245) : Freeing 0x0822568C (12 bytes), script=test.php /home/phpcvs/php4_head/ext/pipe/pipe.c(244) : Freeing 0x0822564C (12 bytes), script=test.php where lines lines 245 and 244 are: MAKE_STD_ZVAL(read); MAKE_STD_ZVAL(write); Does this mean that I need to free the memory from the zvals when the script exits, or is this just information? Thanks for your help Tony -- PHP Development Mailing List http://www.php.net/ To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DEV] Freeing memory
Yup, you will need to FREE_ZVAL() it On 9 Nov 2002, Tony Leake wrote: Hi, I am getting the following output from a php script that calls an extension I am writing (I have compiled the extension with --enable-debug) /home/phpcvs/php4_head/ext/pipe/pipe.c(245) : Freeing 0x0822568C (12 bytes), script=test.php /home/phpcvs/php4_head/ext/pipe/pipe.c(244) : Freeing 0x0822564C (12 bytes), script=test.php where lines lines 245 and 244 are: MAKE_STD_ZVAL(read); MAKE_STD_ZVAL(write); Does this mean that I need to free the memory from the zvals when the script exits, or is this just information? Thanks for your help Tony -- 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] Freeing memory
Actually zval_ptr_dtor() is probably more suitable. In any case, is this zval something you keep locally in your extension or are you returning/adding it to the engine's symbol table? If so, the engine should take care of the memory automatically as long as you've done everything correctly. Maybe you should explain in more detail what you're doing. Andi At 12:45 AM 11/9/2002 -0800, Rasmus Lerdorf wrote: Yup, you will need to FREE_ZVAL() it On 9 Nov 2002, Tony Leake wrote: Hi, I am getting the following output from a php script that calls an extension I am writing (I have compiled the extension with --enable-debug) /home/phpcvs/php4_head/ext/pipe/pipe.c(245) : Freeing 0x0822568C (12 bytes), script=test.php /home/phpcvs/php4_head/ext/pipe/pipe.c(244) : Freeing 0x0822564C (12 bytes), script=test.php where lines lines 245 and 244 are: MAKE_STD_ZVAL(read); MAKE_STD_ZVAL(write); Does this mean that I need to free the memory from the zvals when the script exits, or is this just information? Thanks for your help Tony -- 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] test, ignore, sorry
haha -- PHP Development Mailing List http://www.php.net/ To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DEV] Return -1
On Sat, 9 Nov 2002, Maxim Maletsky wrote: I have just fixed a few doc files where it was stating that a function returned -1 but the sources had clear RETURN_FALSE. Done that, I took some time to grep my phpdoc and php4 trees for -1 returns and, surprisingly, I found out that there were a few suspicious places where -1 could be better changed to RETURN_FALSE. Some of such places were FTP, pgSQL, LDAP functions. Maybe a dozen or less in total. I don't think this should be done right now, as we would directly break the backwards compatibility. But, shouldn't we be considering such consistency changes for PHP5 releases? My point is that functions behaviour consistency can be very important for many users, and breaking just a few lines of PHP4 code since first PHP5 releases would probably be a small price to pay. I don't see any reason why we should break it and give users more headaches. Sure, consistency is nice, but IMO not worth it to break BC. 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] abstract functions
Hi, does PHP4 with the ZE2 supports abstract function like Delphi or C++? That would be very useful for class development, cause we can avoid testing if a class is abstract if an abstract class couldn't be instantiated? Syntax could be like in C++ class X { X(){} int y() = 0; } or little bit more like pascal class X { X(){} // PHP function x(); abstract; } or class X { X(){} // PHP abstract function x(); } Greetings, Jens -- L i W W W i Jens Rehsack LW W W L i W W W W i nnnLiWing IT-Services L iW W W Wi n n g g i W W i n n g gFriesenstraße 2 06112 Halle g g g Tel.: +49 - 3 45 - 5 17 05 91ggg e-Mail: [EMAIL PROTECTED] Fax: +49 - 3 45 - 5 17 05 92http://www.liwing.de/ -- PHP Development Mailing List http://www.php.net/ To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DEV] PHP4.3.0Pre2 and WebDav
Hi there, i have a question. If the php 4.3 can accept webdav requests, can you give me some idea, how i can configure apache2? To pass this requests to php scripts from apache ? Thanks! -- PHP Development Mailing List http://www.php.net/ To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DEV] Re: RfC: *_fetch_object()
On Fri, 2002-11-08 at 23:41, Yasuo Ohgaki wrote: I don't mind making pg_fetch_object() accept object (not class) optionally and initialize field values as object's properties. What you're saying would be: $a= pg_fetch_object($q, new Article()); It is certainly not common for PHP functions to accept new Something() as a parameter. Although it is sexy, does it make sense to users? Why would a fetch function accept an instance of an object? Just my .02 EUR:-) How about other db module maintainers? BTW, pg_fetch_object() accepted 3rd optional parameter for a long time. I've disabled it recently, since having $obj-1, $obj-2, and so on does not make much sense. I've done away with them. If anyone for any reason still wants them, (object)sybase_fetch_array($q) is the way to go. - Timm -- PHP Development Mailing List http://www.php.net/ To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DEV] Freeing memory
The whole picture is that i want to control a child process completely from within php. A bit like popen or proc_open but with 2 independent pipes to the child's stdin and stdout that I can read and write to. So I'm basically wrapping the c functions pipe(), dup2() and friends. Once I have it all working I will offer to add the functions into the pcntl extension if they're wanted. Anyway the code in the pipe function that was giving me the warnings is as follows: PHP_FUNCTION(pipe) { pipe_r_le_struct *st_pipe_r; pipe_w_le_struct *st_pipe_w; zval *read; zval *write; int pipe_fd[2]; if( pipe(pipe_fd ) 0 ){ php_error( E_ERROR, Could not create pipe ); } st_pipe_r = emalloc( sizeof( pipe_r_le_struct ) ); st_pipe_w = emalloc( sizeof( pipe_w_le_struct ) ); st_pipe_r-fd = pipe_fd[0]; st_pipe_w-fd = pipe_fd[1]; MAKE_STD_ZVAL( read ); MAKE_STD_ZVAL( write ); ZEND_REGISTER_RESOURCE( read, st_pipe_r, le_pipe_r ) ZEND_REGISTER_RESOURCE( write, st_pipe_w, le_pipe_w ) array_init( return_value ); add_assoc_resource( return_value, read, Z_RESVAL_P( read ) ); add_assoc_resource( return_value, write, Z_RESVAL_P( write ) ); } If i use FREE_ZVAL() at the end of this function I can get rid of the warnings but I would guess this is the wrong place and it should be taken care of in a cleanup function when the request has finished. Please excuse me if I am missing something obvious here, as you may guess I'm still finding my feet writing PHP extensions. Tony On Sat, 2002-11-09 at 08:56, Andi Gutmans wrote: Actually zval_ptr_dtor() is probably more suitable. In any case, is this zval something you keep locally in your extension or are you returning/adding it to the engine's symbol table? If so, the engine should take care of the memory automatically as long as you've done everything correctly. Maybe you should explain in more detail what you're doing. Andi -- PHP Development Mailing List http://www.php.net/ To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DEV] abstract functions
ZE1 way: class MyClass { function MyClass() { die('MyClass is an abstract class'); } } ZE2 way: class AbstractClassException { } class MyClass { function MyClass() { throw new AbstractClassException(); } } On Sat, 09 Nov 2002, Jens Rehsack wrote: Hi, does PHP4 with the ZE2 supports abstract function like Delphi or C++? That would be very useful for class development, cause we can avoid testing if a class is abstract if an abstract class couldn't be instantiated? Syntax could be like in C++ class X { X(){} int y() = 0; } or little bit more like pascal class X { X(){} // PHP function x(); abstract; } or class X { X(){} // PHP abstract function x(); } Greetings, Jens -- L i W W W i Jens Rehsack LW W W L i W W W W i nnnLiWing IT-Services L iW W W Wi n n g g i W W i n n g gFriesenstraße 2 06112 Halle g g g Tel.: +49 - 3 45 - 5 17 05 91ggg e-Mail: [EMAIL PROTECTED] Fax: +49 - 3 45 - 5 17 05 92http://www.liwing.de/ -- PHP Development Mailing List http://www.php.net/ To unsubscribe, visit: http://www.php.net/unsub.php -Andrei http://www.gravitonic.com/ * A feature is a bug with seniority. * -- PHP Development Mailing List http://www.php.net/ To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DEV] Bug 20147
Bug #20147 has been reported as a PEAR bug, but IMO this sounds more like a PHP problem. The user reports that he gets the error message /usr/src/ServerSoftware/PHP/php-4.3.0pre2/sapi/cli/php: relocation error: /usr/local/php/lib/php/extensions/no-debug-non-zts-20020429/xml.so: undefined symbol: XML_ParserCreate make[1]: *** [install-pear-installer] Error 127 make: *** [install-pear] Error 2 while the PEAR stuff is installed. Actually PEAR does not create anything like xml.so. Can anyone being more familiar with PHP's build stuff have a look at this? -- - Martin Martin Jansen http://martinjansen.com/ -- PHP Development Mailing List http://www.php.net/ To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DEV] abstract functions
Andrei Zmievski wrote: ZE1 way: class MyClass { function MyClass() { die('MyClass is an abstract class'); } } ZE2 way: class AbstractClassException { } class MyClass { function MyClass() { throw new AbstractClassException(); } } On Sat, 09 Nov 2002, Jens Rehsack wrote: That's not ok, cause (very simple) class Calcer { function Calcer() { die('abstract'); } function ShowResult( $a ) { echo $this-CalcResult( $a ) } abstract function CalcResult( $a ); } class Square extends Calcer { function Square() { Calcer::Calcer(); // cause inherited could do sth. } function CalcResult( $a ) { return $a * $a; } } class Adder extends Calcer { var $Summand; function Adder( $aSummand ) { Calcer::Calcer(); $this-Summand = $aSummand; } function CalcResult( $a ) { return $a + $this-Summand; } } I can give a more complex example, if you want, but it's not ok to die in constructor of an abstract class, cause the main logic could be implemented in this class and it needs to be derived cause for helper functions... An example is a cache control class which is able to access cached objects through it real name and is either able to store in filesystem or in database. Jens Hi, does PHP4 with the ZE2 supports abstract function like Delphi or C++? That would be very useful for class development, cause we can avoid testing if a class is abstract if an abstract class couldn't be instantiated? Syntax could be like in C++ class X { X(){} int y() = 0; } or little bit more like pascal class X { X(){} // PHP function x(); abstract; } or class X { X(){} // PHP abstract function x(); } Greetings, Jens -- L i W W W i Jens Rehsack LW W W L i W W W W i nnnLiWing IT-Services L iW W W Wi n n g g i W W i n n g gFriesenstraße 2 06112 Halle g g g Tel.: +49 - 3 45 - 5 17 05 91ggg e-Mail: [EMAIL PROTECTED] Fax: +49 - 3 45 - 5 17 05 92http://www.liwing.de/ -- PHP Development Mailing List http://www.php.net/ To unsubscribe, visit: http://www.php.net/unsub.php -Andrei http://www.gravitonic.com/ * A feature is a bug with seniority. * -- L i W W W i Jens Rehsack LW W W L i W W W W i nnnLiWing IT-Services L iW W W Wi n n g g i W W i n n g gFriesenstraße 2 06112 Halle g g g Tel.: +49 - 3 45 - 5 17 05 91ggg e-Mail: [EMAIL PROTECTED] Fax: +49 - 3 45 - 5 17 05 92http://www.liwing.de/ -- PHP Development Mailing List http://www.php.net/ To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DEV] Re: [PHP-CVS] cvs: php4 /ext/curl config.m4
On Sat, 9 Nov 2002, Sterling Hughes wrote: On Sat, 9 Nov 2002, Sterling Hughes wrote: There is no such release of Curl yet. This makes testing the RCs quite a hassle now so either you revert those changes or get the curl folks to release this 7.10.2. --Jani 7.10.2-pre4 is currently out, it should be released quite soon. But it's not 7.10.2 release. Revert the changes. Or I will. err... no. 7.10.2 will be out long before PHP 4.3. We haven't even had the first RC for PHP, and its a lot longer before PHP releases to come out. If you want to test it for QA purposes, you can easily install one of the prereleases. 7.10.1 might also work, not sure You're now missing the point here. I'm NOT doing QA for Curl. I'm not going to install ANY curl pre-release here. You can (if you wouldn't be so lazy) add some ifdef's around the new stuff instead of everytime requiring people to update curl!! --Jani -- PHP Development Mailing List http://www.php.net/ To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DEV] Re: [PHP-CVS] cvs: php4 /ext/curl config.m4
On Sat, 9 Nov 2002, Sterling Hughes wrote: On Sat, 9 Nov 2002, Sterling Hughes wrote: There is no such release of Curl yet. This makes testing the RCs quite a hassle now so either you revert those changes or get the curl folks to release this 7.10.2. --Jani 7.10.2-pre4 is currently out, it should be released quite soon. But it's not 7.10.2 release. Revert the changes. Or I will. err... no. 7.10.2 will be out long before PHP 4.3. We haven't even had the first RC for PHP, and its a lot longer before PHP releases to come out. If you want to test it for QA purposes, you can easily install one of the prereleases. 7.10.1 might also work, not sure You're now missing the point here. I'm NOT doing QA for Curl. I'm not going to install ANY curl pre-release here. You can (if you wouldn't be so lazy) add some ifdef's around the new stuff instead of everytime requiring people to update curl!! Its not laziness... I'm not having that many '#ifdef's in the code. Some cases it makes sense for cURL to have #ifdef's, in some cases it'll just make the code both unreadable and unmaintainable. The solution I'm working on is to autogenerate from the curl.h and multi.h files. However, that's after i get the multi interface in, and the cURL extension is hopefully up-to-date. Anyhow, I get the point. I just don't find it valid, if you're doing QA, than upgrading to a pre-release is not that much harder than upgrading to the release itself. PHP-Curl is _not_ that often tested in the QA process, simply because most features rely on a server being available, and with PHP/QA there is none. Therefore, very few regression tests. -Sterling -- Sterling Hughes [EMAIL PROTECTED] Did I help you? Consider a gift: http://wishlist.edwardbear.org/ -- PHP Development Mailing List http://www.php.net/ To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DEV] Re: [PHP-CVS] cvs: php4 /ext/curl config.m4
At 05:44 PM 11/9/2002 +0100, Sterling Hughes wrote: On Sat, 9 Nov 2002, Sterling Hughes wrote: On Sat, 9 Nov 2002, Sterling Hughes wrote: There is no such release of Curl yet. This makes testing the RCs quite a hassle now so either you revert those changes or get the curl folks to release this 7.10.2. --Jani 7.10.2-pre4 is currently out, it should be released quite soon. But it's not 7.10.2 release. Revert the changes. Or I will. err... no. 7.10.2 will be out long before PHP 4.3. We haven't even had the first RC for PHP, and its a lot longer before PHP releases to come out. If you want to test it for QA purposes, you can easily install one of the prereleases. 7.10.1 might also work, not sure You're now missing the point here. I'm NOT doing QA for Curl. I'm not going to install ANY curl pre-release here. You can (if you wouldn't be so lazy) add some ifdef's around the new stuff instead of everytime requiring people to update curl!! Its not laziness... I'm not having that many '#ifdef's in the code. Some cases it makes sense for cURL to have #ifdef's, in some cases it'll just make the code both unreadable and unmaintainable. The solution I'm working on is to autogenerate from the curl.h and multi.h files. However, that's after i get the multi interface in, and the cURL extension is hopefully up-to-date. Anyhow, I get the point. I just don't find it valid, if you're doing QA, than upgrading to a pre-release is not that much harder than upgrading to the release itself. PHP-Curl is _not_ that often tested in the QA process, simply because most features rely on a server being available, and with PHP/QA there is none. Therefore, very few regression tests. Sterling, Maybe a good solution is for you to check if 7.10.1 works? If it does then it'll be easy to end this thread :) Andi -- PHP Development Mailing List http://www.php.net/ To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DEV] abstract functions
How about testing for the parent? Such as: ? class AbstractClassException { } class MyClass { var $salutation; function MyClass() { if(!get_parent_class($this)) { throw new AbstractClassException(); } $this-salutation = 'Hello'; } function test() { print($this-salutation); } } class MyOtherClass extends MyClass { function MyOtherClass() { MyClass::MyClass(); } } //use the abstract class correctly $c = new MyOtherClass; $c-test(); //use it incorrectly, get an exception $c = new MyClass; ? Regards, Leon - Original Message - From: Jens Rehsack [EMAIL PROTECTED] To: Andrei Zmievski [EMAIL PROTECTED] Cc: [EMAIL PROTECTED] Sent: Saturday, November 09, 2002 8:22 AM Subject: Re: [PHP-DEV] abstract functions Andrei Zmievski wrote: ZE1 way: class MyClass { function MyClass() { die('MyClass is an abstract class'); } } ZE2 way: class AbstractClassException { } class MyClass { function MyClass() { throw new AbstractClassException(); } } On Sat, 09 Nov 2002, Jens Rehsack wrote: That's not ok, cause (very simple) class Calcer { function Calcer() { die('abstract'); } function ShowResult( $a ) { echo $this-CalcResult( $a ) } abstract function CalcResult( $a ); } class Square extends Calcer { function Square() { Calcer::Calcer(); // cause inherited could do sth. } function CalcResult( $a ) { return $a * $a; } } class Adder extends Calcer { var $Summand; function Adder( $aSummand ) { Calcer::Calcer(); $this-Summand = $aSummand; } function CalcResult( $a ) { return $a + $this-Summand; } } I can give a more complex example, if you want, but it's not ok to die in constructor of an abstract class, cause the main logic could be implemented in this class and it needs to be derived cause for helper functions... An example is a cache control class which is able to access cached objects through it real name and is either able to store in filesystem or in database. Jens Hi, does PHP4 with the ZE2 supports abstract function like Delphi or C++? That would be very useful for class development, cause we can avoid testing if a class is abstract if an abstract class couldn't be instantiated? Syntax could be like in C++ class X { X(){} int y() = 0; } or little bit more like pascal class X { X(){} // PHP function x(); abstract; } or class X { X(){} // PHP abstract function x(); } Greetings, Jens -- L i W W W i Jens Rehsack LW W W L i W W W W i nnnLiWing IT-Services L iW W W Wi n n g g i W W i n n g gFriesenstraße 2 06112 Halle g g g Tel.: +49 - 3 45 - 5 17 05 91ggg e-Mail: [EMAIL PROTECTED] Fax: +49 - 3 45 - 5 17 05 92http://www.liwing.de/ -- PHP Development Mailing List http://www.php.net/ To unsubscribe, visit: http://www.php.net/unsub.php -Andrei http://www.gravitonic.com/ * A feature is a bug with seniority. * -- L i W W W i Jens Rehsack LW W W L i W W W W i nnnLiWing IT-Services L iW W W Wi n n g g i W W i n n g gFriesenstraße 2 06112 Halle g g g Tel.: +49 - 3 45 - 5 17 05 91ggg e-Mail: [EMAIL PROTECTED] Fax: +49 - 3 45 - 5 17 05 92http://www.liwing.de/ -- PHP Development Mailing List http://www.php.net/ To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Development Mailing List http://www.php.net/ To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DEV] abstract functions
Leon Atkinson wrote: How about testing for the parent? Such as: ? class AbstractClassException { } class MyClass { var $salutation; function MyClass() { if(!get_parent_class($this)) { throw new AbstractClassException(); } $this-salutation = 'Hello'; } function test() { print($this-salutation); } } class MyOtherClass extends MyClass { function MyOtherClass() { MyClass::MyClass(); } } //use the abstract class correctly $c = new MyOtherClass; $c-test(); //use it incorrectly, get an exception $c = new MyClass; ? Regards, Leon This didn't solve the problem. Each abstract class must check if it's an instantiation of sth. is itself ... Supporting an abstract feature like every OO-language would make it much easier. Of couse, since it is not available I use constructs like shown. I didn't need help to find such constructs, I want suggest adding the functionality for abstract methods. I accept that in ZE2 no private methods are available. I even accept that there's neither operator overloading nor multiple inheritation. And even if I miss that most: that there will no access sections like in Object Pascal or C++ (private/protected/public[/published]) and friend declaration. I just want suggest adding abstract feature, because that could make many things more OO-like and much easier to maintain... But thanks for the suggestions ... Greetings, Jens - Original Message - From: Jens Rehsack [EMAIL PROTECTED] To: Andrei Zmievski [EMAIL PROTECTED] Cc: [EMAIL PROTECTED] Sent: Saturday, November 09, 2002 8:22 AM Subject: Re: [PHP-DEV] abstract functions Andrei Zmievski wrote: ZE1 way: class MyClass { function MyClass() { die('MyClass is an abstract class'); } } ZE2 way: class AbstractClassException { } class MyClass { function MyClass() { throw new AbstractClassException(); } } On Sat, 09 Nov 2002, Jens Rehsack wrote: That's not ok, cause (very simple) class Calcer { function Calcer() { die('abstract'); } function ShowResult( $a ) { echo $this-CalcResult( $a ) } abstract function CalcResult( $a ); } class Square extends Calcer { function Square() { Calcer::Calcer(); // cause inherited could do sth. } function CalcResult( $a ) { return $a * $a; } } class Adder extends Calcer { var $Summand; function Adder( $aSummand ) { Calcer::Calcer(); $this-Summand = $aSummand; } function CalcResult( $a ) { return $a + $this-Summand; } } I can give a more complex example, if you want, but it's not ok to die in constructor of an abstract class, cause the main logic could be implemented in this class and it needs to be derived cause for helper functions... An example is a cache control class which is able to access cached objects through it real name and is either able to store in filesystem or in database. Jens Hi, does PHP4 with the ZE2 supports abstract function like Delphi or C++? That would be very useful for class development, cause we can avoid testing if a class is abstract if an abstract class couldn't be instantiated? Syntax could be like in C++ class X { X(){} int y() = 0; } or little bit more like pascal class X { X(){} // PHP function x(); abstract; } or class X { X(){} // PHP abstract function x(); } Greetings, Jens -- L i W W W i Jens Rehsack LW W W L i W W W W i nnnLiWing IT-Services L iW W W Wi n n g g i W W i n n g gFriesenstraße 2 06112 Halle g g g Tel.: +49 - 3 45 - 5 17 05 91ggg e-Mail: [EMAIL PROTECTED] Fax: +49 - 3 45 - 5 17 05 92http://www.liwing.de/ -- PHP Development Mailing List http://www.php.net/ To unsubscribe, visit: http://www.php.net/unsub.php -Andrei http://www.gravitonic.com/ * A feature is a bug with seniority. * -- L i W W W i Jens Rehsack LW W W L i W W W W i nnnLiWing IT-Services L iW W W Wi n n g g i W W i n n g gFriesenstraße 2 06112 Halle g g g Tel.: +49 - 3 45 - 5 17 05 91ggg e-Mail: [EMAIL PROTECTED] Fax: +49 - 3 45 - 5 17 05 92http://www.liwing.de/ -- PHP Development Mailing List http://www.php.net/ To unsubscribe, visit: http://www.php.net/unsub.php -- L i W W W i Jens Rehsack LW W W L i W W W W i nnnLiWing IT-Services L iW W W Wi n n g g i W W i n n g gFriesenstraße 2
Re: [PHP-DEV] Freeing memory
Hi Tony, What kind of things are you planning to do? proc_open seems ideal to extend for this purpose, and works on win32. --Wez. On 09/11/02, Tony Leake [EMAIL PROTECTED] wrote: The whole picture is that i want to control a child process completely from within php. A bit like popen or proc_open but with 2 independent pipes to the child's stdin and stdout that I can read and write to. So I'm basically wrapping the c functions pipe(), dup2() and friends. Once I have it all working I will offer to add the functions into the pcntl extension if they're wanted. -- PHP Development Mailing List http://www.php.net/ To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DEV] Configuration Patches
Attached are two patches that I've written to address a number of issues I've come across while testing PHP on Solaris. The first patch (alloca.txt) eliminated a warning message due to the fact that that on Solaris and Tru64 alloca() is defined in a separate header, alloca.h, which is not included. The current check only attempts to include this header is the compiler in not GNUC, I came across the problem while using gcc 3.2, which is becoming quite common on Solaris. The second patch (flex.txt) is a flex check that ensures we are using the GNU flex 2.5.4 (released in 1997, so it is safe to assume any recent distro has it). If it is not found the configure script gives an advisory warning similar to the one we give for bison. Only an advisory is given, because unless PHP is compiled from CVS, flex is not needed. This check is needed, because for example, the stock lexer installer on Sun Os, does not support the -P flag needed by PHP and even though it passes existing configure checks, it fails when it comes to generating the .c files. Are there any objection to the integration of those 2 patches? Ilia Index: zend.h === RCS file: /repository/Zend/zend.h,v retrieving revision 1.163 diff -u -r1.163 zend.h --- zend.h 9 Oct 2002 06:19:10 - 1.163 +++ zend.h 9 Nov 2002 18:11:31 - -117,11 +117,13 # define ZEND_EXTENSIONS_SUPPORT 0 #endif +#if HAVE_ALLOCA_H !defined(_ALLOCA_H) +# include alloca.h +#endif + /* AIX requires this to be the first thing in the file. */ #ifndef __GNUC__ -# if HAVE_ALLOCA_H -# include alloca.h -# else +# ifndef HAVE_ALLOCA_H # ifdef _AIX #pragma alloca # else Index: configure.in === RCS file: /repository/php4/configure.in,v retrieving revision 1.395 diff -u -r1.395 configure.in --- configure.in4 Nov 2002 20:08:08 - 1.395 +++ configure.in9 Nov 2002 18:12:46 - -158,6 +158,12 LEX_CFLAGS=-DYY_USE_CONST fi +AC_MSG_CHECKING([flex version]) +set `$LEX -V | grep 'version' | cut -d ' ' -f 3 | sed -e 's/\./ /g' | sed -e 's/[^0-9 +]//g'` +if test ${1} != 2 -o ${2} != 5 -o ${3} -lt 4; then +AC_MSG_WARN(You will need flex 2.5.4 or later if you want to regenerate +Zend/PHP lexical parsers.) +fi +AC_MSG_RESULT(${1}.${2}.${3} (ok)) dnl Platform-specific compile settings. dnl - -- PHP Development Mailing List http://www.php.net/ To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DEV] Re: Flash and PHP
Hi Folks I try to comfortize my webpages using flash.The server part is still PHP implemented. Has anyone experiences on this subjects. Especially trial and errors ;) could be very informativ to me. thanks for your help in advance kind regards Georg -- PHP Development Mailing List http://www.php.net/ To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DEV] Re: high availability solutions
Hi Folks, I try to be aware of the theme high available websolutions. Has anyone got some good ideas to what kind of subjects I have special take care about, to provide short answer times and high available websolutions to comfort customers at my upcoming website? thanks in advance kind regards Georg -- PHP Development Mailing List http://www.php.net/ To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DEV] Re: php flash implementation
Hi Folks I try to exchange data via XML files using php as server. Has anyone some ideas how to work it out? Kind regards Georg -- PHP Development Mailing List http://www.php.net/ To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DEV] Re: php templates
Hi folks I try to reduce the amount of unnecessary code fragments in my php scripts. Once I hear templates for php are the right answer for this problem. Can give anyone some hints how to work with templates. kind regards Georg -- PHP Development Mailing List http://www.php.net/ To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DEV] php_embed and myphp
Hi, I was testing myphp and it didn't work for me, because argv was initialized at an inaccessible address. Since I'm not farmiliar with C++, I made some changes using C, basically to allocate a block for argv, and realloc when needed (see attached patch). I know I still need to check reallocation in the other types, but that's not the issue. I also made some changes to the Makefile, in order to use mysql_config, so that's why I changed mysql/mysql.h to mysql.h. Please excuse the hard paths there. The following works once: $ mysql Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 1 to server version: 4.0.4-beta-log Type 'help;' or '\h' for help. Type '\c' to clear the buffer. mysql SELECT php('strftime(%c, $argv[1])', UNIX_TIMESTAMP(NOW())); ++ | php('strftime(%c, $argv[1])', UNIX_TIMESTAMP(NOW())) | ++ | 11/09/02 21:22:57 | ++ 1 row in set (0.02 sec) mysql SELECT php('strftime(%c, $argv[1])', UNIX_TIMESTAMP(NOW())); gdb output is attached and basically shows an error in the thread safety, which I know very little about. I'd appreciate any pointers in this area. With kind regards, Melvyn Sopacua ?php include(not_reflecting_employers_views.txt); ?0x8325011 in _syscall_sys_select () (gdb) cont Continuing. [Switching to thread 0xad4e900] Program received signal SIGSEGV, Segmentation fault. 0x487061f5 in ts_resource_ex (id=5, th_id=0x0) at /home/mdev/cvs/php4/TSRM/TSRM.c:316 316 TSRM_SAFE_RETURN_RSRC(thread_resources-storage, id, thread_resources-count); (gdb) bt #0 0x487061f5 in ts_resource_ex (id=5, th_id=0x0) at /home/mdev/cvs/php4/TSRM/TSRM.c:316 #1 0x487740c1 in php_embed_init (argc=2, argv=0xb02d000, ptsrm_ls=0x4881a4a0) at /home/mdev/cvs/php4/sapi/embed/php_embed.c:170 #2 0x485dec80 in php (initid=0xb03121c, args=0xb031208, result=0x4881a57c \001, length=0x4881a504, is_null=0x0, error=0x0) at myphp.cc:121 #3 0x805fd2c in udf_handler::val_str () #4 0x8065db7 in Item_func_udf_str::val_str () #5 0x80576f7 in Item::send () #6 0x8085a61 in select_send::send_data () #7 0x80b29f4 in mysql_select () #8 0x80c0ac6 in handle_select () #9 0x80995fc in mysql_execute_command () #10 0x809d1b8 in mysql_parse () #11 0x8098613 in dispatch_command () #12 0x809e612 in do_command () #13 0x8097845 in handle_one_connection () #14 0x82ebc7f in _thread_kern_start () (gdb) frame 2 #2 0x485dec80 in php (initid=0xb03121c, args=0xb031208, result=0x4881a57c \001, length=0x4881a504, is_null=0x0, error=0x0) at myphp.cc:121 121 PHP_EMBED_START_BLOCK(args-arg_count, argv); Current language: auto; currently c++ (gdb) info local tsrm_ls = (void ***) 0x805fc68 rv = (rv_str *) 0x843a310 zv = (zval *) 0x843a340 argv = (char **) 0xb02d000 argv_size = 2048 argv_alloc = 24 i = 2 (gdb) print args-arg_count $1 = 2 (gdb) print argv[1] $2 = 0x843a330 1036873384 (gdb) frame 1 #1 0x487740c1 in php_embed_init (argc=2, argv=0xb02d000, ptsrm_ls=0x4881a4a0) at /home/mdev/cvs/php4/sapi/embed/php_embed.c:170 170 compiler_globals = ts_resource(compiler_globals_id); Current language: auto; currently c (gdb) info local global_vars = {head = 0x830, tail = 0x0, size = 0, count = 1216455788, dtor = 0x8075917 Item_func_now::val_str(String *)+27, persistent = 200 'È', traverse_ptr = 0xb0311fc} compiler_globals = (zend_compiler_globals *) 0x4881a448 executor_globals = (zend_executor_globals *) 0x13 core_globals = (php_core_globals *) 0xc sapi_globals = (sapi_globals_struct *) 0x82e194c tsrm_ls = (void ***) 0x4881a44c (gdb) frame 0 #0 0x487061f5 in ts_resource_ex (id=5, th_id=0x0) at /home/mdev/cvs/php4/TSRM/TSRM.c:316 316 TSRM_SAFE_RETURN_RSRC(thread_resources-storage, id, thread_resources-count); (gdb) info local thread_id = 0x2 hash_value = 0 thread_resources = (tsrm_tls_entry *) 0x843a370 (gdb) print id $3 = 5 (gdb) print thread_resources-storage $4 = (void **) 0x1 (gdb) print thread_resources-count $5 = 0 --- orig/myphp.cc Fri Oct 25 17:05:54 2002 +++ ./myphp.cc Sat Nov 9 21:19:34 2002 -1,15 +1,18 /* Copyright (c) 2002 David Sklar * * Inspiration from myperl by Brian Aker - http://software.tangent.org/ + * vim600: noet ts=4 sw=4 */ #include stdio.h #include stdarg.h #include string.h #include stdlib.h -#include mysql/mysql.h +#include mysql.h #include php_embed.h +#define ARGV_BLOCKSIZE 1024 + extern C { my_bool php_init(UDF_INIT *initid, UDF_ARGS *args, char *message); void php_deinit(UDF_INIT *initid); -22,6 +25,7 int size; } rv_str; + my_bool php_init(UDF_INIT *initid, UDF_ARGS *args, char *message) { rv_str *rv = NULL; -61,6 +65,8 rv_str *rv = (rv_str *) initid-ptr; zval *zv = NULL; char **argv; + size_t
Re: [PHP-DEV] Re: Flash and PHP
please re-post this message to [EMAIL PROTECTED] php-dev is a wrong list for such questions. -- Maxim Maletsky [EMAIL PROTECTED] On Sat, 9 Nov 2002 21:45:13 +0100 Georg [EMAIL PROTECTED] wrote: Hi Folks I try to comfortize my webpages using flash.The server part is still PHP implemented. Has anyone experiences on this subjects. Especially trial and errors ;) could be very informativ to me. thanks for your help in advance kind regards Georg -- 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] $HTTP_RAW_POST_DATA
Wednesday, August 28, 2002, 3:15:13 PM, [EMAIL PROTECTED] wrote: is $HTTP_RAW_POST_DATA only filled if REQUEST_TYPE is set to POST? even if 'always_populate_raw_post_data = On'? does anyone have a short info on this? rasmus maybe? I to would like know when $HTTP_RAW_POST_DATA is supposed to be set. I recently upgrade from 4.2.3 to 4.3.0-dev and one of my scripts stopped working as $HTTP_RAW_POST_DATA wasn't set when data was POSTed. To fix this I had to turn always_populate_raw_post_data on. Any documentation on this variable should work? -- Kjartan [EMAIL PROTECTED] (http://natrak.net/) :: Scandisk is now checking your hard disk. You can start praying. -- PHP Development Mailing List http://www.php.net/ To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DEV] $HTTP_RAW_POST_DATA
Yes, it has to be a POST request for there to be post data and $HTTP_RAW_POST_DATA is populated if the mime type of the data is unrecoginized or if always_populate_raw_post_data is on. On Sat, 9 Nov 2002, Kjartan Mannes wrote: Wednesday, August 28, 2002, 3:15:13 PM, [EMAIL PROTECTED] wrote: is $HTTP_RAW_POST_DATA only filled if REQUEST_TYPE is set to POST? even if 'always_populate_raw_post_data = On'? does anyone have a short info on this? rasmus maybe? I to would like know when $HTTP_RAW_POST_DATA is supposed to be set. I recently upgrade from 4.2.3 to 4.3.0-dev and one of my scripts stopped working as $HTTP_RAW_POST_DATA wasn't set when data was POSTed. To fix this I had to turn always_populate_raw_post_data on. Any documentation on this variable should work? -- Kjartan [EMAIL PROTECTED] (http://natrak.net/) :: Scandisk is now checking your hard disk. You can start praying. -- 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] Freeing memory
Hi Wez, I wrote a pecl extension called ecasound which interacts with an audio processing library. Now the way that ecasound is written will change in future versions and will have a fully interactive mode, all other implementations (perl, python c++ etc) have been re-written so that they open up a couple of pipes, fork and then exec ecasound in the child process so using the interactive mode instead of linking against the librarys. What I would like to do is to make the PHP implementation work in the same way as all of the others but of course PHP does not yet have full 2 way communication with a child process. I agree that extending proc_open may be the best solution but while I would be willing to do the work I'm not sure that I can at the moment. Working with processes etc in c is fairly new to me and so are PHP extensions so trying to extend someone else's function that already looks fairly complex may be beyond me at this time (also I do not know anything about programming under win32). Maybe I'll take another look though as If this would really be the best way to implement the functionality I need then it may be a good learning exercise :) Tony On Sat, 2002-11-09 at 19:52, Wez Furlong wrote: Hi Tony, What kind of things are you planning to do? proc_open seems ideal to extend for this purpose, and works on win32. --Wez. On 09/11/02, Tony Leake [EMAIL PROTECTED] wrote: The whole picture is that i want to control a child process completely from within php. A bit like popen or proc_open but with 2 independent pipes to the child's stdin and stdout that I can read and write to. So I'm basically wrapping the c functions pipe(), dup2() and friends. Once I have it all working I will offer to add the functions into the pcntl extension if they're wanted. -- 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] Glob, anyone paying attention?
I was just playing with glob() and realized that its pretty undocumented (no flags doc'd) and none of the constants (GLOB_ONLYDIR for example) are actually defined in PHP Just wanted to see if anyone is doing something with this, if not (unless someone has an objection) I'll get put the constants in PHP and update the docs. I was thinking of just defining the following (since a few don't seem to apply): GLOB_MARK Append a slash to filenames which are really directories GLOB_NOSORT Do not sort the returned filenames GLOB_NOCHECKIf no files were found that match the filemask, return the filemask instead of an empty array GLOB_ONLYDIROnly match directories which meet the filemask John -- 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
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] 64-bit PHP 4.3 (extensive long vs int problems)
Hi, Referring to bug #20268 (Bus Error on startup), I have added some comments about show-stopping problems with PHP 4.3 with regards to its lack of 64-bit cleanliness. The main problems seem to be Zend's OnUpdateInt (which seems misnamed although it uses zend_atoi, it assigns to a long) and PHP modules' use of zend_parse_parameters (which again acts on longs, not ints, though that has slipped by the authors of some modules). (Please forgive some of the less coherent sentences in my comments on the bug.) I have provided patches that demonstrate how I managed to get PHP working (in particular with SPARCv9 Solaris 8 and Apache 2.0). Regards, A random but concerned 64-bit user. -- PHP Development Mailing List http://www.php.net/ To unsubscribe, visit: http://www.php.net/unsub.php