Re: [PHP-DEV] HAVE_FLUSHIO

2002-02-17 Thread Alexander Feldman

At 11:28 PM 2/17/2002 +, Wez Furlong wrote:
>Can someone (Sascha?) refresh my memory about HAVE_FLUSHIO ?

"Sasha" != "Sascha" ;-)


>I'm wondering how it will affect the php_streams implementation.
>
>This is what I recall about it:
>
>On some systems it is necessary to fflush before reading/writing if
>you have been fseeking.
>
>Is this true/false/slightly incorrect?

AFAIR the ANSI standard says that for files opened in read/write mode fseek 
should be called (for flushing) whenever your process switches from reading 
to writing or vice versa. Linux' glibc is smart, of course, and a problem 
doesn't occur there. However more compliant platforms like Solaris and BSD 
have trouble if you call read, write, read for example.



>Should I keep a flag to track if we have just been seeking for
>stdio based streams and move the HAVE_FLUSHIO logic into the
>stdio stream implementation?

If you use buffered I/O functions and open files in rw modes - yes (??? do 
you need this for the streams implementation - should read the document 
once more). However I would strongly recommend the PHP I/O system to 
organize file buffering internally (something the current implementation 
does partially and in quite fancy way) and to use unbuffered system I/O.

If I am not clear enough - drop me a note and I will try to dig out the C 
and PHP examples that reproduced the problem...

Rgds:

-- Alex


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


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




Re: [PHP-DEV] PHP Tag Libraries

2002-02-16 Thread Alexander Feldman

> On Sat, Feb 16, 2002 at 01:33:43AM +0100, Alexander Feldman wrote :
> > It is strange that such an issue had not been discussed here in
> > the past (or maybe I have missed the mails as I don't follow
> > very regularly the list).
>
> You seem to have missed it, where was something about this
> topic during the last monthes.

Will search the archives...

>
> Btw, as long as the implemention isn't in C (it's not quite
> clear from your mail to me) but in PHP it's offtopic anyway
> and should better be directed to php-general or pear-* if you
> want to contribute.

No, no - the implementation is in C (I don't think that this can be done in
PHP only), however it is still under construction, hence I've not posted
here the patches. In my previous mail I wanted only to show how it'll look
like for the end-user and to ask for the comments of the community...

Rgds:

Alex
>
> --
> Please always Cc to me when replying to me on the lists.
> 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 Development Mailing List <http://www.php.net/>
To unsubscribe, visit: http://www.php.net/unsub.php




[PHP-DEV] PHP Tag Libraries

2002-02-15 Thread Alexander Feldman



Hello,
 
Being unexpectedly struck by influenza with high 
temperature (40C) I remained at home and wrote the very first scratches 
of PHP tag libraries. It is strange that such an issue had not been 
discussed here in the past (or maybe I have missed the mails as I don't 
follow very regularly the list).
 
Below is a short example how it looks from the 
user's perspective (my explanations are unnecessary as the sample is quite 
self-explanatory):
 
test_newtag.php:
---

 
---
newtag.ptd:
---

 

 
    
    
newtag    
NewTag    

---
newtag.php:
---
class 
NewTag{    function doStartTag()    
{    print("New Tag: start\n");    }
 
    function 
doEndTag()    {        
print("New Tag: end\n");    
}}?>---

phptaglibrary.1.0.0.dtd (not really necessary 
here):
---

  location CDATA 
#REQUIRED>



---
output:
---
New Tag: startNew Tag: end
---
 
The implementation is quite straightforward - I 
have added new tokens and parser rule for the taglib declaration. Then the 
xml taglib description is parsed with expat and stored in hash 
together with the compiled PHP bytecode of the taglib includes. Finally the 
output is hooked, once again via the XML parser to substitute the custom 
tags with the output of the corresponding methods.
 
I have a lot of things to do (at least one 
week) before I will be able to post here fully working patches, 
however I want to hear what do you think.
 
Custom tag libraries are cool today and should be 
supported wherever is possible...
 
Best regards:
 
-- 
Alex


Re: [PHP-DEV] Re: [PHP-QA] 4.0.6

2001-05-02 Thread Alexander Feldman

On Wed, 2 May 2001, Eduardo Dominguez wrote:

>
> >That COM problem is Win32 specific. And as Microsoft in it's great wisdom
> >has decided not to include any compilers in their OSs, the lack
> >of binary builds for RCs kinda makes it a bit hard for those who would
> >like to to test to actually test.
>
>
> Can anyone make it easy to (via a good tutorial or some dsw)
> how to build and test php on windows ? If it only were
> as easy as in *nix :)

http://www.php.net/manual/en/install-windows.php

-- alex

>
>
>
>
>
> --
> PHP Development Mailing List 
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
>


-- 
PHP Development Mailing List 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP-DEV] Question

2001-04-30 Thread Alexander Feldman

What is doing your extension?

-- alex

On Mon, 30 Apr 2001, Billy Rose wrote:

> I have developed an extension, and am wondering to whom or where I submit it for 
>review?
>
> --
> PHP Development Mailing List 
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
>


-- 
PHP Development Mailing List 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




RE: [PHP-DEV] Re: Crypt salts not random.. (fwd)

2001-04-29 Thread Alexander Feldman

On Sun, 29 Apr 2001, James Moore wrote:

>
> > > > In order to avoid this you actually have to call it at completely
> > > different
> > > > times, something you can't really guarantee.  We should
> > probably not use
> > > > the timestamp as the seed (at least not alone), but also take
> > the pid into
> > > > account.
> > > >
> > > > Zeev
> > > >
> > >
> > >That only really works for forking webservers, does it not? Another
> > >alternative
> > >would be to use microseconds...
> >
> > Yeah we could use microseconds but are they available on all platforms?
> > In any case, on non-forking servers we can use thread id.
>
> We have accuracy to milliseconds only on Win32.

It is enough... We can use gettimeofday or getitimer on linux, gethrtime
on Solaris, ftime on windows, etc. There are other ways to insert some
more pseudo randomness as well. Hashes of data that changes quickly is
enough (environment, all PIDs, ideas?). BTW we do not need so much
randomness for the crypt function. It can not be used for cryptography -
the salt is just to prevent pregenerated dictionaries. Perhaps we can add
another function for the PHP programmer to insert additional entropy while
working? The modern linuxes gather some random data from the times between
the keystrokes and the time between the network packets arrive - we can
use it but it is only available on some linuxes. Or we can add some
extension to gather better random data from the times between the page
requests?

>
> - James
>
> --
> PHP Development Mailing List 
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
>


-- 
PHP Development Mailing List 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP-DEV] Re: Bug in PHP-4.0.5RC6?

2001-04-17 Thread Alexander Feldman

Hi,

I fixed the pipes problem and commited the fix in the main branch and in
the PHP_4_0_5 one. Should I merge it also in php_4_0_5RC6 as well? This
merging/branching always inserts happiness in my life...

Thanks

-- alex

On Sun, 15 Apr 2001, Sascha Schumann wrote:

> > Ok, my fault - I will add test if this is a file handle and not if this
> > is not a socket handle.
>
> Yes, that would be a possible solution.
>
> > How this should be solved on AIX?
>
> The last sentence referred to that ANSI incompatibility which
> (so far) I have only seen on AIX.  It looks like we just need
> to refine the solution which we already have.
>
> - Sascha Experience IRCG
>   http://schumann.cx/http://schumann.cx/ircg
>


-- 
PHP Development Mailing List 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP-DEV] Re: Bug in PHP-4.0.5RC6?

2001-04-15 Thread Alexander Feldman

On Sun, 15 Apr 2001, Sascha Schumann wrote:

> > Ok, my fault - I will add test if this is a file handle and not if this
> > is not a socket handle.
>
> Yes, that would be a possible solution.

Commited to the CVS.

rgds:

sasha

>
> > How this should be solved on AIX?
>
> The last sentence referred to that ANSI incompatibility which
> (so far) I have only seen on AIX.  It looks like we just need
> to refine the solution which we already have.
>
> - Sascha Experience IRCG
>   http://schumann.cx/http://schumann.cx/ircg
>
>
> --
> PHP Development Mailing List 
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
>


-- 
PHP Development Mailing List 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP-DEV] Re: Bug in PHP-4.0.5RC6?

2001-04-15 Thread Alexander Feldman

On Sun, 15 Apr 2001, Sascha Schumann wrote:

> On Fri, 13 Apr 2001, Andi Gutmans wrote:
>
> > Does this work for you on 4.0.4pl1?
> > Any idea when this broke?
> > Andi
>
> The following commit broke this functionality:
>
> date: 2001/03/11 10:08:27;  author: sasha;  state: Exp; lines: +17 -1
> branches:  1.148.2;
> Fixed a compatibility problem is some file functions (fgets, fputs, fread,
> fwrite). The ANSI standard says that if a file is opened in read/write
> mode, fseek() should be called before switching from reading to writing
> and vice versa.
>
> Pipes are uni-directional and hence the above description
> does not apply to them.  A more differentiated approach is
> needed to solve that issue on AIX etc.

Ok, my fault - I will add test if this is a file handle and not if this
is not a socket handle.

How this should be solved on AIX?

-- sasha

>
> - Sascha Experience IRCG
>   http://schumann.cx/http://schumann.cx/ircg
>
>
> --
> PHP Development Mailing List 
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
>


-- 
PHP Development Mailing List 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP-DEV] Re: Bug in PHP-4.0.5RC6?

2001-04-15 Thread Alexander Feldman

On Fri, 13 Apr 2001, Andi Gutmans wrote:

> Does this work for you on 4.0.4pl1?

On 4.0.4pl1 it is OK, but on 4.0.5RC6 on Solaris 8 it shows the problem.

-- Alex

> Any idea when this broke?
> Andi
>
> At 12:24 AM 4/13/2001 +0200, Didi Rieder wrote:
> >Hello,
> >
> >I have a problem with "popen" and "fgets" in php-4.0.5RC6 on Solaris 8
> >(Sparc):
> >
> >Script:
> >
> > >$rc = '';
> >$pipe = popen("/bin/ls -la /tmp", "r");
> > while (($rc = fgets($pipe, 8192))) {
> > print $rc;
> > }
> >pclose($pipe);
> >?>
> >
> >It produces:
> >total 290
> >
> >A normal commandline listing would produce:
> >
> >[root@sbox /root]# ls -la /tmp
> >total 290
> >drwxrwxrwt   9 sys  sys 1109 Apr 13 00:20 .
> >drwxr-xr-x  24 root root 512 Apr  9 15:43 ..
> >drwxrwxrwx   2 root root 179 Feb 25 15:30 .pcmcia
> >drwx--   2 root other117 Apr  2 19:22 AOaWLY
> >drwx--   2 root other117 Mar 28 13:11 gCaqL6
> >-rw-r--r--   1 root other  19665 Apr 11 21:27 imp-sieve.tar.gz
> >-rw-rw--w-   1 cyrusmail   25098 Apr 12 21:24 imp.log
> >-rw---   1 root other  0 Mar 30 22:36 mpEeaWIz
> >-rw---   1 root other  0 Mar 29 13:54 mpUZa4Po
> >srwxrwxrwx   1 root other  0 Mar 28 16:36 mysql.sock
> >drwxr-xr-x   3 root other248 Mar 23 20:57 new
> >-rw-rw-r--   1 root sys 6496 Feb 25 15:29 ps_data
> >-rw---   1 root other  0 Apr 12 19:41 session_mm.sem
> >-rw-rw--w-   1 cyrusmail8644 Apr 12 00:16 sieve.log
> >drwx--   2 root other181 Apr 13 00:04 ssh-YgP13837
> >drwx--   2 root other181 Apr  7 10:46 ssh-ZPD12871
> >drwx--   2 root other181 Apr  7 10:56 ssh-wza13793
> >
> >
> >~regards
> > Didi
> >
> >--
> >
> >Didi Rieder
> >[EMAIL PROTECTED]
> >
>


-- 
PHP Development Mailing List 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP-DEV] Request for new feature: $HTTP_SESSION_VARS whenregister_globals = on

2001-04-06 Thread Alexander Feldman

On Fri, 6 Apr 2001, Sascha Schumann wrote:

> > It is simpler.
>
> Chuck is talking about another problem which I agree has not
> been addressed yet properly.
>
> > We should just leave the array $HTTP_SESSION_VARS in the
> > case when register_globals is on. Currently when the variables are registered
> > they *are* removed from the $HTTP_SESSION_VARS array. I do not think this is
> > the intended behaviour.
>
> That is not the behaviour I see.  The following script
> displays the correctly setup $HTTP_SESSION_VARS array when
> run multiple times with the current CVS.

Hm, very strange. You are absolutely right - I do not see any problems as
well. Not only with the current cvs but with the older phps also... But I
am sure I have seen some time ago exactly what was described by Carsten
Gehling. Maybe it is kind of group hallucination ;)

-- alex

>
>  session_id("test");
> session_register("c");
> $c++;
> var_dump($HTTP_SESSION_VARS);
>
> - Sascha Experience IRCG
>   http://schumann.cx/http://schumann.cx/ircg
>
>
> --
> PHP Development Mailing List 
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
>


-- 
PHP Development Mailing List 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP-DEV] Request for new feature: $HTTP_SESSION_VARS whenregister_globals = on

2001-04-06 Thread Alexander Feldman

On Fri, 6 Apr 2001, Chuck Hagenbuch wrote:

> Quoting Sascha Schumann <[EMAIL PROTECTED]>:
>
> > >- but that does make it really
> > > messy to write code that works with either setting.
> >
> > Yes.  Feel free to propose a solution which solves your
> > problem and which is compatible to existing scripts.
>
> What about adding session_set_var (and session_get_var, for symmetry) functions
> to set and access session variables regardless of scope?

It is simpler. We should just leave the array $HTTP_SESSION_VARS in the
case when register_globals is on. Currently when the variables are registered
they *are* removed from the $HTTP_SESSION_VARS array. I do not think this is
the intended behaviour.

The chance of breaking the existing scripts by having the session
variables both as global and in the $HTTP_SESSION_VARS array are minimal.

I do not think this is a new feature and just a bugfix...

-- alex

>
> -chuck
>
> --
> Charles Hagenbuch, <[EMAIL PROTECTED]>
> Number of U.S. nuclear bombs lost in accidents and never recovered: 11
>
> --
> PHP Development Mailing List 
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
>


-- 
PHP Development Mailing List 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP-DEV] Request for new feature: $HTTP_SESSION_VARS whenregister_globals = on

2001-04-05 Thread Alexander Feldman

This makes sense. The behaviour quoted below creates difficulties when
writing portable scripts (not to depend on the value of register_globals).

Rgds:

-- Alex

On Thu, 5 Apr 2001, Carsten Gehling wrote:

> One of the IMHO stranger behaviors in PHP is what happens to the
> $HTTP_SESSION_VARS array when changing register_globals from off to on.
>
> If register_globals is set to on, you cannot access $HTTP_SESSION_VARS any
> longer. Instead you can get the values through implicit created variables or
> through the $GLOBALS array.
>
> Now compare this to $HTTP_GET_VARS and $HTTP_POST_VARS. Both of these arrays
> are available regardless of what register_globals is set to.
>
> Shouldn't it be the same for $HTTP_SESSION_VARS ?
>
> - Carsten
>
>
>
> --
> PHP Development Mailing List 
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
>


-- 
PHP Development Mailing List 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP-DEV] Shared memory in extensions

2001-04-03 Thread Alexander Feldman

On Tue, 3 Apr 2001, Thomas Wentzel wrote:

[snip]

> Where can I find a good explanation as to what the differences are
> between
> MINIT, RINIT, MSHUTDOWN and RSHUTDOWN?

http://www.zend.com/apidoc/x629.php

> 
> hehe - how would one go about removing a shared memory segment
> manually??

ipcrm (see also ipcs)

[snip]

Regards:

Alex


-- 
PHP Development Mailing List 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP-DEV] Shared memory in extensions

2001-04-02 Thread Alexander Feldman

Hi Thomas,

I tried to create a shared segment of size 5 megabytes in the
PHP_MINIT_FUNCTION and I had no problems.

The situation you described seems as you have called shmctl with IPC_RMID
but not everyone had detached from the segment. Then you tried to use
shmget and it failed - remove manually the shared memory segment and try
again.

--
Alexander Feldman
Zend Technologies Ltd.
phone: +972 3 6139665 ext. 113, fax: +972 3 6139671
http://www.zend.com/

On Mon, 2 Apr 2001, Thomas Wentzel wrote:

> Hehe - sorry :)
> Errno is set to 43 (Identifier removed (?))
> 
> 
> The URL is:
> http://www.humanfactor.com/cgi-bin/cgi-delegate/apache-ML/nh/1999/Jan/0467.html
> - enjoy ;)
> 
> Thomas
> 
> Gavin Sherry wrote:
> > 
> > Thomas,
> > 
> > When shmget() fails, it sets errno. It would be useful if you could
> > provide this information (see shmget(2)).
> > 
> > Also, do you have a URL got SHM across HTTP patch? This sounds like fun =)
> > 
> > Gavin
> > 
> > On Mon, 2 Apr 2001, Thomas Wentzel wrote:
> > 
> > > shmid=shmget((key_t)5346,sizeof(dbinfo),0666|IPC_CREAT);
> > > which returns -1
> > >
> > > I just found something about a patch to apache, that should enable
> > > som shared memory pools across http session! Is this something I
> > > should use? It was a rather old patch (for apache 1.3.4/5)...
> > >
> > > Thanx
> > >   Thomas
> > >
> > > Alexander Feldman wrote:
> > > >
> > > > On Mon, 2 Apr 2001, Thomas Wentzel wrote:
> > > >
> > > > > Linux!
> > > > >
> > > > > RedHat 6.2, Apache 1.3.14, PHP 4.0.4pl1
> > > > >
> > > > > I forgot to mention that because shmget fails and that it does so in
> > > > > PHP_MINIT_FUNCTION, apache wil not start!
> > > >
> > > > With what parameters are you calling shmget? What is the errno after this
> > > > call?
> > > >
> > >
> > >
> > 
> > --
> > PHP Development Mailing List <http://www.php.net/>
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> > To contact the list administrators, e-mail: [EMAIL PROTECTED]
> 
> -- 
> PHP Development Mailing List <http://www.php.net/>
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
> 


-- 
PHP Development Mailing List <http://www.php.net/>
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP-DEV] Re: [PHP-QA] PHP 4.0.5 Release Candidate testing

2001-04-02 Thread Alexander Feldman

On Mon, 2 Apr 2001, Andrei Zmievski wrote:

> On Mon, 02 Apr 2001, Alexander Feldman wrote: > Hi, > > These are the
> results and questions from some tests I run yesterday on the > last
> 4.0.5 release candidate. Note that all differences are from PHP >
> 4.0.4pl1. > > 1. The function array_flip($array) puts one extra zero
> byte at the end of > each element in the return array thus making the
> result non binary safe.
> 
> I've just fixed it in CVS.

Great.

> 
> > 3. The count_chars() function returns different result from the
> 4.0.4pl1 > count_chars() function.
> 
> Examples?

Ok, now I analyzed the output more carefully - the problem had been in
4.0.4 - the count_chars function there doesn't create element for the byte
with value 255. This is fixed here - I do not expect problems with this
function (BTW, it doesn't seem to be widely used)...

Attached is a script that reproduces the difference.

> 
> -Andrei
> 
> "The only true currency in this bankrupt world is what we share with
> each other when we're uncool." -- Lester Bangs, from the film 'Almost
> Famous'
> 

Thanks:

-- Alex



for ($i = 0; $i <= 4; $i++) {
$res = count_chars("Mary had a little lamb and she loved it so.", $i);
if (is_array($res)) {
foreach ($res as $x =>; $y)
print("$x($y) ");
print("\n");
} else {
if (4 == $i)
$res = addcslashes($res, "\0..\377");
print("$res\n");
}
}



-- 
PHP Development Mailing List <http://www.php.net/>
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]


Re: [PHP-DEV] Shared memory in extensions

2001-04-02 Thread Alexander Feldman

On Mon, 2 Apr 2001, Thomas Wentzel wrote:

> Linux!
> 
> RedHat 6.2, Apache 1.3.14, PHP 4.0.4pl1
> 
> I forgot to mention that because shmget fails and that it does so in 
> PHP_MINIT_FUNCTION, apache wil not start! 

With what parameters are you calling shmget? What is the errno after this
call?

-- Alex

> 
> Thomas
> 
> I compile the module _into_ PHP due to the 
> Alexander Feldman wrote:
> > 
> > On Mon, 2 Apr 2001, Thomas Wentzel wrote:
> > 
> > > Hi
> > >
> > > Can anybody help me?
> > >
> > > I'm trying to allocate some shared memory in the PHP_MINIT_FUNCTION -
> > > but it fails everytime during the shmget function.
> > > I then did a little stand-alone C-prog, that did the same (tried to
> > > allocate 3,5M of mem) and it works fine - everytime!
> > > Is there some issued when using shared mem in php extensions?
> > 
> > On what platform is this?
> > 
> > >
> > > BR
> > >   Thomas
> > 
> > -- Alex
> > 
> > >
> > > --
> > > PHP Development Mailing List <http://www.php.net/>
> > > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > > For additional commands, e-mail: [EMAIL PROTECTED]
> > > To contact the list administrators, e-mail: [EMAIL PROTECTED]
> > >
> > 
> > --
> > PHP Development Mailing List <http://www.php.net/>
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> > To contact the list administrators, e-mail: [EMAIL PROTECTED]
> 
> -- 
> PHP Development Mailing List <http://www.php.net/>
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
> 


-- 
PHP Development Mailing List <http://www.php.net/>
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP-DEV] Shared memory in extensions

2001-04-02 Thread Alexander Feldman

On Mon, 2 Apr 2001, Thomas Wentzel wrote:

> Hi
> 
> Can anybody help me?
> 
> I'm trying to allocate some shared memory in the PHP_MINIT_FUNCTION - 
> but it fails everytime during the shmget function.
> I then did a little stand-alone C-prog, that did the same (tried to 
> allocate 3,5M of mem) and it works fine - everytime!
> Is there some issued when using shared mem in php extensions?

On what platform is this?

> 
> BR
>   Thomas

-- Alex

> 
> -- 
> PHP Development Mailing List 
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
> 


-- 
PHP Development Mailing List 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP-DEV] PHP 4.0.5 Release Candidate testing

2001-04-02 Thread Alexander Feldman

Hi,

These are the results and questions from some tests I run yesterday on the
last 4.0.5 release candidate. Note that all differences are from PHP
4.0.4pl1.

1. The function array_flip($array) puts one extra zero byte at the end of
each element in the return array thus making the result non binary safe.

2. The nl2br function was modified to produce the correct tag 
instead the opening only one . Wouldn't this affect somehow the
existing applications? The nl2br() function is widely used and all
modification to its output should be done *extremely* carefully.

3. The count_chars() function returns different result from the 4.0.4pl1
count_chars() function.

4. Where is the connection_timeout() function. Was it removed on purpose?

5. The following expression returns empty string:
get_cfg_var("error_reporting") (I think this may be my problem in the
testing).

Best regards:
--
Alexander Feldman
Zend Technologies Ltd.
phone: +972 3 6139665 ext. 113, fax: +972 3 6139671
http://www.zend.com/


-- 
PHP Development Mailing List <http://www.php.net/>
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP-DEV] Can we have a "PING" function?

2001-04-02 Thread Alexander Feldman

> Do most servers and OS's (for example Windows) support the sending of a UDP 
> package to the echo port?
> 
> Andi

Yeah,

What about a new ICMP extension - ping, traceroute, etc.

-- Alex

> 
> At 12:39 AM 4/2/2001 -0400, Dave Crawford wrote:
> >Before I ask for a PING function in a future build of PHP, is there a
> >way to ping a remote host using the existing PHP functions or modules?
> >
> >Based on my knowledge gained from various sources and php.net's online
> >functional reference, there does not appear to be much support for LWP
> >anything.
> >
> >I would like to know how to do, or perhaps you can build a function
> >in a future release that can do basically the same thing as outlined in the
> >following document for a similar function in Perl:
> >http://www.perl.com/pub/doc/manual/html/lib/Net/Ping.html
> >
> >When my site was all html and Perl, I used this function to ping all of my
> >mirror download sites, and I coloured the ping value based on a range
> >(Ex: less than 150ms was green, greater than 600ms was red, etc.)
> >
> >I need a way to incorperate this same functionality into my new all PHP
> >based website.
> >
> >Thanks.
> >-Dave
> >
> >
> >
> >--
> >PHP Development Mailing List 
> >To unsubscribe, e-mail: [EMAIL PROTECTED]
> >For additional commands, e-mail: [EMAIL PROTECTED]
> >To contact the list administrators, e-mail: [EMAIL PROTECTED]
> 
> 
> -- 
> PHP Development Mailing List 
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
> 


-- 
PHP Development Mailing List 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP-DEV] GD configure slightly broken.

2001-03-19 Thread Alexander Feldman

This is not the only problem with the gd extension configuration. On some
platfomrs (FreeBSD) we need the -lm library for this extension when
linking (it is important if you build a dynamic gd.so extension). Also
there is no proper testing for setting the HAVE_GD_XBM constant. I will
fix this when I have time.

-- Alex

On Mon, 19 Mar 2001, Fredrik Ohrn wrote:

> 
> If I do a
> 
>   ./configure --with-gd
> 
> Without actually having GD installed in a standard location the configure
> script decides to statically link it instead of raising an error:
> 
>   checking whether to include GD support... yes (static)
> 
> And then the make will bomb when gcc can't find the gd headers.
> 
> Is this supposed to be or is it a bug?
> 
> 
> Regards,
> Fredrik
> 
> -- 
> Do fish get thirsty?
> 
> Fredrik Öhrn   Chalmers University of Technology
> [EMAIL PROTECTED]  Sweden
> 
> 
> -- 
> PHP Development Mailing List 
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
> 


--
PHP Development Mailing List 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP-DEV] SIGFPE, FreeBSD and some PHP math functions

2001-03-11 Thread Alexander Feldman

Hello,

There is a bunch of mathematical functions that can generate core dump on
FreeBSD 3.4 (and on a whole group of other UNIX clones). Take for example
the following PHP script:



or



and so on...

Obviously we should fix this behavior as there should not be a way for a
PHP script to crash the process. Here is the question how to do this. One
approach is to check for out of range value in the PHP functions before
calling the underlying math procedures. Another approach is to ignore the
signal (on FreeBSD that is SIGFPE) and manually in the appropriate PHP
functions to check if an exception flag is raised. Perhaps, there are
other decisions as well.

Are there any volunteers to write the code or I should take this?

-- Alex


-- 
PHP Development Mailing List 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP-DEV] 4.0.5 Release Candidate

2001-03-07 Thread Alexander Feldman

On Wed, 7 Mar 2001, [ISO-8859-1] André Langhorst wrote:

> Is there any reason to retard the 4.0.5 Release Candidate 1 ?
> We should branch anytime soon.
> 
> Are there any outstanding commits (zeev mentioned zend sos guys want to 
> commit sth)?
> 
> If not we could start this weekend, maybe at the beginning of the next 
> week...? Please shout if you still have open commits that definitely 
> need to go in...

*producing some cries* - yeah I want to commit 2-3 patches and I
will do my best to close this before Saturday.

> 
> andré
> 
> 
> -- 
> · André Langhorstt: +49 331 5811560 ·
> · [EMAIL PROTECTED]  m: +49 173 9558736 ·
> * PHP Quality Assurance  http://qa.php.net  *
> 
> 
> -- 
> PHP Development Mailing List 
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
> 

-- Sasha



--
PHP Development Mailing List 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP-DEV] php.ini distribution

2001-03-04 Thread Alexander Feldman

On Sat, 3 Mar 2001, Sebastian Bergmann wrote:

>   I just commited a patch that removed the configuration options for the
> debugger, that never(?) existed in PHP 4, namely
> 
> - debugger.host
> - debugger.port
> - debugger.enabled
> 
>   I hope this was okay.

Great, I planned to do this... We should also remove the Logging
section. If there are no objections I will strip it.

> 
>   Now, what about the discussion we had some time ago about removing
> php.ini-optimized and add a php.ini-recommended (and yet another version,
> but I can't remember)?

Hm, what about php.ini-win and php.ini-nix??

> 
>   Just curious,
> Sebastian
> 
> -- 
>  sebastian bergmann e-mail :  [EMAIL PROTECTED]
>   homepage :  http://www.sebastian-bergmann.de
>make a gift : http://wishlist.sebastian-bergmann.de
>  measure the usability of your web application -> http://phpOpenTracker.de
> 
> -- 
> PHP Development Mailing List <http://www.php.net/>
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
> 

Best regards:

Alexander Feldman



-- 
PHP Development Mailing List <http://www.php.net/>
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP-DEV] RE: [PHP-QA] Problem with strings on Win32

2001-02-20 Thread Alexander Feldman


Hi,

I can not understand very well the question, but you can produce such an
output with the following php script:



The interpreter is binary safe and that's ok. Perhaps the var_dump
function can be enhanced, but it is supposed only for internal usage,
isn't it?

Regards:
--
Alex

On Tue, 20 Feb 2001, James Moore wrote:

> > **
> > string(6) ""
> >
> >   . So, the variable's type and size are set correctly, but not its value.
> >
> >   I'm using yesterday's CVS on Windows 2000 Professional. Sascha already
> > checked this on his machine(s) and could NOT reproduce this.
> 
> Sorry to ask this but your not being stupid and looking at the output
> through a browser??
> 
> James
> 
> 
> -- 
> PHP Development Mailing List 
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
> 


-- 
PHP Development Mailing List 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP-DEV] buffered io - sparc solaris

2001-02-19 Thread Alexander Feldman

Hi,

>From the fopen(3) manual page on Solaris 2.6 (it is the same on Solaris 7 
and Solaris 8):

 When a file is opened with update mode (+ as the  second  or
 third character in the mode argument), both input and output
 may be performed on the associated stream.  However,  output
 must  not be directly followed by input without an interven-
 ing call to fflush(3S) or to  a  file  positioning  function
 (fseek(3S),  fsetpos(3S)  or rewind(3S)), and input must not
 be directly followed by output without an  intervening  call
 to  a  file positioning function, unless the input operation
 encounters end-of-file.

The nasty behaviour remains even if we disable the buffering with call to
setbuf. This imposes a significant compatibility problem with the PHP file
io functions. The decision is to call explicitly fflush() when changing
the direction of the data flow.

I prepared a fix for this (it can be optimized and improved heavily), but
before I commit it I want to hear your opinion. Please see the attachment.

Thank you:
--
Alexander Feldman
Zend Technologies Ltd.
phone: +972 3 6139665 ext. 113, fax: +972 3 6139671
http://www.zend.com


diff -u ext/standard/config.m4 ../php-4.0.4pl1.fix/ext/standard/config.m4
--- ext/standard/config.m4  Wed Jul 19 19:19:40 2000
+++ ../php-4.0.4pl1.fix/ext/standard/config.m4  Mon Feb 19 20:48:43 2001
@@ -3,6 +3,57 @@
 divert(3)dnl
 
 dnl
+dnl Check if flush should be called explicitly after buffered io
+dnl
+AC_DEFUN(AC_FLUSH_IO,[
+  AC_CACHE_CHECK([whether flush should be called explicitly after a bufferered io], 
+ac_cv_flush_io,[
+  AC_TRY_RUN( [
+#include 
+#include 
+
+int main(int argc, char **argv)
+{
+   char *filename = tmpnam(NULL);
+   char buffer[64];
+   int result = 0;
+   
+   FILE *fp = fopen(filename, "wb");
+   if (NULL == fp)
+   return 0;
+   fputs("line 1\n", fp);
+   fputs("line 2\n", fp);
+   fclose(fp);
+   
+   fp = fopen(filename, "rb+");
+   if (NULL == fp)
+   return 0;
+   fgets(buffer, sizeof(buffer), fp);
+   fputs("line 3\n", fp);
+   rewind(fp);
+   fgets(buffer, sizeof(buffer), fp);
+   if (0 != strcmp(buffer, "line 1\n"))
+   result = 1;
+   fgets(buffer, sizeof(buffer), fp);
+   if (0 != strcmp(buffer, "line 3\n"))
+   result = 1;
+   fclose(fp);
+   unlink(filename);
+
+   exit(result);
+}
+],[
+  ac_cv_flush_io="no"
+],[
+  ac_cv_flush_io="yes"
+],[
+  ac_cv_flush_io="no"
+])])
+  if test "$ac_cv_flush_io" = "yes"; then
+AC_DEFINE(HAVE_FLUSHIO, 1, [Define if flush should be called explicitly after a 
+buffered io.])
+  fi
+])
+
+dnl
 dnl Check for crypt() capabilities
 dnl
 AC_DEFUN(AC_CRYPT_CAP,[
@@ -143,6 +194,7 @@
 AC_CHECK_FUNCS(getcwd getwd)
 
 AC_CRYPT_CAP
+AC_FLUSH_IO
 
 divert(5)dnl
 
diff -u ext/standard/file.c ../php-4.0.4pl1.fix/ext/standard/file.c
--- ext/standard/file.c Thu Dec 14 16:34:51 2000
+++ ../php-4.0.4pl1.fix/ext/standard/file.c Mon Feb 19 20:55:59 2001
@@ -882,6 +882,10 @@
efree(buf);
RETVAL_FALSE;
} else {
+#ifdef HAVE_FLUSHIO
+   if (!issock)
+   fflush((FILE*)what);
+#endif
if (PG(magic_quotes_runtime)) {
return_value->value.str.val = 
php_addslashes(buf,0,&return_value->value.str.len,1);
} else {
@@ -926,6 +930,10 @@
efree(buf);
RETVAL_FALSE;
} else {
+#ifdef HAVE_FLUSHIO
+   if (!issock)
+   fflush((FILE*)what);
+#endif
buf[0]=result;
buf[1]='\0';
return_value->value.str.val = buf; 
@@ -1119,6 +1127,9 @@
if (issock){
ret = SOCK_WRITEL((*arg2)->value.str.val,num_bytes,socketd);
} else {
+#ifdef HAVE_FLUSHIO
+   fflush((FILE*)what);
+#endif
ret = fwrite((*arg2)->value.str.val,1,num_bytes,(FILE*)what);
}
RETURN_LONG(ret);
@@ -1731,6 +1742,9 @@
if (!issock) {
return_value->value.str.len = fread(return_value->value.str.val, 1, 
len, (FILE*)what);
return_value->value.str.val[return_value->value.str.len] = 0;
+#ifdef HAVE_FLUSHIO
+   fflush((FILE*)what);
+#endif
} else {
return_value->value.str.len = SOCK_FREAD(return_value->value.str.val, 
len, socketd);
}
--- main/php_config.h.inThu Jan 11 20:39:35 2001
+++ ../php-4.0.4pl1.fix/main/php_config.h.inMon Feb 19 20:56:35 2001
@@ -1547,6 +1547,9 @@
 /* Whether the system supports BlowFish