Re: [PHP-DEV] Issues in passing session data

2003-03-05 Thread Derick Rethans
Hello,

please forward user questions to the [EMAIL PROTECTED]
mailinglist, this list is for development _OF_ PHP, not development
_with_ PHP.

Derick

On Wed, 5 Mar 2003, Hantzley wrote:

 Hi php users,
 I have some questions regarding the way developers uses php sessions.
 For instance, most developers uses session_start() on top of every page. The
 problem is that after visiting each page, a new session file is created on
 the server. Now i made a web application that uses the start_session
 function on top of every page as follows:
 
 ?
   if ($PHPSESSID){
session_start($PHPSESSID);
if (session_is_registered('valid_user')){
 ?
 
 and it works. But now only one session file is created on the server.
 
 Is this the best way of passing session data??
 
 Hantzley
 
 
 
 

-- 
Stop mad cowboy disease!
-
 Derick Rethans http://derickrethans.nl/ 
 PHP Magazine - PHP Magazine for Professionals   http://php-mag.net/
-

-- 
PHP Development Mailing List http://www.php.net/
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DEV] [PATCH] - 64 bit issue with zend_parse_parameters calls

2003-03-05 Thread David Hill

 Just commit these..

I will - give me a couple of days though - given that it is my first
commit with php I want to triple check that I have got the process
correct before I push the button :-)

Dave


-- 
PHP Development Mailing List http://www.php.net/
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DEV] [PATCH] - fix for 64 bit issues with OnUpdateInt

2003-03-05 Thread David Hill

 A single API is probably sufficient but I can understand that extension 
 writers might want to use ints. The INI flag might have nothing to do with 
 an internal zval and an int might be more than enough.
 I don't really mind but I wouldn't introduce OnUpdateInteger.
 I guess we should either move everything to OnUpdateLong() and nuke 
 OnUpdateInt() in ZE2 or we change OnUpdateInt to work with ints and fix the 
 whole code.


 It might be less confusing to just have one.

I agree about the confusing part. My suggestion is:

 *  we leave OnUpdateInt as is currently for BC, deprecating it now, removing it in (? 
php 5.x == ZE2 ?)

 *  convert everything in the code base to OnUpdateLong, which means I change the 
arguments passed into the call where needed (yipee I get to do another code sweep :-) 
This fixes the symantic problem and sets the stage for how to proceed in the future.

 * update the documentation with a note reminding people that int and long are not the 
same thing, both for OnUpdateInt and for zend_parse_parameters (I found 
zend_parse_parameters in the docs but not OnUpdateInt, any hints ?)

I *think* this would work with all of the comments I have seen on this issue. I will 
start coding today, and if people are ok with it I will commit on Friday (to allow 
time for comment) so that Jani can move on 4.3.2. 

dave

Re: [PHP-DEV] [PATCH] imagesavealpha()

2003-03-05 Thread Ilia A.
On March 5, 2003 12:18 am, Steven Brown wrote:
 I went to update the official gd library with my bug fixes so I could get
 them rolled back into PHP's without requiring PHP's gd diverge more, but it
 appears between the time PHP bundled gd and now that the gd people have
 fixed the most important of the truecolor problems that my patch used to
 fix - 2.0.11 managed to generate a truecolor boolean-transparent png.
 Problem is, PHP's bundled gd still fails.  I poked around PHP's CVS, and
 the bundled libgd reports having already been synched with 2.0.11, but
 something must have been missed as it fails like pre-2.0.11.  I'll try and
 look at what might have been missed in the sync when I get some more time. 
 For now, I've added it as a bug, http://bugs.php.net/22544 .

The bundled gd in php 5.0 has been sycnched with gd 2.0.11, this was not done 
for version 4.3.2.

Ilia

-- 
PHP Development Mailing List http://www.php.net/
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DEV] Modifying PHP variables in C

2003-03-05 Thread John Lim
Hi Moriyoshi
Thanks for the advice!

Moriyoshi Koizumi [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 You should use zval_ptr_dtor() to dispose the old value. Note the old
 value won't actually be freed as long as any reference to the variable is
 alive.




-- 
PHP Development Mailing List http://www.php.net/
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-DEV] pg_lo_open and object creation... intended behavior?

2003-03-05 Thread David Brown
Hi:

This is an excerpt from ext/pgsql/pgsql.c, in pg_lo_open:

---
if (strchr(mode_string, 'w') == mode_string) {
pgsql_mode |= INV_WRITE;
create = 1;
if (strchr(mode_string, '+') == mode_string+1) {
pgsql_mode |= INV_READ;
}
}

pgsql_lofp = (pgLofp *) emalloc(sizeof(pgLofp));

if ((pgsql_lofd = lo_open(pgsql, oid, pgsql_mode)) == -1) {
if (create) {
if ((oid = lo_creat(pgsql, INV_READ|INV_WRITE)) == 0) {
efree(pgsql_lofp);
php_error_docref(NULL TSRMLS_CC, E_WARNING,
 Unable to create PostgreSQL large object.);
RETURN_FALSE;
} else {
if ((pgsql_lofd = lo_open(pgsql, oid, pgsql_mode)) == -1) {
if (lo_unlink(pgsql, oid) == -1) {
efree(pgsql_lofp);
...
}

  ... registers resource and returns ...
---

If I'm reading this correctly, it looks like a call to pg_lo_open (with
an object identifier specified explicitly in $oid) can theoretically
return a file handle pointing to a different, newly-created large
object in the case that the initial open failed.

If this is the case, it seems unintuitive and very cumbersome to handle
from user-space. Can we change the 'if (create) {' branch to only be
triggered when the oid was left unset (ensuring that the open() failure
actually gets back to the caller)?


Best Regards,

- Dave
  [EMAIL PROTECTED]

-- 
PHP Development Mailing List http://www.php.net/
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-DEV] Question about zend_compile

2003-03-05 Thread John Coggeshall

I'm playing around with the compiler/executor and I was wondering if
someone could answer a question.. 

Is there any reasonable way to essentially push/pop the function table?
What I'd like to do is get a function_table hash for only a single file
(pesudo code below):

PUSH_FUNCTION_TABLE(CG(function_table))
Op_array = zend_compile_file(fh, ZEND_REQUIRE);

/* retrieve information from the function_table 
about the functions in the fh handle only*/

POP_FUNCTION_TABLE(CG(function_table))

Specifically, I'd like to get the zend_function structures for the
user-defined functions declared inside of myfile.php... Basically my
problem is I have a userspace get_func_info($filename) function which
works great when retrieving information from the function table after
zend_compile_file(), but I end up having more functions than I wanted
since every user-defined function regardless of file (including the file
I'm in) is in the hash... i.e.

Myscript.php
?php
function foo() {

}
/* supposed to return an array based 
   on the function declarations in myfile.php, but it includes
foo() because it's already in the function table when zend
compiled this script. */
$info = get_func_info(myfile.php) 
?

It seems to me that this is exactly the sort of thing I would want to
use namespaces for, is there a elequent way to create a new namespace
from within my C function temporarily between when my function is called
and returns?

Suggestions? 

John



-- 
PHP Development Mailing List http://www.php.net/
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DEV] Question about zend_compile

2003-03-05 Thread George Schlossnagle
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] FYI: PHP/threads

2003-03-05 Thread Timm Friebe
I've been playing around with the (not new) idea of introducing threads
into PHP userland (maybe something to think about havin in PHP6?). What
came out of it is available at [1], offering an object oriented API (in
comparison to PECL/threads [2]).

Threads would quite likely come in handy in the following situations:
- GTK-PHP thin network client application polling a socket for events
  (e.g., IRC client)

- Multiple simultaneous connections to slow services (for instance,
  think of whois + check multiple domain names).

Both of these examples could be realized using fork() or
socket_select(), though the first is not portable and the latter
produces unnecessary overhead.

Maybe someone here would like to pick up on this idea or give some
directions to what would have to be done to make this actually work
dependably. I'm experiencing the same issues as with PECL/threads -
variable confusion (local function arguments with same names in two
threads affect each other), Engine unstability (Warning: ... in ... on
line -18182899), but could get a couple of samples[3] to work quite
well.

Maybe the userland API could be adopted by PECL/threads? Is anyone still
working at this or was development given up?

1] http://sitten-polizei.de/php/threads-0.1alpha.tar.gz
2] http://cvs.php.net/cvs.php/pear/PECL/threads
3] http://sitten-polizei.de/php/threads/tests/?file=mythread.php
   http://sitten-polizei.de/php/threads/tests/?file=timer.php
   http://sitten-polizei.de/php/threads/tests/?file=simple.php
   http://sitten-polizei.de/php/threads/tests/?file=calendar.php
   etc.

- Timm
Threads for PHP

$Id$

1. API:
---
The thread API for PHP was designed to assemble that of Java (see
API documentation for lang.Thread).

2. Usage:
-
To create a thread, subclass the Thread class (defined in threads.c)
and overwrite its run() method. Put any code to be executed into this
function.

3. Basic example:
-
?php
  class MyThread extends Thread {
public function run() {
  print(thread init\n);
  sleep(4);
  print(thread finished\n);
}
  }
  
  $m= new MyThread();
  $m-start();
  
  // Wait for thread
  print(main\n);
  sleep(5);
  print(main done\n);
?

For more examples, see the tests/ subdirectory.

3.1. Example scripts output:


mythread.php (the sourcecode above)
| thread init
| main
| thread finished
| main done

timer.php (schedule reminder to alert in five seconds from now)
| About to schedule task.
| Task scheduled at 18:33:59.
| 18:33:59
| 18:34:00
| 18:34:01
| 18:34:02
| 18:34:03
| Reminder: It's now 18:34:04!
| 18:34:04
| Done.

calendar.php (schedule three tasks to alter in 2, 5 and 8 seconds from now)
| About to schedule tasks.
| Tasks scheduled at 18:34:35.
| 18:34:35
| 18:34:36
| Reminder: It's now 18:34:37, Buy food
| 18:34:37
| 18:34:38
| 18:34:39
| Reminder: It's now 18:34:40, Cook it
| 18:34:40
| 18:34:41
| 18:34:42
| Reminder: It's now 18:34:43, Meal done
| 18:34:43
| 18:34:44
| Done.

consumer_producer.php (demonstrate wait/notify)
|  Producer put 0 into resource #0
|  Consumer got 0 from resource #0
|  Producer put 1 into resource #0
|  Consumer got 1 from resource #0
|  Producer put 2 into resource #0
|  Consumer got 2 from resource #0
|  Producer put 3 into resource #0
|  Consumer got 3 from resource #0
|  Producer put 4 into resource #0
|  Consumer got 4 from resource #0
|  Producer put 5 into resource #0
|  Consumer got 5 from resource #0
|  Producer put 6 into resource #0
|  Consumer got 6 from resource #0
|  Producer put 7 into resource #0
|  Consumer got 7 from resource #0
|  Producer put 8 into resource #0
|  Consumer got 8 from resource #0
|  Producer put 9 into resource #0
|  Consumer got 9 from resource #0
| ### Done

hostcheck.php (NOT WORKING CORRECTLY, threads do not get joined)
| --- Trying test.edu:443
| --- Trying php3.de:25
| --- Trying blup.blop:1010
| --- Trying localhost:80
| --- Trying localhost:6100
|   -ERR test.edu:443 [-1078991188]: getaddrinfo: null result pointer
|   +OK php3.de:25
|   -ERR blup.blop:1010 [-1079200356]: getaddrinfo: null result pointer
| === Destruct thread for blup.blop:1010
|   +OK localhost:80
| === Destruct thread for localhost:80
|   -ERR localhost:6100 [61]: Connection refused
| === Destruct thread for localhost:6100
| DONE
| === Destruct thread for test.edu:443
| === Destruct thread for php3.de:25

The ideas for the examples were taken from
http://java.sun.com/docs/books/tutorial/essential/threads/index.html

4. Problems:

- Mysterious things happen at the moment: E.g., global variables dissapear,
  fatal errors in run() lead to a failed longjmp() and therefore to Abort
  trap, join() doesn't return the correct value (mostly returning NULL:
  I guess this has to do with the thread's EG(retval_ptr_ptr) overwriting
  one another(?)).
  
- This does NOT work with ZTS, there are 

[PHP-DEV] Re: [Zend Engine 2] FYI: PHP/threads

2003-03-05 Thread George Schlossnagle
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


[PHP-DEV] modules in c++

2003-03-05 Thread Michel M. dos Santos


Hi,

I've been trying use C++ within a PHP extension with help by document in  
http://www.tutorbuddy.com/software/phpcpp/phpcpp/. 
The instructions works fine but I have problems with linking objects. The 
script libtool links objects with gcc and not with g++ and  the moment of 
creation of the dinamic library .so gcc is used and not g++.

See:

/bin/sh /root/biac_php/teste/libtool --mode=link gcc  -I.
 ^^^  
-I/root/biac_php/teste/ -I/root/biac_php/teste/main -I/root/biac_php/teste 
-I/usr/include/php4 -I/usr/include/php4/main -I/usr/include/php4/Zend 
-I/usr/include/php4/TSRM  -DHAVE_CONFIG_H -g -O2   -o teste.la -avoid-version 
-module -rpath /root/biac_php/teste/modules   teste.lo

gcc -shared  teste.lo   -Wl,-soname -Wl,teste.so -o .libs/teste.so
^^^

Thanks,

Michel M. dos Santos


-- 
PHP Development Mailing List http://www.php.net/
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-DEV] Re: modules in c++

2003-03-05 Thread J Smith

That should still work fine, though, shouldn't it? I mean, the .so spit out
should be working properly. I just tested this with a C++ extension and
while gcc was used by libtool for the linking, the extension works fine.

If you really want the C++ compiler to do the linking, you can open up
libtool file that's generated and edit the line that reads CC=gcc to say
CC=g++. I'm not sure if there's a better way to do this. At least, I
haven't found one yet. If you find something that works a bit better, let
me know and I'll update the article.

J


Michel M. Dos Santos wrote:

 
 
 Hi,
 
 I've been trying use C++ within a PHP extension with help by document in
 http://www.tutorbuddy.com/software/phpcpp/phpcpp/.
 The instructions works fine but I have problems with linking objects. The
 script libtool links objects with gcc and not with g++ and  the moment of
 creation of the dinamic library .so gcc is used and not g++.
 
 See:
 
 /bin/sh /root/biac_php/teste/libtool --mode=link gcc  -I.
  ^^^
 -I/root/biac_php/teste/ -I/root/biac_php/teste/main -I/root/biac_php/teste
 -I/usr/include/php4 -I/usr/include/php4/main -I/usr/include/php4/Zend
 -I/usr/include/php4/TSRM  -DHAVE_CONFIG_H -g -O2   -o teste.la
 -avoid-version
 -module -rpath /root/biac_php/teste/modules   teste.lo
 
 gcc -shared  teste.lo   -Wl,-soname -Wl,teste.so -o .libs/teste.so
 ^^^
 
 Thanks,
 
 Michel M. dos Santos


-- 
PHP Development Mailing List http://www.php.net/
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DEV] Re: modules in c++

2003-03-05 Thread Michel M. dos Santos


J,

First, thanks by your article. My original e first problem is :

PHP Warning:  Unable to load dynamic library 
'/usr/lib/php4/20010901/biac.so' - /usr/lib/php4/20010901/biac.so: undefined 
symbol: endl__FR7ostream in Unknown on line 0

The use of cout (in this case) result it. I try with std::cout or using 
namespace std but not resolve. Linking with g++ the error dont occur. 

What is wrong ?

Thanks a lot,

Michel M. dos Santos



On Wednesday 05 March 2003 17:23, J Smith wrote:
 That should still work fine, though, shouldn't it? I mean, the .so spit out
 should be working properly. I just tested this with a C++ extension and
 while gcc was used by libtool for the linking, the extension works fine.

 If you really want the C++ compiler to do the linking, you can open up
 libtool file that's generated and edit the line that reads CC=gcc to say
 CC=g++. I'm not sure if there's a better way to do this. At least, I
 haven't found one yet. If you find something that works a bit better, let
 me know and I'll update the article.

 J

 Michel M. Dos Santos wrote:
  Hi,
 
  I've been trying use C++ within a PHP extension with help by document in
  http://www.tutorbuddy.com/software/phpcpp/phpcpp/.
  The instructions works fine but I have problems with linking objects. The
  script libtool links objects with gcc and not with g++ and  the moment of
  creation of the dinamic library .so gcc is used and not g++.
 
  See:
 
  /bin/sh /root/biac_php/teste/libtool --mode=link gcc  -I.
   ^^^
  -I/root/biac_php/teste/ -I/root/biac_php/teste/main
  -I/root/biac_php/teste -I/usr/include/php4 -I/usr/include/php4/main
  -I/usr/include/php4/Zend -I/usr/include/php4/TSRM  -DHAVE_CONFIG_H -g -O2
-o teste.la
  -avoid-version
  -module -rpath /root/biac_php/teste/modules   teste.lo
 
  gcc -shared  teste.lo   -Wl,-soname -Wl,teste.so -o .libs/teste.so
  ^^^
 
  Thanks,
 
  Michel M. dos Santos

-- 
PHP Development Mailing List http://www.php.net/
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP-DEV] Re: modules in c++

2003-03-05 Thread Dave Viner
do you have the PHP_REQUIRE_CXX() in your config.m4?

dave


-Original Message-
From: Michel M. dos Santos [mailto:[EMAIL PROTECTED]
Sent: Wednesday, March 05, 2003 12:43 PM
To: [EMAIL PROTECTED]; [EMAIL PROTECTED]
Subject: Re: [PHP-DEV] Re: modules in c++




J,

First, thanks by your article. My original e first problem is :

PHP Warning:  Unable to load dynamic library
'/usr/lib/php4/20010901/biac.so' - /usr/lib/php4/20010901/biac.so: undefined
symbol: endl__FR7ostream in Unknown on line 0

The use of cout (in this case) result it. I try with std::cout or using
namespace std but not resolve. Linking with g++ the error dont occur.

What is wrong ?

Thanks a lot,

Michel M. dos Santos



On Wednesday 05 March 2003 17:23, J Smith wrote:
 That should still work fine, though, shouldn't it? I mean, the .so spit
out
 should be working properly. I just tested this with a C++ extension and
 while gcc was used by libtool for the linking, the extension works fine.

 If you really want the C++ compiler to do the linking, you can open up
 libtool file that's generated and edit the line that reads CC=gcc to say
 CC=g++. I'm not sure if there's a better way to do this. At least, I
 haven't found one yet. If you find something that works a bit better, let
 me know and I'll update the article.

 J

 Michel M. Dos Santos wrote:
  Hi,
 
  I've been trying use C++ within a PHP extension with help by document in
  http://www.tutorbuddy.com/software/phpcpp/phpcpp/.
  The instructions works fine but I have problems with linking objects.
The
  script libtool links objects with gcc and not with g++ and  the moment
of
  creation of the dinamic library .so gcc is used and not g++.
 
  See:
 
  /bin/sh /root/biac_php/teste/libtool --mode=link gcc  -I.
   ^^^
  -I/root/biac_php/teste/ -I/root/biac_php/teste/main
  -I/root/biac_php/teste -I/usr/include/php4 -I/usr/include/php4/main

 -I/usr/include/php4/Zend -I/usr/include/php4/TSRM  -DHAVE_CONFIG_H -g -O2
-o teste.la
  -avoid-version
  -module -rpath /root/biac_php/teste/modules   teste.lo
 
  gcc -shared  teste.lo   -Wl,-soname -Wl,teste.so -o .libs/teste.so
  ^^^
 
  Thanks,
 
  Michel M. dos Santos

--
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: modules in c++

2003-03-05 Thread Michel M. dos Santos

Yes.

My config.m4:


PHP_ARG_ENABLE(biac, for biac support,[ --enable-biacEnable biac 
support])

if test $PHP_BIAC != no ; then
 PHP_ADD_LIBRARY(stdc++)
 PHP_EXTENSION(biac,$ext_shared)
 PHP_REQUIRE_CXX()
fi

Michel M. dos Santos



On Wednesday 05 March 2003 18:01, Dave Viner wrote:
 do you have the PHP_REQUIRE_CXX() in your config.m4?

 dave


 -Original Message-
 From: Michel M. dos Santos [mailto:[EMAIL PROTECTED]
 Sent: Wednesday, March 05, 2003 12:43 PM
 To: [EMAIL PROTECTED]; [EMAIL PROTECTED]
 Subject: Re: [PHP-DEV] Re: modules in c++




   J,

   First, thanks by your article. My original e first problem is :

   PHP Warning:  Unable to load dynamic library
 '/usr/lib/php4/20010901/biac.so' - /usr/lib/php4/20010901/biac.so:
 undefined symbol: endl__FR7ostream in Unknown on line 0

   The use of cout (in this case) result it. I try with std::cout or using
 namespace std but not resolve. Linking with g++ the error dont occur.

   What is wrong ?

   Thanks a lot,

 Michel M. dos Santos

 On Wednesday 05 March 2003 17:23, J Smith wrote:
  That should still work fine, though, shouldn't it? I mean, the .so spit

 out

  should be working properly. I just tested this with a C++ extension and
  while gcc was used by libtool for the linking, the extension works fine.
 
  If you really want the C++ compiler to do the linking, you can open up
  libtool file that's generated and edit the line that reads CC=gcc to
  say CC=g++. I'm not sure if there's a better way to do this. At least,
  I haven't found one yet. If you find something that works a bit better,
  let me know and I'll update the article.
 
  J
 
  Michel M. Dos Santos wrote:
   Hi,
  
   I've been trying use C++ within a PHP extension with help by document
   in http://www.tutorbuddy.com/software/phpcpp/phpcpp/.
   The instructions works fine but I have problems with linking objects.

 The

   script libtool links objects with gcc and not with g++ and  the moment

 of

   creation of the dinamic library .so gcc is used and not g++.
  
   See:
  
   /bin/sh /root/biac_php/teste/libtool --mode=link gcc  -I.
^^^
   -I/root/biac_php/teste/ -I/root/biac_php/teste/main
   -I/root/biac_php/teste -I/usr/include/php4 -I/usr/include/php4/main
 
  -I/usr/include/php4/Zend -I/usr/include/php4/TSRM  -DHAVE_CONFIG_H -g -O2
 
 -o teste.la
   -avoid-version
   -module -rpath /root/biac_php/teste/modules   teste.lo
  
   gcc -shared  teste.lo   -Wl,-soname -Wl,teste.so -o .libs/teste.so
   ^^^
  
   Thanks,
  
   Michel M. dos Santos

-- 
PHP Development Mailing List http://www.php.net/
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP-DEV] Re: modules in c++

2003-03-05 Thread Dave Viner
with that config.m4, running:
% phpize  ./configure --enable-biac=shared  make

should yield this:
/bin/bash dir/libtool --mode=compile g++

is that the case or not?

dave

-Original Message-
From: Michel M. dos Santos [mailto:[EMAIL PROTECTED]
Sent: Wednesday, March 05, 2003 1:04 PM
To: Dave Viner; [EMAIL PROTECTED]; [EMAIL PROTECTED]
Subject: Re: [PHP-DEV] Re: modules in c++



Yes.

My config.m4:


PHP_ARG_ENABLE(biac, for biac support,[ --enable-biacEnable biac
support])

if test $PHP_BIAC != no ; then
 PHP_ADD_LIBRARY(stdc++)
 PHP_EXTENSION(biac,$ext_shared)
 PHP_REQUIRE_CXX()
fi

Michel M. dos Santos



On Wednesday 05 March 2003 18:01, Dave Viner wrote:
 do you have the PHP_REQUIRE_CXX() in your config.m4?

 dave


 -Original Message-
 From: Michel M. dos Santos [mailto:[EMAIL PROTECTED]
 Sent: Wednesday, March 05, 2003 12:43 PM
 To: [EMAIL PROTECTED]; [EMAIL PROTECTED]
 Subject: Re: [PHP-DEV] Re: modules in c++




   J,

   First, thanks by your article. My original e first problem is :

   PHP Warning:  Unable to load dynamic library
 '/usr/lib/php4/20010901/biac.so' - /usr/lib/php4/20010901/biac.so:
 undefined symbol: endl__FR7ostream in Unknown on line 0

   The use of cout (in this case) result it. I try with std::cout or using
 namespace std but not resolve. Linking with g++ the error dont occur.

   What is wrong ?

   Thanks a lot,

 Michel M. dos Santos

 On Wednesday 05 March 2003 17:23, J Smith wrote:
  That should still work fine, though, shouldn't it? I mean, the .so spit

 out

  should be working properly. I just tested this with a C++ extension and
  while gcc was used by libtool for the linking, the extension works fine.
 
  If you really want the C++ compiler to do the linking, you can open up
  libtool file that's generated and edit the line that reads CC=gcc to
  say CC=g++. I'm not sure if there's a better way to do this. At least,
  I haven't found one yet. If you find something that works a bit better,
  let me know and I'll update the article.
 
  J
 
  Michel M. Dos Santos wrote:
   Hi,
  
   I've been trying use C++ within a PHP extension with help by document
   in http://www.tutorbuddy.com/software/phpcpp/phpcpp/.
   The instructions works fine but I have problems with linking objects.

 The

   script libtool links objects with gcc and not with g++ and  the moment

 of

   creation of the dinamic library .so gcc is used and not g++.
  
   See:
  
   /bin/sh /root/biac_php/teste/libtool --mode=link gcc  -I.
^^^
   -I/root/biac_php/teste/ -I/root/biac_php/teste/main
   -I/root/biac_php/teste -I/usr/include/php4 -I/usr/include/php4/main
 

 -I/usr/include/php4/Zend -I/usr/include/php4/TSRM  -DHAVE_CONFIG_H -g -O2
 
 -o teste.la
   -avoid-version
   -module -rpath /root/biac_php/teste/modules   teste.lo
  
   gcc -shared  teste.lo   -Wl,-soname -Wl,teste.so -o .libs/teste.so
   ^^^
  
   Thanks,
  
   Michel M. dos Santos

--
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: modules in c++

2003-03-05 Thread J Smith

Looks like you need to link to the standard C++ library. Try putting this in
your config.m4 file:

PHP_ADD_LIBRARY(stdc++)

And run phpize, configure and make again. That should make gcc link with
stdc++. 

J


Michel M. Dos Santos wrote:

 
 
 J,
 
 First, thanks by your article. My original e first problem is :
 
 PHP Warning:  Unable to load dynamic library
 '/usr/lib/php4/20010901/biac.so' - /usr/lib/php4/20010901/biac.so:
 undefined symbol: endl__FR7ostream in Unknown on line 0
 
 The use of cout (in this case) result it. I try with std::cout or using
 namespace std but not resolve. Linking with g++ the error dont occur.
 
 What is wrong ?
 
 Thanks a lot,
 
 Michel M. dos Santos
 
 
 


-- 
PHP Development Mailing List http://www.php.net/
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DEV] Re: modules in c++

2003-03-05 Thread J Smith

Actually, try this instead of PHP_ADD_LIBRARY(stdc++) and see if that
works...

PHP_ADD_LIBRARY(stdc++, 1, BIAC_SHARED_LIBADD)

J


Michel M. Dos Santos wrote:

 
 Yes.
 
 My config.m4:
 
 
 PHP_ARG_ENABLE(biac, for biac support,[ --enable-biacEnable biac
 support])
 
 if test $PHP_BIAC != no ; then
  PHP_ADD_LIBRARY(stdc++)
  PHP_EXTENSION(biac,$ext_shared)
  PHP_REQUIRE_CXX()
 fi
 
 Michel M. dos Santos
 
 
 


-- 
PHP Development Mailing List http://www.php.net/
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DEV] Re: modules in c++

2003-03-05 Thread Sascha Schumann
Please supply 1 as the 6th argument to PHP_NEW_EXTENSION.

- Sascha

-- 
PHP Development Mailing List http://www.php.net/
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-DEV] Doing something with an each opcode as zend_execute() handles it

2003-03-05 Thread David Sklar
Just before zend_execute()/execute() handles each opcode in its big switch()
statement, I'd like to be able to call a function and pass it the opcode (or
other information from the opline.

Is the best approach to reset zend_execute to a new function in the
PHP_MINIT_FUNCTION() (and restore the saved value in
PHP_MSHUTDOWN_FUNCTION)? This new function would mostly be a copy of
execute() in zend_execute.c with my addtional function call tossed in.

What's the difference between zend_execute() and zend_execute_internal()?

Thanks,
David


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

2003-03-05 Thread Sterling Hughes
 Just before zend_execute()/execute() handles each opcode in its big switch()
 statement, I'd like to be able to call a function and pass it the opcode (or
 other information from the opline.
 
 Is the best approach to reset zend_execute to a new function in the
 PHP_MINIT_FUNCTION() (and restore the saved value in
 PHP_MSHUTDOWN_FUNCTION)? This new function would mostly be a copy of
 execute() in zend_execute.c with my addtional function call tossed in.
 
 What's the difference between zend_execute() and zend_execute_internal()?
 

Well, I have a feeling what you are talking about is sub-optimal, what
do you want to do?

-Sterling

 Thanks,
 David
 
 
 -- 
 PHP Development Mailing List http://www.php.net/
 To unsubscribe, visit: http://www.php.net/unsub.php

-- 
Reductionists like to take things apart.  The rest of us are
 just trying to get it together.
- Larry Wall, Programming Perl, 3rd Edition

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

2003-03-05 Thread David Sklar
On Wednesday, March 05, 2003 5:35 PM, Sterling Hughes wrote:

 Just before zend_execute()/execute() handles each opcode in its big
 switch() statement, I'd like to be able to call a function and pass
 it the opcode (or other information from the opline.

 Is the best approach to reset zend_execute to a new function in the
 PHP_MINIT_FUNCTION() (and restore the saved value in
 PHP_MSHUTDOWN_FUNCTION)? This new function would mostly be a copy of
 execute() in zend_execute.c with my addtional function call tossed
 in.

 What's the difference between zend_execute() and
 zend_execute_internal()?


 Well, I have a feeling what you are talking about is sub-optimal,
 what do you want to do?

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.

David


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

2003-03-05 Thread Sterling Hughes
 On Wednesday, March 05, 2003 5:35 PM, Sterling Hughes wrote:
 
  Just before zend_execute()/execute() handles each opcode in its big
  switch() statement, I'd like to be able to call a function and pass
  it the opcode (or other information from the opline.
 
  Is the best approach to reset zend_execute to a new function in the
  PHP_MINIT_FUNCTION() (and restore the saved value in
  PHP_MSHUTDOWN_FUNCTION)? This new function would mostly be a copy of
  execute() in zend_execute.c with my addtional function call tossed
  in.
 
  What's the difference between zend_execute() and
  zend_execute_internal()?
 
 
  Well, I have a feeling what you are talking about is sub-optimal,
  what do you want to do?
 
 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.

I would suggest you take a look at Ze2's execution architecture, it
should allow you to do this.

-Sterling

 David

-- 
Reductionists like to take things apart.  The rest of us are
 just trying to get it together.
- Larry Wall, Programming Perl, 3rd Edition

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

2003-03-05 Thread George Schlossnagle
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] Doing something with an each opcode as zend_execute() handles it

2003-03-05 Thread John Coggeshall

Look at zend_init_opcodes_handlers() and the zend_opcode_handler array..


John


-Original Message-
From: George Schlossnagle [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, March 05, 2003 6:10 PM
To: David Sklar
Cc: Sterling Hughes; [EMAIL PROTECTED]
Subject: 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




-- 
PHP Development Mailing List http://www.php.net/
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP-DEV] [PATCH] imagesavealpha()

2003-03-05 Thread Steven Brown

 -Original Message-
 From: Ilia A. [mailto:[EMAIL PROTECTED]
 Sent: Wednesday, March 05, 2003 6:31 AM
 To: Steven Brown; Pierre-Alain Joye; [EMAIL PROTECTED]
 Subject: Re: [PHP-DEV] [PATCH] imagesavealpha()


 On March 5, 2003 12:18 am, Steven Brown wrote:
  I went to update the official gd library with my bug fixes so I
 could get
  them rolled back into PHP's without requiring PHP's gd diverge
 more, but it
  appears between the time PHP bundled gd and now that the gd people have
  fixed the most important of the truecolor problems that my patch used to
  fix - 2.0.11 managed to generate a truecolor boolean-transparent png.
  Problem is, PHP's bundled gd still fails.  I poked around PHP's CVS, and
  the bundled libgd reports having already been synched with 2.0.11, but
  something must have been missed as it fails like pre-2.0.11.
 I'll try and
  look at what might have been missed in the sync when I get some
 more time.
  For now, I've added it as a bug, http://bugs.php.net/22544 .

 The bundled gd in php 5.0 has been sycnched with gd 2.0.11, this
 was not done
 for version 4.3.2.

I had tried testing it against the 'php5' CVS head and had the same
problems, is there a different repository or branch I should look at when
testing things against the current PHP CVS in the future?


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

2003-03-05 Thread David Sklar
On Wednesday, March 05, 2003 5:46 PM, Sterling Hughes wrote:

 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.

 I would suggest you take a look at Ze2's execution architecture, it
 should allow you to do this.

Such as overriding the opcode handlers for each opcode? I suppose I could
change what the handlers are initialized to in zend_init_opcodes_handler()
so that my new handler does the serialization and then calls the regular
handler. Does that make sense?


On Wednesday, March 05, 2003 6:10 PM, George Schlossnagle wrote:

 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).

Yeah, so far I'm just using a different zend_execute.c with my added code, I
was just wondering if there's a better/more formal/etc way to do it...

Thanks,
David


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

2003-03-05 Thread John Coggeshall
Such as overriding the opcode handlers for each opcode? I 
suppose I could change what the handlers are initialized to in 
zend_init_opcodes_handler() so that my new handler does the 
serialization and then calls the regular handler. Does that make sense?


Yep

Int my_do_fetch_r_handler(ZEND_OPCODE_HANDLER_ARGS) {
fprintf(stderr, we hooked fetch_r\n);
return
zend_do_fetch_r_handler(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU);

}

Is all you'd need.

John


-- 
PHP Development Mailing List http://www.php.net/
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-DEV] Resources and zend_register_list_destructors_ex

2003-03-05 Thread Dave Viner
Hi,
I'm having some trouble understanding persistent versus non-persistent
resources (in ZE1).  Does the Zend engine call _any_ non-persistent callback
dtor function for a resource at the end of a request?

For example:
If I register a resource type at MINIT time like so:

le_mod = zend_register_list_destructors_ex
(destroy_mod, NULL, MOD_TYPE_NAME, module_number);

then my resource will be destroyed at the end of each request.  However, if
I register a resource type at MINIT time like so:

le_mod = zend_register_list_destructors_ex
(NULL, destroy_mod, MOD_TYPE_NAME, module_number);

then my resource will be destroyed at the end of the _process_.
If I register my resource type like this:

le_mod = zend_register_list_destructors_ex
(destroy_mod, destroy_mod, MOD_TYPE_NAME, module_number);

Is that the equivalent of registering a non-persistent type?

thanks
dave


-- 
PHP Development Mailing List http://www.php.net/
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DEV] php_xslt: xslt_set_encoding

2003-03-05 Thread Edin Kadribasic
You can download latest stable snapshot from snaps.php.net or wait for 4.3.2
release.

Edin

- Original Message -
From: Michel Sahyoun [EMAIL PROTECTED]
To: [EMAIL PROTECTED]; [EMAIL PROTECTED];
[EMAIL PROTECTED]
Sent: Thursday, March 06, 2003 1:02 AM
Subject: [PHP-DEV] php_xslt: xslt_set_encoding


 I have downloaded the 4.3.1 windows binaries zip package and it doesn't
seem
 to have xslt_set_encoding() enabled.

 Can anyone confirm this? And short of getting the sources and recompiling
 PHP, is there another binary distribution that would have
 xslt_set_encoding() enabled?

 Thanks,

 Michel



 --
 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: [Zend Engine 2] FYI: PHP/threads

2003-03-05 Thread Alan Knowles
Timm Friebe wrote:

I've been playing around with the (not new) idea of introducing threads
into PHP userland (maybe something to think about havin in PHP6?). What
came out of it is available at [1], offering an object oriented API (in
comparison to PECL/threads [2]).
 

-one of the reasons to not try object stuff initially (although it was 
in the todo) was to try and find out the issues :) - more below

Maybe someone here would like to pick up on this idea or give some
directions to what would have to be done to make this actually work
dependably. I'm experiencing the same issues as with PECL/threads -
variable confusion (local function arguments with same names in two
threads affect each other), Engine unstability (Warning: ... in ... on
line -18182899), but could get a couple of samples[3] to work quite
well.
Maybe the userland API could be adopted by PECL/threads? Is anyone still
working at this or was development given up?
not totally given up.. - but it's kind of a low priority unfortunatly 
(as it would be very nice)

To try and go through some of the issues with threads:
http://talks.php.net/show/kongress-gtk-future-2002/14
gives a few clues...
the reality is that all the zend_ctor... methods etc. are thread safe 
(assuming you compiled with the experimental zts flag) - this however 
introduces lots of problems when working with threads as the zend engine 
will allocate memory to the wrong thread, and hence try and free it when 
that thread closes.

what you demonstrated was the idea of copying the object instance from 
one thread to another (unfortunatly you also have to copy the object 
definition - eg. the opcodes) to make it work.. - whats worse is that 
you have to create memory that the engine doesnt know about.. - and then 
pass it too the new instance.. and tell the new instance that it is now 
incharge of that memory..

the idea of a thread_include() function was that it would be a starting 
point which would be idiot proof from the user (and less complex from 
the coding side..) - and would not involve the complexity of opcode 
replications (which would have to use something like the code in 
bcompiler..)

Hope this doesnt put you off.. - as I would still love to see it in PHPx 
somewhere :)

I guess the other issue was to try and ensure it was cross platform (as 
in reality most of those gtk apps are going to have to run on windows).. 
- so Shane did an amazing amount of work building the cross platform 
library..

Regards
Alan




1] http://sitten-polizei.de/php/threads-0.1alpha.tar.gz
2] http://cvs.php.net/cvs.php/pear/PECL/threads
3] http://sitten-polizei.de/php/threads/tests/?file=mythread.php
  http://sitten-polizei.de/php/threads/tests/?file=timer.php
  http://sitten-polizei.de/php/threads/tests/?file=simple.php
  http://sitten-polizei.de/php/threads/tests/?file=calendar.php
  etc.
- Timm
 

 


--
Can you help out? 
Need Consulting Services or Know of a Job?
http://www.akbkhome.com



--
PHP Development Mailing List http://www.php.net/
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP-DEV] php_xslt: xslt_set_encoding

2003-03-05 Thread Michel Sahyoun
I have downloaded the 4.3.1 windows binaries zip package and it doesn't seem
to have xslt_set_encoding() enabled.

Can anyone confirm this? And short of getting the sources and recompiling
PHP, is there another binary distribution that would have
xslt_set_encoding() enabled?

Thanks,

Michel



-- 
PHP Development Mailing List http://www.php.net/
To unsubscribe, visit: http://www.php.net/unsub.php