[PHP-DEV] RE: PHP profiling results under 2.0.37 Re: Performance of Apache 2.0 Filter

2002-06-10 Thread Sander Striker

 From: Andi Gutmans [mailto:[EMAIL PROTECTED]]
 Sent: 08 June 2002 13:59

 On Fri, 7 Jun 2002, Ryan Bloom wrote:
 
 On Fri, 7 Jun 2002, Brian Pane wrote:
 
 On Fri, 2002-06-07 at 01:14, Sascha Schumann wrote:
 The function php_apache_sapi_ub_write() is inserting a flush bucket
 after each bucket of data that it adds to the output brigade.
 
 The 'ub' stands for unbuffered.. you can avoid that by
 enabling output buffering in php.ini.
 
 IMHO, that's a design flaw.  Regardless of whether PHP is doing
 buffering, it shouldn't break up blocks of static content into
 small pieces--especially not as small as 400 bytes.  While it's
 certainly valid for PHP to insert a flush bucket right before a
 block of embedded code (in case that code takes a long time to
 run), breaking static text into 400-byte chunks will usually mean
 that it takes *longer* for the content to reach the client, which
 probably defeats PHP's motivation for doing the nonbuffered output.
 There's code downstream, in the httpd's core_output_filter and
 the OS's TCP driver, that can make much better decisions about
 when to buffer and when not to buffer.
 
 
 We did quite a lot of tests on this issue a couple of years ago and found
 that not scanning all of the embedded HTML in one big piece but breaking
 it down to chunks around 400bytes yields better performance.
 
 I can say that in general, best performance with PHP is achieved when
 using full output buffering. ASP seems to do the same and while we were at
 MS Labs doing benchmarks of PHP vs. ASP this was one of the settings we
 found made PHP compete well with ASP.
 
 Another change we made, as I mentioned in a previous Email, was using
 non-mutexing per-thread memory pools (HeapCreate(HEAP_NO_SERIALIZE, ...)).
 To get best performance with Apache 2 we would really need such a memory
 pool.

And we already have it!  Just do:

  apr_allocator_t *allocator;

  apr_allocator_create(allocator);
  apr_pool_create_ex(pool, parent_pool, abort_fn, allocator);
  apr_allocator_owner_set(allocator, pool);

Now you have a mutexless allocator associated with a pool.  All child pools
of this pool will use the same allocator and will therefor also have no
mutex.

Apache 2.0 uses this extensively in the mpms where we indeed know that only
one thread is going to be accessing a pool.

Why is PHP even using its own memory allocation scheme?  It would be much
easier to just use pools and point out where it doesn't work for you.

Sidenote: the mutex isn't even being used on each and every allocation, only
  when a full 8k block is fully consumed and a new one is needed.

[Pasted this in from a mail in the same thread]
* php_request_shutdown() calls shutdown_memory_manager(), which
  does a large number of calls to free() per request.  If there's
  any way to get the PHP allocator to use an APR pool, that
  should help speed things up a lot.  (The mallocs and frees are
  going to be especially problematic within multithreaded MPMs.)

 We're already doing this for Win32. Check out 
 ZEND_DO_MALLOC/ZEND_DO_FREE/ZEND_DO_REALLOC in zend_alloc.c. Note that in 
 Win32 we only skip the free's if we're in release mode. If we're in debug 
 mode we use a per-thread pool but we do the frees because it's our memory 
 leak detector.

Just run with --enable-pool-debug=yes and enable a tool like electric fence
or valgrind.  No need to put that stuff in your own code.
 
 Andi

Sander

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




Re: [PHP-DEV] RE: PHP profiling results under 2.0.37 Re: Performance of Apache 2.0 Filter

2002-06-10 Thread Zeev Suraski

At 09:03 AM 6/10/2002, Sander Striker wrote:
Why is PHP even using its own memory allocation scheme?  It would be much
easier to just use pools and point out where it doesn't work for you.

Because we don't want it depend on any underlying services which aren't 
available in all servers.  We can say that in general, the no-free 
allocation scheme doesn't work at all with PHP, so the pool approach cannot 
be used.  Even if we could use it, though, all of the services of the 
memory allocator are still necessary at the PHP level so we can provide 
them outside the scope of Apache 2.

What we need for efficient thread-safe operation is a mechanism like the 
Win32 heaps - mutexless heaps, that provide malloc and free services on a 
(preferably) contiguous pre-allocated block of memory.  The question is 
whether the APR allocators fall into that category:

1.  Can you make them mutexless completely?  I.e., will they never call 
malloc()?
2.  They definitely do provide alloc/free services, we're ok there
3.  As far as I can tell, they don't use a contiguous block of memory, 
which means more fragmentation...

Zeev

Zeev


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




RE: [PHP-DEV] REPOST: Class Autoloading [PATCH]

2002-06-10 Thread phpsurf

this patch would be really great !

I can remember it has been discussed a lot on the ZE2 mailing list about the
'import' feature.
some people (and I was) would have apreciated another name because this name
was already used in many PHP frameworks to implement a function that loads
classes.

As far as I followed this thread, the agreement was that the import keyword
can be used fine for namespaces if a autoload statement was patched to the
engine ... so everyone would be happy ! :)

I guess your patch gives some function like this one :
set_classautoload_handler(myAutoLoader);

and then, one can implement a function like this:
myAutoLoader($className) {
 if (!class_exists($className)) {
  include(class/.str_replace(_, /, $className)..php);
  }
}

I'm sure many programmers would apreciate such a feature.
Especially as it whould have no BC issue at all !

 -Original Message-
 From: Ivan Ristic [mailto:[EMAIL PROTECTED]]
 Sent: dimanche 9 juin 2002 22:46
 To: Zeev Suraski
 Cc: [EMAIL PROTECTED]
 Subject: Re: [PHP-DEV] REPOST: Class Autoloading [PATCH]


  I believe this has been discussed in the past and not ack'd,
 please read
  the php-dev archives...

   I tried and I tried but I couldn't find a discussion on anything
   similar on the mailing list.

   The code I sent is *already* in use, and has been in
   use for some time now. Take a look at this message from
   November 2001:

   http://marc.theaimsgroup.com/?l=php-devm=100687224711738w=2

   I didn't introduce anything new, so if it was OK then it should be
   OK now. Also, the code cannot affect the people that are not using
   the feature so I do not think that there will be any kind of impact
   on the existing user base.

   This feature makes it possible to have one class per file and not
   to worry about inclusion at all. It becomes especially useful when
   used together with products such as Zend Accelerator, where files
   are cached (and you do not have to worry about a large number of
   small files).

 --
 Ivan Ristic, [EMAIL PROTECTED]
 [ Weblog on PHP, Software development, Intranets,
 and Knowledge Management: http://www.webkreator.com ]


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


 
__
ifrance.com, l'email gratuit le plus complet de l'Internet !
vos emails depuis un navigateur, en POP3, sur Minitel, sur le WAP...
http://www.ifrance.com/_reloc/email.emailif



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




[PHP-DEV] Compile error (cvs HEAD)

2002-06-10 Thread Jan Schneider

/root/cvs/cvsphp/ext/standard/array.c: In function `zif_array_rand':
/root/cvs/cvsphp/ext/standard/array.c:2949: `array_data_shuffle' undeclared
(first use in this 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] CVS Account Request: emil

2002-06-10 Thread derick

On 10 Jun 2002, emil santos wrote:

 (phpdoc)
 Found the docs outdated; heard no one was working on them. 

Which docs exactly you you mean... the ZendAPI docs?

Derick

---
 Did I help you?   http://www.jdimedia.nl/derick/link.php?url=giftlist
 Frequent ranting: http://www.jdimedia.nl/derick/
---
 PHP: Scripting the Web - [EMAIL PROTECTED]
All your branches are belong to me!
SRM: Script Running Machine - www.vl-srm.net
---


-- 
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 / NEWS /ext/standard array.c

2002-06-10 Thread Edin Kadribasic

 Andrei Zmievski wrote:
  Log:
  Fix bug #7045: shuffle() now provides consistent distribution of values
  in the array.

 C:\home\php\php4\ext\standard\array.c(1446) : error C2082: Neudefinition
 des for
 malen Parameters tsrm_ls
 C:\home\php\php4\ext\standard\array.c(2949) : error C2065:
 'array_data_shuffle'
 : nichtdeklarierter Bezeichner
 C:\home\php\php4\ext\standard\array.c(2949) : warning C4047: 'function' :
 Anzahl
  der Dereferenzierungen bei 'int (__cdecl *)(const void *,const void
 *,void ***
  )' und 'int ' unterschiedlich
 C:\home\php\php4\ext\standard\array.c(2949) : warning C4024:
 'zend_hash_sort' :
 Unterschiedliche Typen fuer formalen und uebergebenen Parameter 3

In English:

c:\php4build\snap\ext\standard\array.c(1446) : error C2082: redefinition of
formal parameter 'tsrm_ls'
c:\php4build\snap\ext\standard\array.c(2949) : error C2065:
'array_data_shuffle' : undeclared identifier
c:\php4build\snap\ext\standard\array.c(2949) : warning C4047: 'function' :
'int (__cdecl *)(const void *,const void *,void ***  )' differs in levels of
indirection from 'int '
c:\php4build\snap\ext\standard\array.c(2949) : warning C4024:
'zend_hash_sort' : different types for formal and actual parameter 3

Edin


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




[PHP-DEV] ActivePHP behavior

2002-06-10 Thread moshe doron


Hi All
since Wez on vacation(?) i'm asking u all hopefully someone already sniffed
around ActivePHP.

i'm searching for the equivalent code for that JavaScript:

pre
// this code print link that click on it call js function
function kkk(){
//Do some code
}
document.write(a href='Javascript:kkk();');

/pre



that code doesn't work:

pre
// this code print link that click on it do nothing
function kkk(){
//Do some code
}
/pre
$document-write(a href='ActivePHP:kkk();');



moshe doron[EMAIL PROTECTED]







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




Re: [PHP-DEV] RE: PHP profiling results under 2.0.37 Re: Performance of Apache 2.0 Filter

2002-06-10 Thread Aaron Bannert

On Mon, Jun 10, 2002 at 11:46:46AM +0300, Zeev Suraski wrote:
 What we need for efficient thread-safe operation is a mechanism like the 
 Win32 heaps - mutexless heaps, that provide malloc and free services on a 
 (preferably) contiguous pre-allocated block of memory.  The question is 
 whether the APR allocators fall into that category:
 
 1.  Can you make them mutexless completely?  I.e., will they never call 
 malloc()?

APR's pools only use malloc() as a portable way to retrieve large
chunks of heapspace that are never returned. I don't know of any
other portable way to do this.

In any case, at some level you will always have a mutex. Either you
are mapping new segments in to the memory space of the process, or
you are dealing with freelists in userspace. APR pools take the
approach that by doing more up-front segment mapping and delayed
freeing of chunks, we avoid many of the mutexes and overhead of
freelist management. It's still got to happen somewhere though.

 2.  They definitely do provide alloc/free services, we're ok there

Pretty much, but it's not exactly the same. I'll outline some thoughts
on a potential memory allocation abstraction that could be implemented
w/ apr_pools or Win32 heaps below...

 3.  As far as I can tell, they don't use a contiguous block of memory, 
 which means more fragmentation...

I'm not sure how contiguity relates to fragmentation. With a pool
you can do mallocs all day long, slowly accumulating more 8K blocks
(which may or may not be contiguous). At the end of the pool lifetime
(let's say, for example, at the end of a request) then those blocks
are placed on a freelist, and the sub-partitions within those blocks
are simply forgotten. On the next request, the process starts over again.


I think to properly abstract a memory allocation scheme that can be
implemented in a way that is optimized for the particular SAPI module,
we'll have to abstract out a few concepts. This list is not exhaustive,
but is just a quick sketch based on my understanding of Win32 heaps
and APR pools:

   - creation (called once per server lifetime)
   - malloc (called many times per request)
   - free (called many times per request)
   - end-of-request (called many times per request)
   - destruction (called once per serve lifetime)

Does this cover all our bases? For example, when using pools, the
free() call would do nothing, and the end-of-request call would simply
call apr_pool_clear(). Note that this only applies to dynamically
allocated memory required for the lifetime of a request. For memory
with longer lifetimes we could make the creation and destruction
routines more generic.

-aaron

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




Re: [PHP-DEV] RE: PHP profiling results under 2.0.37 Re: Performance of Apache 2.0 Filter

2002-06-10 Thread Aaron Bannert

On Mon, Jun 10, 2002 at 09:29:58AM -0700, Aaron Bannert wrote:
- creation (called once per server lifetime)
- malloc (called many times per request)
- free (called many times per request)
- end-of-request (called many times per request)

(Whoops, that should have been -- called once at the end of the request)

- destruction (called once per serve lifetime)

-a

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




Re: [PHP-DEV] RE: PHP profiling results under 2.0.37 Re: Performance of Apache 2.0 Filter

2002-06-10 Thread Zeev Suraski

At 07:29 PM 6/10/2002, Aaron Bannert wrote:
On Mon, Jun 10, 2002 at 11:46:46AM +0300, Zeev Suraski wrote:
  What we need for efficient thread-safe operation is a mechanism like the
  Win32 heaps - mutexless heaps, that provide malloc and free services on a
  (preferably) contiguous pre-allocated block of memory.  The question is
  whether the APR allocators fall into that category:
 
  1.  Can you make them mutexless completely?  I.e., will they never call
  malloc()?

APR's pools only use malloc() as a portable way to retrieve large
chunks of heapspace that are never returned. I don't know of any
other portable way to do this.

There probably isn't.  Win32 heaps take advantage of the virtual memory 
functions (they pre-allocate the max heap size, but commit as necessary), 
and there's probably no portable way of doing that.

In any case, at some level you will always have a mutex. Either you
are mapping new segments in to the memory space of the process, or
you are dealing with freelists in userspace.

I'm not sure if VirtualAlloc(..., MEM_COMMIT) results in a mutex, it will 
probably just not context-switch until it's over.  But you may be right.

  3.  As far as I can tell, they don't use a contiguous block of memory,
  which means more fragmentation...

I'm not sure how contiguity relates to fragmentation. With a pool
you can do mallocs all day long, slowly accumulating more 8K blocks
(which may or may not be contiguous). At the end of the pool lifetime
(let's say, for example, at the end of a request) then those blocks
are placed on a freelist, and the sub-partitions within those blocks
are simply forgotten. On the next request, the process starts over again.

The fragmentation-related advantage of using a contiguous block is that PHP 
always ends up freeing ALL of the data in the heap in the end of every 
request.  So, you get to start with the same completely-free, contiguous 
block on every request.  However, if you don't have a contiguous block, and 
you use malloc() calls to satisfy certain allocation requests, any 
persistent malloc() which occurs during the request may end up being in the 
same area as your per-request allocations.  Then, even once you free all of 
the per-request blocks, you may no longer be able to allocate large chunks 
- because some persistent malloc()'s may be stuck in the middle.  Am I 
missing something here?

I think to properly abstract a memory allocation scheme that can be
implemented in a way that is optimized for the particular SAPI module,
we'll have to abstract out a few concepts. This list is not exhaustive,
but is just a quick sketch based on my understanding of Win32 heaps
and APR pools:

- creation (called once per server lifetime)
- malloc (called many times per request)
- free (called many times per request)
- end-of-request (called many times per request)

(happens once per request)

- destruction (called once per serve lifetime)

Does this cover all our bases?

There are also some persistent malloc's that happen during a request, and 
do not get freed at the end of the request.  But generally yes.


  For example, when using pools, the
free() call would do nothing, and the end-of-request call would simply
call apr_pool_clear(). Note that this only applies to dynamically
allocated memory required for the lifetime of a request. For memory
with longer lifetimes we could make the creation and destruction
routines more generic.

I know, but that's really not an option :)  This is how PHP/FI 2 used to 
work, and it had horrible memory performance.  We allocate and free *a lot* 
during a request.  We've worked very hard on freeing data as soon as we 
possibly can, so using the pool approach of cleaning everything at the 
end  of a request will reduce our memory performance radically.  What we 
currently have is a memory allocator that is quite suitable for the job - 
it supports malloc and free and it caches small blocks for reuse.  Still, 
under Windows, moving to a heap made a big difference - it eliminated the 
mutex overhead and reduced fragmentation.  The solution under UNIX may very 
well be increasing the block cache to work with larger blocks as well, and 
a larger number of blocks of each size - but this will definitely increase 
fragmentation big time :(

Zeev


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




Re: [PHP-DEV] ActivePHP behavior

2002-06-10 Thread [EMAIL PROTECTED]


I don't think this is the proper forum for this question.
This list is for those interested in the development
of PHP itself, not simply PHP development.

That said, I think that's an html problem: you may have forgotten to
close off your a anchor tag with /a.  You should
also provide some text inside the tags for browsers to show
anything at all.  Also, your ActivePHP code should still read:
  $document-write(a href='Javascript:kkk();'); 
 if you want to call a javascript function.


  

6/11/02 12:19:46 AM, moshe doron [EMAIL PROTECTED] wrote:


Hi All
since Wez on vacation(?) i'm asking u all hopefully someone already sniffed
around ActivePHP.

i'm searching for the equivalent code for that JavaScript:

pre
// this code print link that click on it call js function
function kkk(){
//Do some code
}
document.write(a href='Javascript:kkk();');

/pre



that code doesn't work:

pre
// this code print link that click on it do nothing
function kkk(){
//Do some code
}
/pre
$document-write(a href='ActivePHP:kkk();');



moshe doron[EMAIL PROTECTED]







-- 
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] why does exec() use the shell?

2002-06-10 Thread Lawrence Greenfield

Hi,

Looking through the PHP documentation, I see that exec() invokes the
shell.  Why is this?  There's already a function that invokes the
shell (with all associated costs and security holes).  Why does PHP
need two?

Is there any way of invoking programs without involving the shell?

Larry


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




Re: [PHP-DEV] PECL != Siberia

2002-06-10 Thread Stig S. Bakken

You tell me :)  We currently have no nice way of bootstrapping PEAR on
Windows like we have on Unix (with make install-pear-installer and
go-pear).  What would be the most sensible way of giving Windows users
something ala go-pear?

 - Stig

On Sun, 2002-06-09 at 18:49, Shane Caraveo wrote:
 Hmm, what is happening for win32?
 
 Stig S. Bakken wrote:
   With the latest PEAR installer (version 0.90), PECL extensions are now
   built and installed during pear install/upgrade on Unix systems.
  
   First: upgrade PEAR to 0.9 with pear upgrade PEAR.
  
   If you have the xmms libraries and php_gtk installed, you can see it in
   action by doing simply pear install xmms.  The output is like this:
  
 
 
 



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




Re: [PHP-DEV] PECL != Siberia

2002-06-10 Thread Shane Caraveo

It's a tough one :)
Well, being able to build like on unix shouldn't be too hard to do, just 
have to call nmake on the dsp, but that wont work for the vast majority 
of users.  Someone needs to provide  prebuilt extensions that can be 
downloaded via pear, and unfortunately, I don't see any way other than 
having a build per version of PHP.  So the built extensions would have 
to have a filename like: extname-phpversion-extversion.zip.  Another 
idea would be to have the extensions built for windows on the server 
side, and cached if one was already built.

Shane

Stig S. Bakken wrote:
 You tell me :)  We currently have no nice way of bootstrapping PEAR on
 Windows like we have on Unix (with make install-pear-installer and
 go-pear).  What would be the most sensible way of giving Windows users
 something ala go-pear?
 
  - Stig
 
 On Sun, 2002-06-09 at 18:49, Shane Caraveo wrote:
 
Hmm, what is happening for win32?

Stig S. Bakken wrote:
  With the latest PEAR installer (version 0.90), PECL extensions are now
  built and installed during pear install/upgrade on Unix systems.
 
  First: upgrade PEAR to 0.9 with pear upgrade PEAR.
 
  If you have the xmms libraries and php_gtk installed, you can see it in
  action by doing simply pear install xmms.  The output is like this:
 



 
 
 




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




Re: [PHP-DEV] Re: [Zend Engine 2] RE: [PHP-DEV] oo != php

2002-06-10 Thread Stig S. Bakken

Hi,

I have promised myself to not get into this discussion for a week now,
but the smell of dead horse overwhelmed me, so here goes...

I am guilty of a lot of OO use in PHP related to PEAR, I think OO is a
good thing when used right, but if not.. well, as Ken said at LinuxTag,
here, have some rope.  I welcome ZE2's improvements, many of which
came to be for PEAR and similar systems, and I'm even part guilty in
some of the ZE2 design.

Anyway.  In Java, you use objects on a very deep level, even strings are
objects.  This makes perfect sense, because in Java creating objects is
very cheap compared to PHP.  In PHP objects are expensive, so they
should be used on a much higher level.  I have seen PHP frameworks
(well, _a_ PHP framework) with a String class, and that tells me that
someone has a hammer and is trying to knock in screws with it.

But I should not generalize.

There are some OO features that only make sense in combination with
others.  I'll list them one by one, and even offer some alternatives:

1. Interfaces / multiple inheritance

IMHO, interfaces make little sense in a language with loose typing,
without late bindings and where code is by default compiled on every
execution.

The loosely typed nature of PHP does IMHO not fit well into the
explicit paradigm that interfaces represent, because they introduce
conditions that have to be met during compilation for a class to be
valid.

Also, the definition of an interface is abstract, so you would be
loading the abstract definition on every single request when PHP is used
in its natural habitat.

The solution to this problem that was accepted a few months ago is
aggregates.  They allow what is not too unlike runtime multiple
inheritance, but we also decided on a way to declare aggregates during
definition:

class foo aggregates bar {
}

The main difference between extends and aggregate here is that the
aggregation, created at runtime, may be removed.  You may also add
additional aggregates later, as well as multiple in the class
definition.  Please check the archives (there is one, right? :-) for
further details.

This does not match interfaces feature-wise because aggregates
implemented like this do not offer the explicitness.  But that is a much
larger language design issue.  Having a language that may both be loose
and explicit is a Bad Idea IM(NS)HO.  Take a look at Perl, and see how
much fun you get when using strict CPAN packages (which is most) in
scripts where you don't want to bother.  You end up writing only strict
code, which in practice will require the option.  Doh.

2. Optional strong typing

When people say that being able to do

function Bar(MyClass $foo) { ... }

will not affect performance, is this based on pure wishful thinking or
real insight in the engine?  I can't see how this would not have a
performance impact.  I think type hints are a good idea, as long as they
are implemented with low impact.

3. Case sensitivity

This horse is already decomposing.  When you can get the originally
cased name of a symbol from the engine, there are no technical reasons
for introducing case sensitivity to PHP, only aesthetic and
scratchmyitchic.  But alas, we try keeping to technical reasons.

Poor horsie.

 - Stig

On Sat, 2002-06-08 at 03:40, Dan Hardiker wrote:
  There are two reasons we repeat the 'PHP is not Java mantra':
 
  (a) Many of those requesting these changes actually DO want to see PHP
  as a  Java with PHPish syntax.
 
 Anyone wanting PHP to be a simple or more flexable Java is barking up
 the wrong tree... in fact all of the people I know who Im lobbying better
 OO functionality in PHP for know Java and know PHP - and use both where
 each is best. What we are requesting is that PHP expands its OO
 capabilities - not change the way it does things, not do anything
 outlandish or stolen from another language. Think about it - all it
 would be is like adding an extra gear to a car. Wouldnt change the
 concept, the design or the idea of the car... not the make nor model... it
 would however give it added depth and use.
 
 eg: simple db-based shopping cart web site? use PHP... complex internet
 backing system? use Java. Easy!
  (b) Java is (so far) the best implemented OO language out there that's
  actually being used.  It symbolizes the extreme OO world, if you will.
 
 Agreed - but that doesnt mean that the people on this list are assosiating
 more OO in PHP as being one step closer to PHP being PHP-Java. If I wanted
 Java's OO implementation in PHP, Id use Java. I dont - I want OO
 implementation (not even to the extremeness of Java) put in PHP. Im not
 even sure where the issue lies of taking the step - other than where is
 this heading in the long run.
 
 Is this all that much of an issue to implement MI, Pub/Pri/Prot
 methods/vars, possibly interfaces? Not to be Java, but to extend PHP...
 all those would help PHP as a *web based language* (hell it would help any
 language IMHO - given that its optional and not 

[PHP-DEV] Memory Leaks /w nested classes

2002-06-10 Thread Andre Christ

Hi,

working with php's oop implementation I got some memory leaks. The behaviour
can be reproduced
with the following script:

?php
class CBar {
  var $Parent;
}

class CSuper {
  function CSuper() {
$this-Bar = new CBar();
$this-Bar-Parent = $this;
  }
}

$Super = new CSuper();
?

php 4.2.1 --enable-debug

zend_hash.c(260) :  Freeing 0x0821000C (39 bytes),
script=/home/ach/usr/htdocs/devel/oop.php
Last leak repeated 1 time
./zend_execute.c(470) :  Freeing 0x0820FFAC (44 bytes),
script=/home/ach/usr/htdocs/devel/oop.php
zend_variables.c(126) : Actual location (location was relayed)
./zend_execute.c(467) :  Freeing 0x0820FF6C (12 bytes),
script=/home/ach/usr/htdocs/devel/oop.php
zend_API.c(596) :  Freeing 0x0820FE54 (44 bytes),
script=/home/ach/usr/htdocs/devel/oop.php
zend_API.c(584) : Actual location (location was relayed)
zend_hash.c(176) :  Freeing 0x0820FB34 (32 bytes),
script=/home/ach/usr/htdocs/devel/oop.php
Last leak repeated 1 time
./zend_execute.c(1948) :  Freeing 0x0820F844 (12 bytes),
script=/home/ach/usr/htdocs/devel/oop.php


Is there anything wrong with the code or is it a bug in php / Zend ?

Greets,
André




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




[PHP-DEV] Memory Leaks /w nested classes

2002-06-10 Thread Andre Christ

Hi,

working with php's oop implementation I got some memory leaks. The behaviour
can be reproduced
with the following script:

?php
class CBar {
  var $Parent;
}

class CSuper {
  function CSuper() {
$this-Bar = new CBar();
$this-Bar-Parent = $this;
  }
}

$Super = new CSuper();
?

php 4.2.1 --enable-debug

zend_hash.c(260) :  Freeing 0x0821000C (39 bytes),
script=/home/ach/usr/htdocs/devel/oop.php
Last leak repeated 1 time
./zend_execute.c(470) :  Freeing 0x0820FFAC (44 bytes),
script=/home/ach/usr/htdocs/devel/oop.php
zend_variables.c(126) : Actual location (location was relayed)
./zend_execute.c(467) :  Freeing 0x0820FF6C (12 bytes),
script=/home/ach/usr/htdocs/devel/oop.php
zend_API.c(596) :  Freeing 0x0820FE54 (44 bytes),
script=/home/ach/usr/htdocs/devel/oop.php
zend_API.c(584) : Actual location (location was relayed)
zend_hash.c(176) :  Freeing 0x0820FB34 (32 bytes),
script=/home/ach/usr/htdocs/devel/oop.php
Last leak repeated 1 time
./zend_execute.c(1948) :  Freeing 0x0820F844 (12 bytes),
script=/home/ach/usr/htdocs/devel/oop.php


Is there anything wrong with the code or is it a bug in php / Zend ?

Greets,
André




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




[PHP-DEV] Zend 2 const class members private?

2002-06-10 Thread Leendert Brouwer

I have just started experimenting with the Zend 2 engine, and totally love
the new OO features. I'm not sure whether this has been discussed or not (I
couldn't find it in the archives, anyway), but I ran into a few things:
Constant class members seem to be private by default. I cannot access them
by doing
$instance-CONSTNAME
Is this expected behaviour? I'd expect constants to be public by default,
just like regular variables, unless specified otherwise (when I try doing:
private const FOO = bar; I get a parse error). Same for private static.
Is this all going to change? It seems a bit illogical now.
Thanks

Leendert



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




[PHP-DEV] Re: [Zend Engine 2] Re: [PHP-DEV] Re: [Zend Engine 2] RE:[PHP-DEV] oo != php

2002-06-10 Thread Alex Black

 Hi,
 
 I have promised myself to not get into this discussion for a week now,
 but the smell of dead horse overwhelmed me, so here goes...

heh.

 class foo aggregates bar {
 }

I think that is a nice solution.

 2. Optional strong typing
 
 When people say that being able to do
 
   function Bar(MyClass $foo) { ... }
 
 will not affect performance, is this based on pure wishful thinking or
 real insight in the engine?  I can't see how this would not have a
 performance impact.  I think type hints are a good idea, as long as they
 are implemented with low impact.

All of my arguments for this are qualified by that. If there is a
significant performance impact it should not be done. If there is not, it
should.

 3. Case sensitivity
 
 This horse is already decomposing.  When you can get the originally
 cased name of a symbol from the engine, there are no technical reasons
 for introducing case sensitivity to PHP, only aesthetic and
 scratchmyitchic.  But alas, we try keeping to technical reasons.

I gave this one up. In theory I would like it, in practice I don't actually
care that much :)

I would still like Private methods, and real MI.

Anyway all, I think the middle ground is what everyone really wants: more
features, but not blindly: we don't want to screw up BC, we don't want to
change the engine hugely... where there are advantages to be had, let's take
'em... if there's a good justification against let's accept that and move
on.

_a


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




RE: [PHP-DEV] REPOST: Class Autoloading [PATCH]

2002-06-10 Thread Andi Gutmans

I'd prefer not having a handler for autoloader. I'd prefer having the 
Engine look for ClassName.php in the default include_path and if it doesn't 
exist die... (i.e. not call any user-definable PHP function).

Andi

At 11:33 AM 6/10/2002 +0200, phpsurf wrote:
this patch would be really great !

I can remember it has been discussed a lot on the ZE2 mailing list about the
'import' feature.
some people (and I was) would have apreciated another name because this name
was already used in many PHP frameworks to implement a function that loads
classes.

As far as I followed this thread, the agreement was that the import keyword
can be used fine for namespaces if a autoload statement was patched to the
engine ... so everyone would be happy ! :)

I guess your patch gives some function like this one :
set_classautoload_handler(myAutoLoader);

and then, one can implement a function like this:
myAutoLoader($className) {
  if (!class_exists($className)) {
   include(class/.str_replace(_, /, $className)..php);
   }
}

I'm sure many programmers would apreciate such a feature.
Especially as it whould have no BC issue at all !

  -Original Message-
  From: Ivan Ristic [mailto:[EMAIL PROTECTED]]
  Sent: dimanche 9 juin 2002 22:46
  To: Zeev Suraski
  Cc: [EMAIL PROTECTED]
  Subject: Re: [PHP-DEV] REPOST: Class Autoloading [PATCH]
 
 
   I believe this has been discussed in the past and not ack'd,
  please read
   the php-dev archives...
 
I tried and I tried but I couldn't find a discussion on anything
similar on the mailing list.
 
The code I sent is *already* in use, and has been in
use for some time now. Take a look at this message from
November 2001:
 
http://marc.theaimsgroup.com/?l=php-devm=100687224711738w=2
 
I didn't introduce anything new, so if it was OK then it should be
OK now. Also, the code cannot affect the people that are not using
the feature so I do not think that there will be any kind of impact
on the existing user base.
 
This feature makes it possible to have one class per file and not
to worry about inclusion at all. It becomes especially useful when
used together with products such as Zend Accelerator, where files
are cached (and you do not have to worry about a large number of
small files).
 
  --
  Ivan Ristic, [EMAIL PROTECTED]
  [ Weblog on PHP, Software development, Intranets,
  and Knowledge Management: http://www.webkreator.com ]
 
 
  --
  PHP Development Mailing List http://www.php.net/
  To unsubscribe, visit: http://www.php.net/unsub.php
 


__
ifrance.com, l'email gratuit le plus complet de l'Internet !
vos emails depuis un navigateur, en POP3, sur Minitel, sur le WAP...
http://www.ifrance.com/_reloc/email.emailif



--
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] RE: [PHP-DEV] REPOST: Class Autoloading [PATCH]

2002-06-10 Thread Andi Gutmans

Or have a user-definable classpath. But I think it's better not to call 
into PHP code.

Andi

At 11:32 PM 6/10/2002 +0300, Andi Gutmans wrote:
I'd prefer not having a handler for autoloader. I'd prefer having the 
Engine look for ClassName.php in the default include_path and if it 
doesn't exist die... (i.e. not call any user-definable PHP function).

Andi

At 11:33 AM 6/10/2002 +0200, phpsurf wrote:
this patch would be really great !

I can remember it has been discussed a lot on the ZE2 mailing list about the
'import' feature.
some people (and I was) would have apreciated another name because this name
was already used in many PHP frameworks to implement a function that loads
classes.

As far as I followed this thread, the agreement was that the import keyword
can be used fine for namespaces if a autoload statement was patched to the
engine ... so everyone would be happy ! :)

I guess your patch gives some function like this one :
set_classautoload_handler(myAutoLoader);

and then, one can implement a function like this:
myAutoLoader($className) {
  if (!class_exists($className)) {
   include(class/.str_replace(_, /, $className)..php);
   }
}

I'm sure many programmers would apreciate such a feature.
Especially as it whould have no BC issue at all !

  -Original Message-
  From: Ivan Ristic [mailto:[EMAIL PROTECTED]]
  Sent: dimanche 9 juin 2002 22:46
  To: Zeev Suraski
  Cc: [EMAIL PROTECTED]
  Subject: Re: [PHP-DEV] REPOST: Class Autoloading [PATCH]
 
 
   I believe this has been discussed in the past and not ack'd,
  please read
   the php-dev archives...
 
I tried and I tried but I couldn't find a discussion on anything
similar on the mailing list.
 
The code I sent is *already* in use, and has been in
use for some time now. Take a look at this message from
November 2001:
 
http://marc.theaimsgroup.com/?l=php-devm=100687224711738w=2
 
I didn't introduce anything new, so if it was OK then it should be
OK now. Also, the code cannot affect the people that are not using
the feature so I do not think that there will be any kind of impact
on the existing user base.
 
This feature makes it possible to have one class per file and not
to worry about inclusion at all. It becomes especially useful when
used together with products such as Zend Accelerator, where files
are cached (and you do not have to worry about a large number of
small files).
 
  --
  Ivan Ristic, [EMAIL PROTECTED]
  [ Weblog on PHP, Software development, Intranets,
  and Knowledge Management: http://www.webkreator.com ]
 
 
  --
  PHP Development Mailing List http://www.php.net/
  To unsubscribe, visit: http://www.php.net/unsub.php
 


__
ifrance.com, l'email gratuit le plus complet de l'Internet !
vos emails depuis un navigateur, en POP3, sur Minitel, sur le WAP...
http://www.ifrance.com/_reloc/email.emailif



--
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] Memory Leaks /w nested classes

2002-06-10 Thread Markus Fischer

Hi,

that's a limitation of the Zend Engine. It does not support
circular references (at least this is would Zeev told me last
time :)

- Markus

On Mon, Jun 10, 2002 at 10:25:38PM +0200, Andre Christ wrote : 
 working with php's oop implementation I got some memory leaks. The behaviour
 can be reproduced
 with the following script:
 
 ?php
 class CBar {
   var $Parent;
 }
 
 class CSuper {
   function CSuper() {
 $this-Bar = new CBar();
 $this-Bar-Parent = $this;
   }
 }
 
 $Super = new CSuper();
 ?
 
 php 4.2.1 --enable-debug
 
 zend_hash.c(260) :  Freeing 0x0821000C (39 bytes),
 script=/home/ach/usr/htdocs/devel/oop.php
 Last leak repeated 1 time
 ./zend_execute.c(470) :  Freeing 0x0820FFAC (44 bytes),
 script=/home/ach/usr/htdocs/devel/oop.php
 zend_variables.c(126) : Actual location (location was relayed)
 ./zend_execute.c(467) :  Freeing 0x0820FF6C (12 bytes),
 script=/home/ach/usr/htdocs/devel/oop.php
 zend_API.c(596) :  Freeing 0x0820FE54 (44 bytes),
 script=/home/ach/usr/htdocs/devel/oop.php
 zend_API.c(584) : Actual location (location was relayed)
 zend_hash.c(176) :  Freeing 0x0820FB34 (32 bytes),
 script=/home/ach/usr/htdocs/devel/oop.php
 Last leak repeated 1 time
 ./zend_execute.c(1948) :  Freeing 0x0820F844 (12 bytes),
 script=/home/ach/usr/htdocs/devel/oop.php
 
 
 Is there anything wrong with the code or is it a bug in php / Zend ?

-- 
GnuPG Key: http://guru.josefine.at/~mfischer/C2272BD0.asc

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




[PHP-DEV] [PATCH] Remove input filter from apache2filter SAPI

2002-06-10 Thread Justin Erenkrantz

The input filter in the apache2filter doesn't serve any real purpose
as PHP is not transforming any of the data.

IMHO, it would be better if it switched to just grabbing the input
when it needs it via the sapi_read_post function.

Please let me know if you have any questions.  -- justin

Index: sapi/apache2filter/php_apache.h
===
RCS file: /repository/php4/sapi/apache2filter/php_apache.h,v
retrieving revision 1.14
diff -u -r1.14 php_apache.h
--- sapi/apache2filter/php_apache.h 18 Apr 2002 22:10:57 -  1.14
+++ sapi/apache2filter/php_apache.h 10 Jun 2002 20:56:57 -
 -34,12 +34,6 
int state;
request_rec *r;
ap_filter_t *f; /* downstream output filters after the PHP filter. */
-   /* Length of post_data buffer */
-   int post_len;
-   /* Index for reading from buffer */
-   int post_idx;
-   /* Buffer for request body filter */
-   char *post_data;
/* Whether or not we've processed PHP in the output filters yet. */
int request_processed;
 } php_struct;
Index: sapi/apache2filter/sapi_apache2.c
===
RCS file: /repository/php4/sapi/apache2filter/sapi_apache2.c,v
retrieving revision 1.77
diff -u -r1.77 sapi_apache2.c
--- sapi/apache2filter/sapi_apache2.c   8 Jun 2002 18:11:03 -   1.77
+++ sapi/apache2filter/sapi_apache2.c   10 Jun 2002 20:56:57 -
 -127,22 +127,32 
 static int
 php_apache_sapi_read_post(char *buf, uint count_bytes TSRMLS_DC)
 {
-   int n;
-   int to_read;
php_struct *ctx = SG(server_context);
+   request_rec *r = ctx-r;
+   apr_bucket_brigade *brigade;
+   apr_status_t rv;
+   apr_off_t length;
+
+   brigade = apr_brigade_create(r-pool, r-connection-bucket_alloc);
+
+   /* The contract here is that we can not read more than count_bytes. */
+   rv = ap_get_brigade(r-input_filters, brigade, AP_MODE_READBYTES,
+   APR_BLOCK_READ, count_bytes);
+   if (rv != APR_SUCCESS) {
+   return 0;
+   }
+
+   rv = apr_brigade_length(brigade, 1, length);
+   if (rv != APR_SUCCESS) {
+   return 0;
+   }
+
+   rv = apr_brigade_flatten(brigade, buf, length);
+   if (rv != APR_SUCCESS) {
+   return 0;
+   }
 
-   to_read = ctx-post_len - ctx-post_idx;
-   n = MIN(to_read, count_bytes);
-   
-   if (n  0) {
-   memcpy(buf, ctx-post_data + ctx-post_idx, n);
-   ctx-post_idx += n;
-   } else {
-   if (ctx-post_data) free(ctx-post_data);
-   ctx-post_data = NULL;
-   }
-
-   return n;
+   return length;
 }
 
 static char *
 -261,44 +271,6 
STANDARD_SAPI_MODULE_PROPERTIES
 };
 
-static int php_input_filter(ap_filter_t *f, apr_bucket_brigade *bb, 
-   ap_input_mode_t mode, apr_read_type_e block, apr_off_t readbytes)
-{
-   php_struct *ctx;
-   long old_index;
-   apr_bucket *b;
-   const char *str;
-   apr_size_t n;
-   apr_status_t rv;
-   TSRMLS_FETCH();
-
-   if (f-r-proxyreq) {
-   return ap_get_brigade(f-next, bb, mode, block, readbytes);
-   }
-
-   ctx = SG(server_context);
-   if (ctx == NULL) {
-   ap_log_rerror(APLOG_MARK, APLOG_ERR|APLOG_NOERRNO, 0, f-r,
-php failed to get server context);
-   return HTTP_INTERNAL_SERVER_ERROR;
-   }
-
-   if ((rv = ap_get_brigade(f-next, bb, mode, block, readbytes)) != APR_SUCCESS) 
{
-   return rv;
-   }
-
-   APR_BRIGADE_FOREACH(b, bb) {
-   apr_bucket_read(b, str, n, 1);
-   if (n  0) {
-   old_index = ctx-post_len;
-   ctx-post_len += n;
-   ctx-post_data = realloc(ctx-post_data, ctx-post_len + 1);
-   memcpy(ctx-post_data + old_index, str, n);
-   }
-   }
-   return APR_SUCCESS;
-}
-
 static void php_apache_request_ctor(ap_filter_t *f, php_struct *ctx TSRMLS_DC)
 {
char *content_type;
 -315,8 +287,6 
f-r-no_local_copy = 1;
content_type = sapi_get_default_content_type(TSRMLS_C);
f-r-content_type = apr_pstrdup(f-r-pool, content_type);
-   SG(request_info).post_data = ctx-post_data;
-   SG(request_info).post_data_length = ctx-post_len;
efree(content_type);
apr_table_unset(f-r-headers_out, Content-Length);
apr_table_unset(f-r-headers_out, Last-Modified);
 -549,7 +519,6 
ap_hook_insert_filter(php_insert_filter, NULL, NULL, APR_HOOK_MIDDLE);
ap_hook_post_read_request(php_post_read_request, NULL, NULL, APR_HOOK_MIDDLE);
ap_register_output_filter(PHP, php_output_filter, AP_FTYPE_RESOURCE);
-   ap_register_input_filter(PHP, php_input_filter, AP_FTYPE_RESOURCE);
 }
 
 

[PHP-DEV] Re: [Zend Engine 2] RE: [PHP-DEV] REPOST: Class Autoloading [PATCH]

2002-06-10 Thread brad lafountain

I dissagree with that... I would like the option to say where my classes are.
If i want multiple classes in one file then i can.

function myAutoLoader($className) {
 if (!class_exists($className)) {
   include(all_of_my_classes.php);
   }
}

Making a classpath and ClassName.php files will make php horibly look like
java. One of the reasons java does this is cause you can't have 2 public
classes in one file. We shouldn't force php developers to use one class per
file just to use the auto-loading feature.

- brad
--- Andi Gutmans [EMAIL PROTECTED] wrote:
 I'd prefer not having a handler for autoloader. I'd prefer having the 
 Engine look for ClassName.php in the default include_path and if it doesn't 
 exist die... (i.e. not call any user-definable PHP function).
 
 Andi
 
 At 11:33 AM 6/10/2002 +0200, phpsurf wrote:
 this patch would be really great !
 
 I can remember it has been discussed a lot on the ZE2 mailing list about the
 'import' feature.
 some people (and I was) would have apreciated another name because this name
 was already used in many PHP frameworks to implement a function that loads
 classes.
 
 As far as I followed this thread, the agreement was that the import keyword
 can be used fine for namespaces if a autoload statement was patched to the
 engine ... so everyone would be happy ! :)
 
 I guess your patch gives some function like this one :
 set_classautoload_handler(myAutoLoader);
 
 and then, one can implement a function like this:
 myAutoLoader($className) {
   if (!class_exists($className)) {
include(class/.str_replace(_, /, $className)..php);
}
 }
 
 I'm sure many programmers would apreciate such a feature.
 Especially as it whould have no BC issue at all !
 
   -Original Message-
   From: Ivan Ristic [mailto:[EMAIL PROTECTED]]
   Sent: dimanche 9 juin 2002 22:46
   To: Zeev Suraski
   Cc: [EMAIL PROTECTED]
   Subject: Re: [PHP-DEV] REPOST: Class Autoloading [PATCH]
  
  
I believe this has been discussed in the past and not ack'd,
   please read
the php-dev archives...
  
 I tried and I tried but I couldn't find a discussion on anything
 similar on the mailing list.
  
 The code I sent is *already* in use, and has been in
 use for some time now. Take a look at this message from
 November 2001:
  
 http://marc.theaimsgroup.com/?l=php-devm=100687224711738w=2
  
 I didn't introduce anything new, so if it was OK then it should be
 OK now. Also, the code cannot affect the people that are not using
 the feature so I do not think that there will be any kind of impact
 on the existing user base.
  
 This feature makes it possible to have one class per file and not
 to worry about inclusion at all. It becomes especially useful when
 used together with products such as Zend Accelerator, where files
 are cached (and you do not have to worry about a large number of
 small files).
  
   --
   Ivan Ristic, [EMAIL PROTECTED]
   [ Weblog on PHP, Software development, Intranets,
   and Knowledge Management: http://www.webkreator.com ]
  
  
   --
   PHP Development Mailing List http://www.php.net/
   To unsubscribe, visit: http://www.php.net/unsub.php
  
 
 

__
 ifrance.com, l'email gratuit le plus complet de l'Internet !
 vos emails depuis un navigateur, en POP3, sur Minitel, sur le WAP...
 http://www.ifrance.com/_reloc/email.emailif
 
 
 
 --
 PHP Development Mailing List http://www.php.net/
 To unsubscribe, visit: http://www.php.net/unsub.php
 


__
Do You Yahoo!?
Yahoo! - Official partner of 2002 FIFA World Cup
http://fifaworldcup.yahoo.com

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




Re: [PHP-DEV] Memory Leaks /w nested classes

2002-06-10 Thread brad lafountain

I use parent members all the time.. w/zend1

 - Brad
--- Markus Fischer [EMAIL PROTECTED] wrote:
 Hi,
 
 that's a limitation of the Zend Engine. It does not support
 circular references (at least this is would Zeev told me last
 time :)
 
 - Markus
 
 On Mon, Jun 10, 2002 at 10:25:38PM +0200, Andre Christ wrote : 
  working with php's oop implementation I got some memory leaks. The
 behaviour
  can be reproduced
  with the following script:
  
  ?php
  class CBar {
var $Parent;
  }
  
  class CSuper {
function CSuper() {
  $this-Bar = new CBar();
  $this-Bar-Parent = $this;
}
  }
  
  $Super = new CSuper();
  ?
  
  php 4.2.1 --enable-debug
  
  zend_hash.c(260) :  Freeing 0x0821000C (39 bytes),
  script=/home/ach/usr/htdocs/devel/oop.php
  Last leak repeated 1 time
  ./zend_execute.c(470) :  Freeing 0x0820FFAC (44 bytes),
  script=/home/ach/usr/htdocs/devel/oop.php
  zend_variables.c(126) : Actual location (location was relayed)
  ./zend_execute.c(467) :  Freeing 0x0820FF6C (12 bytes),
  script=/home/ach/usr/htdocs/devel/oop.php
  zend_API.c(596) :  Freeing 0x0820FE54 (44 bytes),
  script=/home/ach/usr/htdocs/devel/oop.php
  zend_API.c(584) : Actual location (location was relayed)
  zend_hash.c(176) :  Freeing 0x0820FB34 (32 bytes),
  script=/home/ach/usr/htdocs/devel/oop.php
  Last leak repeated 1 time
  ./zend_execute.c(1948) :  Freeing 0x0820F844 (12 bytes),
  script=/home/ach/usr/htdocs/devel/oop.php
  
  
  Is there anything wrong with the code or is it a bug in php / Zend ?
 
 -- 
 GnuPG Key: http://guru.josefine.at/~mfischer/C2272BD0.asc
 
 -- 
 PHP Development Mailing List http://www.php.net/
 To unsubscribe, visit: http://www.php.net/unsub.php
 


__
Do You Yahoo!?
Yahoo! - Official partner of 2002 FIFA World Cup
http://fifaworldcup.yahoo.com

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




Re: [PHP-DEV] Memory Leaks /w nested classes

2002-06-10 Thread Andre Christ

Hi Brad,

Brad Lafountain [EMAIL PROTECTED] wrote
 I use parent members all the time.. w/zend1

well, that's what I wanted to do until I discovered these entrys in my log
file when php is compiled --enable-debug. Do you have these mem leaks as
well ?

Greets,
André




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




Re: [PHP-DEV] Memory Leaks /w nested classes

2002-06-10 Thread brad lafountain


--- Andre Christ [EMAIL PROTECTED] wrote:
 Hi Brad,
 
 Brad Lafountain [EMAIL PROTECTED] wrote
  I use parent members all the time.. w/zend1
 
 well, that's what I wanted to do until I discovered these entrys in my log
 file when php is compiled --enable-debug. Do you have these mem leaks as
 well ?

 Well acually the code is on a live server... i can't enable-debug.
 
 Greets,
 André
 
 
 
 
 -- 
 PHP Development Mailing List http://www.php.net/
 To unsubscribe, visit: http://www.php.net/unsub.php
 


__
Do You Yahoo!?
Yahoo! - Official partner of 2002 FIFA World Cup
http://fifaworldcup.yahoo.com

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




[PHP-DEV] Streamy PHP parser input?

2002-06-10 Thread Justin Erenkrantz

One of the major problems with the apache2filter is that it can not
work with any other resource output filter.  So, a configuration
like (I would like to use this configuration):

AddOutputFilterByType BUCKETEER text/html
AddType text/html .php
AddOutputFilter PHP .php

can not work because the bucketeer filter reads the data and does not
produce FILE buckets but rather POOL buckets - which is allowed under
the httpd-2.0 filter scheme.  My personal favorite would be to
combine PHP and mod_include so you could have a file containing
mod_include and PHP directives.

What would we have to do remove the file descriptor requirement for
the Zend Engine and PHP?  (All of us on the httpd-2.0 side of things
would like to see this happen.)  AIUI, all input to the Zend Engine
must be file-based (there is no API in PHP to pass char*s either).
httpd-2.0 can feed the parser char*'s and then indicate when the
stream is over.  Then, the output can be generated by the PHP engine.  

Thanks in advance.  -- justin

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




Re: [PHP-DEV] Memory Leaks /w nested classes

2002-06-10 Thread Zeev Suraski

If they end up in a circular reference (in this particular case they do, 
they usually don't) then you're leaking memory.

Zeev

At 12:10 AM 6/11/2002, brad lafountain wrote:
I use parent members all the time.. w/zend1

  - Brad
--- Markus Fischer [EMAIL PROTECTED] wrote:
  Hi,
 
  that's a limitation of the Zend Engine. It does not support
  circular references (at least this is would Zeev told me last
  time :)
 
  - Markus
 
  On Mon, Jun 10, 2002 at 10:25:38PM +0200, Andre Christ wrote :
   working with php's oop implementation I got some memory leaks. The
  behaviour
   can be reproduced
   with the following script:
  
   ?php
   class CBar {
 var $Parent;
   }
  
   class CSuper {
 function CSuper() {
   $this-Bar = new CBar();
   $this-Bar-Parent = $this;
 }
   }
  
   $Super = new CSuper();
   ?
  
   php 4.2.1 --enable-debug
  
   zend_hash.c(260) :  Freeing 0x0821000C (39 bytes),
   script=/home/ach/usr/htdocs/devel/oop.php
   Last leak repeated 1 time
   ./zend_execute.c(470) :  Freeing 0x0820FFAC (44 bytes),
   script=/home/ach/usr/htdocs/devel/oop.php
   zend_variables.c(126) : Actual location (location was relayed)
   ./zend_execute.c(467) :  Freeing 0x0820FF6C (12 bytes),
   script=/home/ach/usr/htdocs/devel/oop.php
   zend_API.c(596) :  Freeing 0x0820FE54 (44 bytes),
   script=/home/ach/usr/htdocs/devel/oop.php
   zend_API.c(584) : Actual location (location was relayed)
   zend_hash.c(176) :  Freeing 0x0820FB34 (32 bytes),
   script=/home/ach/usr/htdocs/devel/oop.php
   Last leak repeated 1 time
   ./zend_execute.c(1948) :  Freeing 0x0820F844 (12 bytes),
   script=/home/ach/usr/htdocs/devel/oop.php
  
  
   Is there anything wrong with the code or is it a bug in php / Zend ?
 
  --
  GnuPG Key: http://guru.josefine.at/~mfischer/C2272BD0.asc
 
  --
  PHP Development Mailing List http://www.php.net/
  To unsubscribe, visit: http://www.php.net/unsub.php
 


__
Do You Yahoo!?
Yahoo! - Official partner of 2002 FIFA World Cup
http://fifaworldcup.yahoo.com

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


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




Re: [PHP-DEV] Streamy PHP parser input?

2002-06-10 Thread Zeev Suraski

There should be a way of doing that within the framework of flex by 
redefining YY_INPUT and hacking around flex.

You can, by the way, provide a char * string, that already works today 
(look at zend_eval_string() or zend_prepare_string_for_scanning()).

Zeev

At 12:23 AM 6/11/2002, Justin Erenkrantz wrote:
One of the major problems with the apache2filter is that it can not
work with any other resource output filter.  So, a configuration
like (I would like to use this configuration):

AddOutputFilterByType BUCKETEER text/html
AddType text/html .php
AddOutputFilter PHP .php

can not work because the bucketeer filter reads the data and does not
produce FILE buckets but rather POOL buckets - which is allowed under
the httpd-2.0 filter scheme.  My personal favorite would be to
combine PHP and mod_include so you could have a file containing
mod_include and PHP directives.

What would we have to do remove the file descriptor requirement for
the Zend Engine and PHP?  (All of us on the httpd-2.0 side of things
would like to see this happen.)  AIUI, all input to the Zend Engine
must be file-based (there is no API in PHP to pass char*s either).
httpd-2.0 can feed the parser char*'s and then indicate when the
stream is over.  Then, the output can be generated by the PHP engine.

Thanks in advance.  -- justin

--
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] sybase_fetch_row() and data types

2002-06-10 Thread Timm Friebe

Hello,
after having talked to Derick Rethans at LinuxTag and him suggesting I
put up a mail on php-dev about it, I guess I will give it a try.

The following is my issue:
http://bugs.php.net/bug.php?id=16960

Derick told me all of PHPs database extensions simpy return strings for
everything except NULLs and that changing this behaviour will brake code
existing out there. As I do not believe it will, this is why I felt it
might be worth discussing it.

As people rely on the fact (do they?) that what comes out of
sybase_fetch_row() is an array of strings, they will probably do
something like this to check on NULLs:

if (!$data['field_to_test_on_null_values']) { do_something(); }
This will, of course, not be broken. !(null) = !(false) = true

Whatever you do with fields containing numbers (int, float) will not be
affected by my patch either: $num= $data['count']+ 1; will be equivalent
whether $data['count'] is int(5) or string(1) 5, except PHP will no
longer need to automagically make string(1) 5 to int(5) before
performing the addition, right?

What I do right now:
--

  $result= sybase_query($sql, $this-handle);
  if (FALSE === $result) return FALSE;

  $i= -1;
  while (++$i  sybase_num_fields($result)) {
$field= sybase_fetch_field($result, $i);
$this-fields[$field-name]= $field-type;
  }

[...and later on, when fetching the results...]

   $row= sybase_fetch_array($query);
   if (FALSE === $row) return FALSE;
  
   foreach($row as $key= $val) {
 if ($val === FALSE) { $row[$key]= NULL; continue; }

 switch ($this-fields[$key]) {
   case 'bit':
   case 'int': 
 settype($row[$key], 'integer'); 
 break;

   case 'real':
 // very ugly [numeric(10) = int, numeric(10, 2) = double]
 if (floor($val) == $val) {
   settype($row[$key], 'integer');
 } else {
   settype($row[$key], 'double'); 
 }
 break;
 }
   }
--

...which of course is overhead. I'd like to get rid of it but of course
not break any code. My question is, is there anybody out there using
Sybase who can think of impacts from my patch(es)?

Greetings from Karlsruhe,
Timm


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




[PHP-DEV] CVS Account Request: busterb@mail.utexas.edu

2002-06-10 Thread Brent Cook

To work on pear without bothering Tomas V.V.Cox  for every little change ;)

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




[PHP-DEV] PHP and sed blowing up builds

2002-06-10 Thread J Smith


The current CVS is having trouble compiling on Solaris platforms (Solaris 
8/SPARC for me) and from what I can tell, the problem is thanks to Sun's 
sed.

While the Solaris shell itself can handle an insane number of command line 
argument characters, the default Solaris sed truncates it's input down to 
4,000 characters. This causes problems when it comes time to link 
everything together during the final stages of the make, as the command 
libtool receives can become quite long:

/bin/ksh libtool --silent --mode=link gcc -export-dynamic -DPHP_ATOM_INC 
-I/setup/php/php4/include -I/setup/php/php4/main -I/setup/php/php4 
-I/setup/php/php4/Zend -I/setup/php/php4/ext/xml/expat  
-D_POSIX_PTHREAD_SEMANTICS -I/setup/php/php4/TSRM -g -O2  -L/usr/ucblib  -R 
/usr/ucblib ext/ctype/ctype.lo ext/mbstring/mbfilter_ja.lo 
ext/mbstring/mbfilter_cn.lo ext/mbstring/mbfilter_tw.lo 
ext/mbstring/mbfilter_kr.lo ext/mbstring/mbfilter_ru.lo 
ext/mbstring/mbfilter.lo ext/mbstring/mbstring.lo... (more, more, more) 
main/internal_functions.lo -lcrypt -lresolv -lresolv -lresolv -lm -ldl 
-lsocket -lsocket -lcrypt -ldl -o php
Output line too long.
Output line too long.
Output line too long.
gcc: ext/stan: No such file or directory
make: *** [php] Error 1
#

Sun's sed can't handle the input, but GNU sed can. After installing GNU sed 
and messing around with $PATH so GNU sed would be found before Sun's sed, 
the build works as expected. The above error was produced doing a plain, 
argument-less configure on Solaris 8 (SPARC) using autoconf 2.53 and a CVS 
checkout from Friday. It can also be reproduced if you configure with 
enough extensions -- anything that'll get the linking line above longer 
than 4000 characters.

The problem may exist on other platforms, such as IRIX, where sed apparently 
has an input limit of just over 8,000 characters or so.

Determining the best sed to use is a pain in the arse, as they're all a 
little different, but I'm thinking GNU sed should be a requirement on UNIX 
systems, since you're going to have to be using gcc anyways. There were 
apparently plans to put a macro in autoconf that would determine the best 
sed to use (prefering GNU sed above the others), but it appears it was 
dropped because of the distinct differences in seds from platform to 
platform. The macro is here:

http://mail.gnu.org/pipermail/autoconf-patches/2002-January/008138.html

Would it be overly difficult to perform this check during configure and use 
GNU sed over any system seds? (I have only a passing familiarity with the 
PHP build system, having mucked around in config.m4 a bit, but never really 
doing much with it beyond that.)

J

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




[PHP-DEV] Alpha compile error on OSX

2002-06-10 Thread Mitch Vincent

I just downloaded the alpha 4.3 from the website and get this :

./configure --with-pgsql --without-mysql --with-pdflib --with-mcrypt
--with-zlib --with-gd=/sw --enable-bcmath;make

snipped to the end

/bin/sh libtool --silent --mode=link gcc -export-dynamic -DPHP_ATOM_INC
-I/Users/mitch/php-4.3/include -I/Users/mitch/php-4.3/main
-I/Users/mitch/php-4.3 -I/Users/mitch/php-4.3/Zend -I/sw/include
-I/usr/local/include -I/usr/local/pgsql/include
-I/Users/mitch/php-4.3/ext/xml/expat  -no-cpp-precomp
-I/Users/mitch/php-4.3/TSRM -g -O2  -L/sw/lib -L/usr/local/lib
-L/usr/local/pgsql/lib  -R /sw/lib -R /usr/local/lib -R /usr/local/pgsql/lib
ext/zlib/zlib.lo ext/zlib/zlib_fopen_wrapper.lo ext/bcmath/bcmath.lo
ext/bcmath/number.lo ext/bcmath/libbcmath/src/add.lo
ext/bcmath/libbcmath/src/div.lo ext/bcmath/libbcmath/src/init.lo
ext/bcmath/libbcmath/src/neg.lo ext/bcmath/libbcmath/src/outofmem.lo
ext/bcmath/libbcmath/src/raisemod.lo ext/bcmath/libbcmath/src/rt.lo
ext/bcmath/libbcmath/src/sub.lo ext/bcmath/libbcmath/src/compare.lo
ext/bcmath/libbcmath/src/divmod.lo ext/bcmath/libbcmath/src/int2num.lo
ext/bcmath/libbcmath/src/num2long.lo ext/bcmath/libbcmath/src/output.lo
ext/bcmath/libbcmath/src/recmul.lo ext/bcmath/libbcmath/src/sqrt.lo
ext/bcmath/libbcmath/src/zero.lo ext/bcmath/libbcmath/src/debug.lo
ext/bcmath/libbcmath/src/doaddsub.lo ext/bcmath/libbcmath/src/nearzero.lo
ext/bcmath/libbcmath/src/num2str.lo ext/bcmath/libbcmath/src/raise.lo
ext/bcmath/libbcmath/src/rmzero.lo ext/bcmath/libbcmath/src/str2num.lo
ext/ctype/ctype.lo ext/gd/gd.lo ext/gd/gdcache.lo ext/gd/gdttf.lo
ext/gd/gdt1.lo ext/mbstring/mbfilter_ja.lo ext/mbstring/mbfilter_cn.lo
ext/mbstring/mbfilter_tw.lo ext/mbstring/mbfilter_kr.lo
ext/mbstring/mbfilter_ru.lo ext/mbstring/mbfilter.lo
ext/mbstring/mbstring.lo ext/mbstring/mbregex.lo ext/mbstring/php_mbregex.lo
ext/mcrypt/mcrypt.lo ext/overload/overload.lo ext/pcre/pcrelib/maketables.lo
ext/pcre/pcrelib/get.lo ext/pcre/pcrelib/study.lo ext/pcre/pcrelib/pcre.lo
ext/pcre/php_pcre.lo ext/pdf/pdf.lo ext/pgsql/pgsql.lo ext/posix/posix.lo
ext/session/session.lo ext/session/mod_files.lo ext/session/mod_mm.lo
ext/session/mod_user.lo ext/standard/array.lo ext/standard/base64.lo
ext/standard/basic_functions.lo ext/standard/browscap.lo
ext/standard/crc32.lo ext/standard/crypt.lo ext/standard/cyr_convert.lo
ext/standard/datetime.lo ext/standard/dir.lo ext/standard/dl.lo
ext/standard/dns.lo ext/standard/exec.lo ext/standard/file.lo
ext/standard/filestat.lo ext/standard/flock_compat.lo
ext/standard/formatted_print.lo ext/standard/fsock.lo ext/standard/head.lo
ext/standard/html.lo ext/standard/image.lo ext/standard/info.lo
ext/standard/iptc.lo ext/standard/lcg.lo ext/standard/link.lo
ext/standard/mail.lo ext/standard/math.lo ext/standard/md5.lo
ext/standard/metaphone.lo ext/standard/microtime.lo ext/standard/pack.lo
ext/standard/pageinfo.lo ext/standard/parsedate.lo
ext/standard/quot_print.lo ext/standard/rand.lo ext/standard/reg.lo
ext/standard/soundex.lo ext/standard/string.lo ext/standard/scanf.lo
ext/standard/syslog.lo ext/standard/type.lo ext/standard/uniqid.lo
ext/standard/url.lo ext/standard/url_scanner.lo ext/standard/var.lo
ext/standard/versioning.lo ext/standard/assert.lo ext/standard/strnatcmp.lo
ext/standard/levenshtein.lo ext/standard/incomplete_class.lo
ext/standard/url_scanner_ex.lo ext/standard/ftp_fopen_wrapper.lo
ext/standard/http_fopen_wrapper.lo ext/standard/php_fopen_wrapper.lo
ext/standard/credits.lo ext/standard/var_unserializer.lo
ext/standard/ftok.lo ext/standard/aggregation.lo ext/tokenizer/tokenizer.lo
ext/xml/xml.lo ext/xml/expat/xmlparse.lo ext/xml/expat/xmlrole.lo
ext/xml/expat/xmltok.lo regex/regcomp.lo regex/regexec.lo regex/regerror.lo
regex/regfree.lo TSRM/TSRM.lo TSRM/tsrm_strtok_r.lo TSRM/tsrm_virtual_cwd.lo
main/main.lo main/snprintf.lo main/spprintf.lo main/php_sprintf.lo
main/safe_mode.lo main/fopen_wrappers.lo main/alloca.lo main/php_ini.lo
main/SAPI.lo main/rfc1867.lo main/php_content_types.lo main/strlcpy.lo
main/strlcat.lo main/mergesort.lo main/reentrancy.lo main/php_variables.lo
main/php_ticks.lo main/streams.lo main/network.lo
main/php_open_temporary_file.lo main/php_logos.lo main/output.lo
main/memory_streams.lo main/user_streams.lo Zend/zend_language_parser.lo
Zend/zend_language_scanner.lo Zend/zend_ini_parser.lo
Zend/zend_ini_scanner.lo Zend/zend_alloc.lo Zend/zend_compile.lo
Zend/zend_constants.lo Zend/zend_dynamic_array.lo Zend/zend_execute_API.lo
Zend/zend_highlight.lo Zend/zend_llist.lo Zend/zend_opcode.lo
Zend/zend_operators.lo Zend/zend_ptr_stack.lo Zend/zend_stack.lo
Zend/zend_variables.lo Zend/zend.lo Zend/zend_API.lo Zend/zend_extensions.lo
Zend/zend_hash.lo Zend/zend_list.lo Zend/zend_indent.lo
Zend/zend_builtin_functions.lo Zend/zend_sprintf.lo Zend/zend_ini.lo
Zend/zend_qsort.lo Zend/zend_multibyte.lo Zend/zend_objects.lo
Zend/zend_object_handlers.lo Zend/zend_objects_API.lo Zend/zend_execute.lo
sapi/cgi/cgi_main.lo sapi/cgi/getopt.lo 

Re: [PHP-DEV] Streamy PHP parser input?

2002-06-10 Thread Aaron Bannert

On Tue, Jun 11, 2002 at 12:38:44AM +0300, Zeev Suraski wrote:
 There should be a way of doing that within the framework of flex by 
 redefining YY_INPUT and hacking around flex.

I'd love to see this built in to SAPI so that any module could take
advantage of it, and I'd even be willing to code it up. What is the
current feeling/policy on extending the SAPI?

-aaron

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




[PHP-DEV] Release Tea Leaves

2002-06-10 Thread Richard Lynch

Any Wild Guesses about release dates for PHP 5 and/or Zend Engine 2???

A publisher is worried that the book will be hopelessly obsolete 
before it hits the shelves, rather than the usual obsoleteness... :-^

Thanks in advance, and please cc me.

-- 
Like Music? http://l-i-e.com/artists.htm
My hard drive crashed on April 28th...  Re-send any critical email.

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




Re: [PHP-DEV] Alpha compile error on OSX

2002-06-10 Thread Dan Kalowsky

On Mon, 10 Jun 2002, Mitch Vincent wrote:

 I just downloaded the alpha 4.3 from the website and get this :

 ./configure --with-pgsql --without-mysql --with-pdflib --with-mcrypt
 --with-zlib --with-gd=/sw --enable-bcmath;make

 /usr/bin/ld: Undefined symbols:
 _zend_mh_bundle_error
 _zend_mh_bundle_load
 _zend_mh_bundle_symbol
 _zend_mh_bundle_unload
 make: *** [php] Error 1

Yep, thats an Alpha release.  I know I haven't (and I don't think Marko
has either) started playing with ZE2 and OSX.

---
Dan KalowskyThe record shows, I took the blows.
http://www.deadmime.org/~dankAnd did it my way.
[EMAIL PROTECTED] - My Way, Frank Sinatra
[EMAIL PROTECTED]


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




[PHP-DEV] Re: [PHP-QA] ZE2 / PHP 5 BC breaking suggestion

2002-06-10 Thread Melvyn Sopacua

At 23:00 10-6-2002, Sean shared with all of us:

Hmm, I see.
I suppose (?=\[)\w+(?=\]) as an exeption to accomodate those errors 
would be too hard on the parser?

Adding such an exception to the parser is definitely a no-no.

Also:

$a = array('cow' = 'moo', 'pig' = 'oink');
$b = pig;
echo $a[$b];

now echo oink
but with the change would then echo moo

I agree that it's messed up and just plain wrong, but it would break a lot 
of stuff.

Shees
So if someone in the include/require tree, would define('pig', 'cow') the 
pig would say moo and you'd be seeing a vet before you located it.

I see these warnings about 'undefined index foo, assuming foo' on E_ALL 
level if I'm correct. Could we not lower this debuglevel to say E_NOTICE? 
Then advertise the error and obsolete it in PHP 6? People have then had 
ample time to correct this.

At least could someone with enough karma on phpdoc review and apply the 
attached patch?

Met vriendelijke groeten / With kind regards,

IDG.nl
Melvyn Sopacua
Webmaster


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