[PHP-DEV] Sort doesn't reindex all arrays (Bug #12572)

2002-08-16 Thread Adam Maccabee Trachtenberg

I want to propose the following patch to Zend to fix a minor
inconsistency. The sort() functions reindex arrays of length > 1, but
not of length == 1.

See http://bugs.php.net/bug.php?id=12572 for an example.

The patch is:

Index: zend_hash.c
===
RCS file: /repository/Zend/zend_hash.c,v
retrieving revision 1.86
diff -u -u -r1.86 zend_hash.c
--- zend_hash.c 1 Aug 2002 16:03:21 -   1.86
+++ zend_hash.c 17 Aug 2002 06:38:14 -
@@ -1115,7 +1115,7 @@
 
IS_CONSISTENT(ht);
 
-   if (ht->nNumOfElements <= 1) {  /* Doesn't require sorting */
+   if (ht->nNumOfElements < 1) {   /* Doesn't require sorting */
return SUCCESS;
}
arTmp = (Bucket **) pemalloc(ht->nNumOfElements * sizeof(Bucket *), 
ht->persistent);

If this seems good, can someone with Zend permission please apply?

Thanks.

-adam

-- 
adam maccabee trachtenberg
[EMAIL PROTECTED]


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




[PHP-DEV] PHP apxs installs on AIX

2002-08-16 Thread Dan Kalowsky

Hello again list...

While scanning through some of the bugs tonight, I came across a real jem.

A large number of bugs are submitted dealing with the fact that PHP on AIX
machines does not install.  There is some minor hackery done to enable
this, and it's actually documented only through the bug system.

One user has actually made a patch against the configure script though,
and it looks legit enough.  I did run into a problem though, converting
the configure script changes back into ltmain.sh changes.  Can anyone more
familiar with the build system look at this patch and possibly rev-eng it
to our CVS?

The url to it is:
http://tclab.kaist.ac.kr/~cmlee/pub/php-4.2.2-20020730.patch

>---<
Dan Kalowsky"A little less conversation,
http://www.deadmime.org/~danka little more action."
[EMAIL PROTECTED]- "A Little Less Conversation",
[EMAIL PROTECTED]Elvis Presley


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




[PHP-DEV] Re: [PHP-DOC] Re: #3793 [Ana->Opn]: session.gc_maxlifetime does notwork

2002-08-16 Thread Rasmus Lerdorf

Ok, thinking a bit more about this..  session_readonly() really should be
implemented.  Imagine a system where you have dynamically generated
images/flash/pdf or even just a straight framed site.  You use sessions to
pass information around between not only pages, but also to the
dynamically generated pieces of a page.  Having the session backend
rewrite the same session data many times per request is a waste and if you
know that you are only going to read in the pdf generator script, for
example, it would be a good idea to open the session readonly from that
script.  Or not even that fancy.  You have a standard login page where you
pull some data from a database about the user, stick it in a session and
then the user clicks through the rest of the site.  It wouldn't be that
strange to have hundreds of pages that would need to read that session
data, but never write to it.  With the current implementation we are
needlessly overwriting the same data on every single request.

If session_readonly() gets implemented then removing atime support for
filesystems that support that seems like a step in the wrong direction.
We should perhaps have a modifier on session mod_files which tells it
whether it should use atime, mtime or perhaps even ctime.  Another
configuration directive sucks, but even if we could detect at runtime that
atime was not supported, silently falling back to mtime doesn't seem like
a good idea.  I suppose we could change the default to mtime, implement
session_readonly() and give people the option to switch it to atime.

-Rasmus

On Sat, 17 Aug 2002, Zeev Suraski wrote:

> Just wondering - why are we even using atime?  I think lots of filesystems
> don't support it, but regardless of that - as far as I recall from reading
> the session code, if a session is opened for reading - it is also going to
> be rewritten at the end of the session.  So, it should be quite safe to
> check mtime instead of atime.
> Comments?
>
> Zeev
>
> At 04:03 17/08/2002, [EMAIL PROTECTED] wrote:
> >  ID:   3793
> >  Updated by:   [EMAIL PROTECTED]
> >  Reported By:  [EMAIL PROTECTED]
> >-Status:   Analyzed
> >+Status:   Open
> >-Bug Type: Session related
> >+Bug Type: Documentation problem
> >  Operating System: Windows 98
> >  PHP Version:  4 .1.2
> >  New Comment:
> >
> >I really don't see anybody with any interest in writing code to make
> >this work on FAT filesystems.  Don't run web servers on crap
> >filesystems.  If you do, write your own session handler.  Same goes for
> >filesystems where file modification timestamps are ignored.  Write your
> >own session handler and manage the garbage collection yourself.  We'll
> >need to document this, of course, so marking this as a documentation
> >problem.
> >
> >
> >Previous Comments:
> >
> >
> >[2002-07-10 05:10:43] [EMAIL PROTECTED]
> >
> >I've exactly the same problem with Windows 2000, php 4.2.0 and apache
> >1.3
> >
> >
> >
> >[2002-03-31 03:49:43] [EMAIL PROTECTED]
> >
> >After I tried about a week, by just setting the lifetime VERY high
> >(4 first), maybe I can give a hint:
> >
> >With this very high value it worked, so I tried where exactly was the
> >critical point. It was somewhat about 32000. Slightly below, all
> >session files were deleted as described, slightly over not. But then
> >the error reoccurred with the same value.
> >
> >After some tries I found out the following: I set back the time on the
> >server one hour and it worked again. Here the times and the critical
> >points:
> >
> >At 9:24 local time : 30290
> >At 10:28 : 34100
> >
> >34100-30290=3810, which would be 63.5 minutes when interpretad as
> >seconds, which is the server's time difference...
> >
> >Since 10:28 means 37680 s since 0:00, there seems to be an additional
> >hour - maybe due to GMT setting (+1) I thought, but it was the
> >automatic daylight saving (or is it called summer time???) setting.
> >When turned off, at 9:45 the point was at 35100=9.75 hours...
> >
> >I hope that helps... ;-)
> >
> >-- mike
> >
> >
> >
> >[2002-03-31 02:56:29] [EMAIL PROTECTED]
> >
> >It seems it never worked under windows.
> >Reopen
> >
> >
> >
> >[2002-03-31 02:43:13] [EMAIL PROTECTED]
> >
> >The reported errors are still in verson 4.1.2.
> >
> >System: w2k, CGI-version.
> >
> >
> >
> >[2001-12-16 07:24:47] [EMAIL PROTECTED]
> >
> >No feedback. Closing.
> >
> >
> >
> >The remainder of the comments for this report are too long. To view
> >the rest of the comments, please view the bug report online at
> > http:/

Re: [PHP-DEV] Tru64, snprintf and bug #1298

2002-08-16 Thread Dan Kalowsky

Well it's starting to sound like it might be necessary to do this.  While
nohn's compiler is working, it seems that at least one other Tru64 person
is having difficulty.

Looking at the influx of bugs as well, I'm wondering if Tru64 is going to
be more of a problem for the project as whole... or if it's just 64-bit
arch's in the end.

On Sat, 17 Aug 2002, Marcus [iso-8859-1] Börger wrote:

> First of all the internal replacement of snprintf fails if size is 1 or 0.
> Second it is not C99 complient and third we do not include it the
> right way. We would need to check if snprintf is available and if it is
> C99 complient and if not use the replacement.
>
> I had a lengthy discussion with the php group on that but i did
> not get any answer at last. This might be the case because my
> first worst assumptions were wrong for most systems.
>
> In fact i could commit detection code and corect replacement code
> but will do only when receiving a go from the group.
>
> regards
> marcus
>
> At 23:31 16.08.2002, Dan Kalowsky wrote:
> >Yes, that is correct, bug #1298 (it's existed for a LONG time).
> >
> >The user is having some difficulty compiling the Zend libraries for 4.2.2.
> >Mainly it seems that snprintf is turning up as an unresolved symbol.
> >I asked him to grep through the /usr/include looking for it, and the
> >result was nothing.
> >
> >Looking through the code I see PHP has it's own snprintf implementation,
> >and that should suffice.  Apparently zend_API.c though doesn't notice it.
> >His fix was to place <#include "php.h"> inside the file, and everything
> >worked fine.
> >
> >Does anyone have any more insight into this that they might be able to
> >share?
> >
> > >---<
> >Dan Kalowsky"A little less conversation,
> >http://www.deadmime.org/~dank   a little more action."
> >[EMAIL PROTECTED]   - "A Little Less Conversation",
> >[EMAIL PROTECTED]Elvis Presley
> >
> >
> >--
> >PHP Development Mailing List 
> >To unsubscribe, visit: http://www.php.net/unsub.php
>
>
>

>---<
Dan Kalowsky"A little less conversation,
http://www.deadmime.org/~danka little more action."
[EMAIL PROTECTED]- "A Little Less Conversation",
[EMAIL PROTECTED]Elvis Presley


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




Re: [PHP-DEV] Re: #18401 [Opn->Ana]: shuffle() broken (fwd)

2002-08-16 Thread Adam Maccabee Trachtenberg

On Fri, 16 Aug 2002, Tim Converse wrote:

> --- Yasuo Ohgaki <[EMAIL PROTECTED]> wrote:
> If you don't believe me, take your algorithm and run it
> many times, tracking how often element i in the input moves
> to become element j in the output, and print the resulting
> counts out as an n-by-n table.  You'll see a bias towards
> elements moving one position back in the array.

Yasuo --

Look at the following code. The php_shuffle() function is the
algorithm currently in the CVS; yasuo_shuffle() is what you're
proposing.

The test() function is a simple script to call each *_shuffle()
function 100,000 times on a three-element array, record the
permutations, and print out a record of the results. You'll see that
php_shuffle() evenly divides the elements, while yours does not:

 $v) {
print "$k: $v: " . sprintf('%0.3f', $v / $times) . "%\n";
  }

}

test('php_shuffle');
test('yasuo_shuffle');
?>

This is what I get repeatedly:

php_shuffle
123: 16707: 0.167%
132: 16641: 0.166%
213: 16569: 0.166%
231: 16751: 0.168%
312: 16532: 0.165%
321: 16800: 0.168%

yasuo_shuffle
123: 14755: 0.148%
132: 18427: 0.184%
213: 18554: 0.186%
231: 18566: 0.186%
312: 14790: 0.148%
321: 14908: 0.149%

-adam

-- 
adam maccabee trachtenberg
[EMAIL PROTECTED]


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




Re: [PHP-DEV] Re: #18401 [Opn->Ana]: shuffle() broken (fwd)

2002-08-16 Thread Tim Converse


--- Yasuo Ohgaki <[EMAIL PROTECTED]> wrote:
> Tim Converse wrote:
> > --- Yasuo Ohgaki <[EMAIL PROTECTED]> wrote:
> > 
> >>Dan Kalowsky wrote:
> >>
> >>>Anyone able to confirm or deny the validity of this
> >>
> >>patch?
> >>
> >>>
> >>>-- Forwarded message --
> >>>
> >>>[2002-07-18 01:03:51] [EMAIL PROTECTED]
> >>>
> >>>The shuffle() function in the CVS is (still) broken.
> It
> >>
> >>does not
> >>
> >>>correctly generate all possible combinations of the
> >>
> >>array. (I know this
> >>
> >>>function was recently updated, this test is with new
> >>
> >>version.)
> >>
> >>>Here is a diff to fix the problem:
> >>>
> >>>--- array.cThu Jul 18 00:50:54 2002
> >>>+++ array.new.cThu Jul 18 00:49:35 2002
> >>>@@ -1441,7 +1441,7 @@
> >>> {
> >>>   Bucket **elems, *temp;
> >>>   HashTable *hash;
> >>>-  int j, n_elems, cur_elem = 0, rnd_idx, n_left;
> >>>+  int j, n_elems, rnd_idx, n_left;
> >>>
> >>>   n_elems = zend_hash_num_elements(Z_ARRVAL_P(array));
> >>>
> >>>@@ -1457,13 +1457,12 @@
> >>>   elems[j++] = temp;
> >>>   while (--n_left) {
> >>>   rnd_idx = php_rand(TSRMLS_C);
> >>>-  RAND_RANGE(rnd_idx, cur_elem, n_left,
> PHP_RAND_MAX);
> >>>-  if (rnd_idx != cur_elem) {
> >>>-  temp = elems[cur_elem];
> >>>-  elems[cur_elem] = elems[rnd_idx];
> >>>+  RAND_RANGE(rnd_idx, 0, n_left, PHP_RAND_MAX);
> >>>+  if (rnd_idx != n_left) {
> >>>+  temp = elems[n_left];
> >>>+  elems[n_left] = elems[rnd_idx];
> >>>   elems[rnd_idx] = temp;
> >>>   }
> >>>-  cur_elem++;
> >>>   }
> >>>
> >>>   HANDLE_BLOCK_INTERRUPTIONS();
> >>>
> >>
> >>I've send the message to Dan, already.
> >>Just posting php-dev again.
> >>
> >>Top elements have more chance than end elements.
> >>All elements should have equal chance to be shuffled.
> > 
> > 
> > Actually, I think the algorithm of the patched version
> is
> > correct.  It's counterintuitive, but it doesn't matter
> how
> > many times any slot has an element shuffled out of it. 
> 
> It may not be intuitive that the algorithm is not
> perfectly
> correct. It may be enough for most purposes, though.
> 
> > What matters is the invariant that whenever
> elems[n_left]
> > is set, it's being set to an element randomly chosen
> from
> > the subset of elements that are left (including
> > elems[n_left]), and also that elems[n_left] is not
> messed
> > with thereafter. 
> 
> For example, if the last element isn't shuffled, it's
> stays
> in as the last element since the last element has only 1
> chance
> to be shuffled.
> 
> Current code has tendency that last elements stay as
> last.
> 
> i.e. Probability of the last element is shuffled is
>(total_num-1)/total_num.
> while n th element to be shuffled is obviously has much
> more chance than last elements. It may be acceptable
> for most purposes.

It doesn't matter how likely a particular slot is to be
swapped. Some slots will be subject to (temporary) swap
more often than others.  What matters is whether the end
result includes all possible permutations with exactly
equal probability.

> 
> > 
> > You would think that the right thing to do is to set
> > elems[n_left] to a random choice from _all_ the
> elements in
> > the array, but this leads to some orderings being
> favored
> > over others.  (Check out Intro. to Algo., Cormen, 2nd
> ed.,
> > p 103)
> 
> elemes[n_left] to a random choice does not make sense, of
> course.
> 
> To give equal chances to be shuffled for all elements, we
> can write something like
> 
> for (current=0; current < num_of_elems; current++) {
>random_index = rand();
>RAND_RANGE(random_index, 0, num_of_elems-1,
> PHP_RAND_MAX);
>if (array[current] != array[random_index])
>  swap(array[current], array[random_index]);
> }
> 
> Current code is almost ok, but this way is correct.
> This does not require any additional overhead at all,
> also.
> 
> --
> Yasuo Ohgaki

No, this is not correct.  You are choosing the element to
swap with array[current] from the entire range, from
array[0] to array[num_of_elems - 1].  This introduces a
subtle bias in favor of elements being moved one position
back.

In particular, for a three-element array there are 27
possible execution traces (three choices each time), and in
10 of those traces the second element becomes the first
element, when it should be 9 out of 27 (= 1/3) instead. 
Note also that all 27 execution traces are of equal
probability, yet somehow they must map to exactly 6
equal-probability orderings of three elements.  Since 27 is
not divisible by 6, this can't happen.

Instead, you need to loop through the array elements and
choose the next swap candidate for array[i] from the set of
elements between array[i] and array[n-1] (inclusive).  This
will have the result that when each array[i] is set (for
the final time) it is an unbiased choice from all the
elements that are still eligib

Re: [PHP-DEV] Trying to input a webpage - need help

2002-08-16 Thread Paul Nicholson

-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Hi Ken,
This code chunk should do the trick.
- -- php code --
$data ="insert=data&location=here";  /* This would be the data that needs to be posted 
to the site - urlencode it */
/* Headers for http transactionreplace  /folder/pages.ext */
$header = "POST /folder/pages.ext HTTP/1.1\r\n".
   "Accept-Language: en-us\r\n". /* Additional info for the receiving 
server.optional */
   "Content-Length: ".strlen($data)."\r\n". /* This line is *very* 
important - length of posted data */
   "Content-Type: application/x-www-form-urlencoded\r\n". /* Type of 
content the server can expect from us */
   "User-Agent: YourCustomUser-Agent (compatible; Linux 2.4; RedHat 
7.2;)\r\n". /* optional */
   "Host: host.com\r\n". /* the "host" of the site you are sending the 
posted data to.*/
   "Cookie: cookie-name=cookie-val\r\n\r\n". /* We can even send 
cookies optional..remove and add an extra \r\n to the above line */
   "$data"; /* this is where the data is sentno need to change this 
line. */
$fp = fsockopen ("host.com", 80, $errno, $errstr, 30);
if (!$fp) {
echo "$errstr ($errno)\n";
} else {
fputs ($fp, $header);
while (!feof($fp)) {
echo fgets ($fp,128); /* Data returned from server.use as you like */
}
fclose ($fp);
}
- -- End php code -- 

On Friday 16 August 2002 08:02 pm, Ken Meyer wrote:
> I am trying to write a script that will read a page from another website.
> So long at the page is accessed via a "GET", this is no problem; I just
> need to open the page using fopen, readfile or file_get_contents. The
> problem is that I need to access a page that requires a "POST". Any
> suggestions as to how I could do this?
>
> Thanks.
>
> Ken

- -- 
~Paul Nicholson
Design Specialist @ WebPower Design
"The webthe way you want it!"
[EMAIL PROTECTED]

"It said uses Windows 98 or better, so I loaded Linux!"
Registered Linux User #183202 using Register Linux System # 81891
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.0.6 (GNU/Linux)
Comment: For info see http://www.gnupg.org

iD8DBQE9XbT7DyXNIUN3+UQRApOmAJ4zYjKW+WzoxuNmx8j2S87StyHT2ACdH+AQ
iDOX+hvxCFyFPb19knyBp8s=
=TvmX
-END PGP SIGNATURE-

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




Re: [PHP-DEV] Re: #18401 [Opn->Ana]: shuffle() broken (fwd)

2002-08-16 Thread Yasuo Ohgaki

Tim Converse wrote:
> --- Yasuo Ohgaki <[EMAIL PROTECTED]> wrote:
> 
>>Dan Kalowsky wrote:
>>
>>>Anyone able to confirm or deny the validity of this
>>
>>patch?
>>
>>>
>>>-- Forwarded message --
>>>
>>>[2002-07-18 01:03:51] [EMAIL PROTECTED]
>>>
>>>The shuffle() function in the CVS is (still) broken. It
>>
>>does not
>>
>>>correctly generate all possible combinations of the
>>
>>array. (I know this
>>
>>>function was recently updated, this test is with new
>>
>>version.)
>>
>>>Here is a diff to fix the problem:
>>>
>>>--- array.c  Thu Jul 18 00:50:54 2002
>>>+++ array.new.c  Thu Jul 18 00:49:35 2002
>>>@@ -1441,7 +1441,7 @@
>>> {
>>> Bucket **elems, *temp;
>>> HashTable *hash;
>>>-int j, n_elems, cur_elem = 0, rnd_idx, n_left;
>>>+int j, n_elems, rnd_idx, n_left;
>>>
>>> n_elems = zend_hash_num_elements(Z_ARRVAL_P(array));
>>>
>>>@@ -1457,13 +1457,12 @@
>>> elems[j++] = temp;
>>> while (--n_left) {
>>> rnd_idx = php_rand(TSRMLS_C);
>>>-RAND_RANGE(rnd_idx, cur_elem, n_left, PHP_RAND_MAX);
>>>-if (rnd_idx != cur_elem) {
>>>-temp = elems[cur_elem];
>>>-elems[cur_elem] = elems[rnd_idx];
>>>+RAND_RANGE(rnd_idx, 0, n_left, PHP_RAND_MAX);
>>>+if (rnd_idx != n_left) {
>>>+temp = elems[n_left];
>>>+elems[n_left] = elems[rnd_idx];
>>> elems[rnd_idx] = temp;
>>> }
>>>-cur_elem++;
>>> }
>>>
>>> HANDLE_BLOCK_INTERRUPTIONS();
>>>
>>
>>I've send the message to Dan, already.
>>Just posting php-dev again.
>>
>>Top elements have more chance than end elements.
>>All elements should have equal chance to be shuffled.
> 
> 
> Actually, I think the algorithm of the patched version is
> correct.  It's counterintuitive, but it doesn't matter how
> many times any slot has an element shuffled out of it. 

It may not be intuitive that the algorithm is not perfectly
correct. It may be enough for most purposes, though.

> What matters is the invariant that whenever elems[n_left]
> is set, it's being set to an element randomly chosen from
> the subset of elements that are left (including
> elems[n_left]), and also that elems[n_left] is not messed
> with thereafter. 

For example, if the last element isn't shuffled, it's stays
in as the last element since the last element has only 1 chance
to be shuffled.

Current code has tendency that last elements stay as
last.

i.e. Probability of the last element is shuffled is
   (total_num-1)/total_num.
while n th element to be shuffled is obviously has much
more chance than last elements. It may be acceptable
for most purposes.

> 
> You would think that the right thing to do is to set
> elems[n_left] to a random choice from _all_ the elements in
> the array, but this leads to some orderings being favored
> over others.  (Check out Intro. to Algo., Cormen, 2nd ed.,
> p 103)

elemes[n_left] to a random choice does not make sense, of course.

To give equal chances to be shuffled for all elements, we
can write something like

for (current=0; current < num_of_elems; current++) {
   random_index = rand();
   RAND_RANGE(random_index, 0, num_of_elems-1, PHP_RAND_MAX);
   if (array[current] != array[random_index])
 swap(array[current], array[random_index]);
}

Current code is almost ok, but this way is correct.
This does not require any additional overhead at all, also.

--
Yasuo Ohgaki


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




[PHP-DEV] Re: #3793 [Ana->Opn]: session.gc_maxlifetime does not work

2002-08-16 Thread Zeev Suraski

Just wondering - why are we even using atime?  I think lots of filesystems 
don't support it, but regardless of that - as far as I recall from reading 
the session code, if a session is opened for reading - it is also going to 
be rewritten at the end of the session.  So, it should be quite safe to 
check mtime instead of atime.
Comments?

Zeev

At 04:03 17/08/2002, [EMAIL PROTECTED] wrote:
>  ID:   3793
>  Updated by:   [EMAIL PROTECTED]
>  Reported By:  [EMAIL PROTECTED]
>-Status:   Analyzed
>+Status:   Open
>-Bug Type: Session related
>+Bug Type: Documentation problem
>  Operating System: Windows 98
>  PHP Version:  4 .1.2
>  New Comment:
>
>I really don't see anybody with any interest in writing code to make
>this work on FAT filesystems.  Don't run web servers on crap
>filesystems.  If you do, write your own session handler.  Same goes for
>filesystems where file modification timestamps are ignored.  Write your
>own session handler and manage the garbage collection yourself.  We'll
>need to document this, of course, so marking this as a documentation
>problem.
>
>
>Previous Comments:
>
>
>[2002-07-10 05:10:43] [EMAIL PROTECTED]
>
>I've exactly the same problem with Windows 2000, php 4.2.0 and apache
>1.3
>
>
>
>[2002-03-31 03:49:43] [EMAIL PROTECTED]
>
>After I tried about a week, by just setting the lifetime VERY high
>(4 first), maybe I can give a hint:
>
>With this very high value it worked, so I tried where exactly was the
>critical point. It was somewhat about 32000. Slightly below, all
>session files were deleted as described, slightly over not. But then
>the error reoccurred with the same value.
>
>After some tries I found out the following: I set back the time on the
>server one hour and it worked again. Here the times and the critical
>points:
>
>At 9:24 local time : 30290
>At 10:28 : 34100
>
>34100-30290=3810, which would be 63.5 minutes when interpretad as
>seconds, which is the server's time difference...
>
>Since 10:28 means 37680 s since 0:00, there seems to be an additional
>hour - maybe due to GMT setting (+1) I thought, but it was the
>automatic daylight saving (or is it called summer time???) setting.
>When turned off, at 9:45 the point was at 35100=9.75 hours...
>
>I hope that helps... ;-)
>
>-- mike
>
>
>
>[2002-03-31 02:56:29] [EMAIL PROTECTED]
>
>It seems it never worked under windows.
>Reopen
>
>
>
>[2002-03-31 02:43:13] [EMAIL PROTECTED]
>
>The reported errors are still in verson 4.1.2.
>
>System: w2k, CGI-version.
>
>
>
>[2001-12-16 07:24:47] [EMAIL PROTECTED]
>
>No feedback. Closing.
>
>
>
>The remainder of the comments for this report are too long. To view
>the rest of the comments, please view the bug report online at
> http://bugs.php.net/3793
>
>--
>Edit this bug report at http://bugs.php.net/?id=3793&edit=1


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




Re: [PHP-DEV] trans-sid warning?

2002-08-16 Thread Rasmus Lerdorf

> Edin Kadribasic wrote:
> >
> > > I absolutely agree with Stefan here. It is *not* PHP's job to
> > secure
> > > a connection. SSL does this.
> >
> > Like that's going to stop users from pasting url with SID in it to
> > an email, which is what this thread is about.
> >
> > Edin
>
> The issue is also that anyone can provide an URL wich can force  the
> creation of  any user-provided ID and, at_the_same_time, force the use
> of URL propagation instead of cookie propagation, on ANY cookie-enabled
> client.
>
> It is unconceivable that any user is given trust in supplying his
> 'unpredictable' session ID. At the moment only the (forthcoming?)
> session.use_only_cookies php.ini directive can block that.
>
> I know nothing can be secure 100%, but the fact that 'a horse with three
> legs can still walk' is no good reson not to shoot that leg (hey, I love
> horses, but this one is an enemy one...;-)

But any user can just as easily provide his own cookie with the session id
in it.  The simple move from the URL to a Set-Cookie header in the request
does not suddenly make it secure.

-Rasmus


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




[PHP-DEV] Unserialize Bug #17728 and Re: [PHP-DEV] Data Hiding Implementation in PHP Classes

2002-08-16 Thread Ben Dischinger

Thanks so much for your help Brad and Sander.  I've downloaded the 
newest Zend2 from cvs and compiled it into Php-4.3.0-dev.  All of the 
features of data hiding which I would need for this project look nicely 
implemented in this engine!

But now I'm running a bit of a dilemna.  I'm saving serialized objects 
in a database, but it seems as though the unserialize function is not 
liking the string that the function serialize outputs.  It results in a 
segmentation fault.  I did a gdb trace on it and looked at the 
zend_hash.c file for maybe a little bit of insight, but nothing jumped 
out at me as I'm not very familier with php's internal structure.  I've 
attached the trace and code below.

I've noticed a bug in the bug tracking system 
http://bugs.php.net/bug.php?id=17728, that looks related and unresolved. 
 Any help would be appreciated!

Thank you!

Ben Dischinger


Here is the code that produces the fault:
 /**
  * getObject - Returns the object associated with oid from the database
  **/
function getObject($oid){
  //Get Serialization String and unserialize it
  if($result = $this->getSingleResult("select serialization from 
phpflux_lang_object where oid=$oid")){
  $serial = $result['serialization'];
  echo $serial;
  return unserialize($serial);
  }
  return null;
}


Here is the gdb output:
Starting program: /usr/local/bin/php index.php
In fluxInclude(): $Class=phpflux.lang.*
In include_dir(): 
$dirStr=/home/disching/Projects/phpflux/classes/phpflux/lang/
In putObject():
In getSingleResult: $query=select serialization from phpflux_lang_object 
where oid=16
O:10:"testobject":9:{s:7:"package";s:12:"phpflux.lang";s:11:"objectoid";N;s:11:"objectuid";N;s:11:"objectgid";N;s:11:"objectmod";N;s:16:"objectcomments";N;s:1:"A";s:8:"Object
 
A";s:1:"B";s:8:"Object B";s:1:"C";s:8:"Object C";}
Program received signal SIGSEGV, Segmentation fault.
zend_hash_copy (target=0x400b9814, source=0x81d2b3c, 
pCopyConstructor=0x811d200 , tmp=0xbfffc048, size=4)
at /root/php4/Zend/zend_hash.c:777
777if (p->nKeyLength) {
(gdb) bt
#0  zend_hash_copy (target=0x400b9814, source=0x81d2b3c, 
pCopyConstructor=0x811d200 , tmp=0xbfffc048,
size=4) at /root/php4/Zend/zend_hash.c:777
#1  0x0811f2c9 in _object_and_properties_init (arg=0x400c75f8, 
class_type=0x81d2afc, properties=0x0)
at /root/php4/Zend/zend_API.c:600
#2  0x0811f307 in _object_init_ex (arg=0x400c75f8, class_type=0x81d2afc) 
at /root/php4/Zend/zend_API.c:610
#3  0x080de205 in php_var_unserialize (rval=0xbfffc214, p=0xbfffc1f8, 
max=0x400b99cb "", var_hash=0xbfffc1fc)
at var_unserializer.re:196
#4  0x080d74e9 in zif_unserialize (ht=1, return_value=0x400c75f8, 
this_ptr=0x0, return_value_used=1)
at /root/php4/ext/standard/var.c:667
#5  0x08130153 in execute (op_array=0x400b456c) at 
/root/php4/Zend/zend_execute.c:2079
#6  0x08130245 in execute (op_array=0x400aca14) at 
/root/php4/Zend/zend_execute.c:2103
#7  0x0811e304 in zend_execute_scripts (type=8, retval=0x0, 
file_count=3) at /root/php4/Zend/zend.c:832
#8  0x080fd169 in php_execute_script (primary_file=0xba80) at 
/root/php4/main/main.c:1504
#9  0x08136a60 in main (argc=2, argv=0xbb24) at 
/root/php4/sapi/cli/php_cli.c:683
#10 0x42017499 in __libc_start_main () from /lib/i686/libc.so.6



Brad LaFountain wrote:

>That .txt only talks about private members. Zend2 also implements protected
>data members.
>
> - brad
>--- Sander Roobol <[EMAIL PROTECTED]> wrote:
>
>>The Zend Engine 2 implements this. See http://www.php.net/ZEND_CHANGES.txt
>>
>>Sander
>>
>>On Fri, Aug 16, 2002 at 03:13:57AM -0500, Ben Dischinger wrote:
>>
>>>Hello,
>>>
>>>My question is if there is anyone working on an implementation of data
>>>
>>hiding in php? IE Public, private, and protected data types within php
>>classes.  I can not find anywhere mentioning this besides very few websites
>>that say it is on the "TODO" list.
>>
>>>The research that I'm doing involves dynamically programming php from the
>>>
>>internet collectively with many users, of which some would have restricted
>>access rights to specific objects.  All objects would have certain data that
>>I would need to be of type private, ie owner id, permission mode, etc...  in
>>order for the object security model to be safe.  Without data hiding any user
>>using this system could simply type $Current_User->UID=0  which would then
>>change the owner of this object, which happens to be a user to 0, or god. 
>>There may be a different way to implement this that I'm not seeing, but any
>>model that I come up with in php I can circumvent by some simular means.
>>
>>>I may need to implement a servlet in java that keeps track of currently
>>>
>>logged in users and objects in memory, but this would be more overhead than
>>wanted.  If data hiding was implemented in PHP I would be very excited.  If
>>there is not already someone working on it, perhaps I will roll up my sleeves
>>and get my elbows dirty.
>>
>>>Thank y

[PHP-DEV] Trying to input a webpage - need help

2002-08-16 Thread Ken Meyer

I am trying to write a script that will read a page from another website. So long at 
the page is accessed via a "GET", this is no problem; I just need to open the page 
using fopen, readfile or file_get_contents. The problem is that I need to access a 
page that requires a "POST". Any suggestions as to how I could do this?

Thanks.

Ken


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




Re: [PHP-DEV] Tru64, snprintf and bug #1298

2002-08-16 Thread Marcus Börger

First of all the internal replacement of snprintf fails if size is 1 or 0.
Second it is not C99 complient and third we do not include it the
right way. We would need to check if snprintf is available and if it is
C99 complient and if not use the replacement.

I had a lengthy discussion with the php group on that but i did
not get any answer at last. This might be the case because my
first worst assumptions were wrong for most systems.

In fact i could commit detection code and corect replacement code
but will do only when receiving a go from the group.

regards
marcus

At 23:31 16.08.2002, Dan Kalowsky wrote:
>Yes, that is correct, bug #1298 (it's existed for a LONG time).
>
>The user is having some difficulty compiling the Zend libraries for 4.2.2.
>Mainly it seems that snprintf is turning up as an unresolved symbol.
>I asked him to grep through the /usr/include looking for it, and the
>result was nothing.
>
>Looking through the code I see PHP has it's own snprintf implementation,
>and that should suffice.  Apparently zend_API.c though doesn't notice it.
>His fix was to place <#include "php.h"> inside the file, and everything
>worked fine.
>
>Does anyone have any more insight into this that they might be able to
>share?
>
> >---<
>Dan Kalowsky"A little less conversation,
>http://www.deadmime.org/~dank   a little more action."
>[EMAIL PROTECTED]   - "A Little Less Conversation",
>[EMAIL PROTECTED]Elvis Presley
>
>
>--
>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




[PHP-DEV] Tru64, snprintf and bug #1298

2002-08-16 Thread Dan Kalowsky

Yes, that is correct, bug #1298 (it's existed for a LONG time).

The user is having some difficulty compiling the Zend libraries for 4.2.2.
Mainly it seems that snprintf is turning up as an unresolved symbol.
I asked him to grep through the /usr/include looking for it, and the
result was nothing.

Looking through the code I see PHP has it's own snprintf implementation,
and that should suffice.  Apparently zend_API.c though doesn't notice it.
His fix was to place <#include "php.h"> inside the file, and everything
worked fine.

Does anyone have any more insight into this that they might be able to
share?

>---<
Dan Kalowsky"A little less conversation,
http://www.deadmime.org/~danka little more action."
[EMAIL PROTECTED]- "A Little Less Conversation",
[EMAIL PROTECTED]Elvis Presley


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




[PHP-DEV] Re: cvs: php4 / README.PARAMETER_PARSING_API

2002-08-16 Thread Andrei Zmievski

So, should we go ahead and change it to 'long' then? The existing code
would be affected of course..

On Thu, 04 Jul 2002, Yasuo Ohgaki wrote:
> It sounds like changing API (int -> long) is better to me.
> _zvalue_value.lval's type is long also.
> 
> --
> Yasuo Ohgaki
> 
> Sascha Schumann wrote:
> >sas  Wed Jul  3 14:36:50 2002 EDT
> >
> >  Modified files:  
> >/php4README.PARAMETER_PARSING_API 
> >  Log:
> >  Please note that you need to use 'int' as a length type when
> >  fetching strings.
> >  
> >  
> >Index: php4/README.PARAMETER_PARSING_API
> >diff -u php4/README.PARAMETER_PARSING_API:1.4 
> >php4/README.PARAMETER_PARSING_API:1.5
> >--- php4/README.PARAMETER_PARSING_API:1.4Wed Jul  3 10:01:18 2002
> >+++ php4/README.PARAMETER_PARSING_APIWed Jul  3 14:36:50 2002
> >@@ -105,7 +105,14 @@
> > /* Get either a set of 3 longs or a string. */
> > long l1, l2, l3;
> > char *s;
> >-long length;
> >+/* 
> >+ * The function expects a pointer to a integer in this case, not a long
> >+ * or any other type.  If you specify a type which is larger
> >+ * than a 'int', the upper bits might not be initialized
> >+ * properly, leading to random crashes on platforms like
> >+ * Tru64 or Linux/Alpha.
> >+ */
> >+int length;
> > 
> > if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS() 
> > TSRMLS_CC,
> >  "lll", &l1, &l2, 
> >  &l3) == SUCCESS) {
> >
> >
> 
> 



-Andrei   http://www.gravitonic.com/

 ever seen that movie? The Matrix?
 with those green lines of flying text?
 *THAT'S* Perl

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




[PHP-DEV] multipart/form-data bug [crossposted]

2002-08-16 Thread James E. Flemer

Sorry for the cross-post, but I don't know which side is
causing this bug, Apache or PHP.

OS: Solaris 8
Apache: 1.3.26
PHP: 4.2.2 (DSO)

By default, PHP sets "max_post_size" to 8Mb. If the post
data exceeds that, it seems PHP discards all of it (no post
data gets to the script). In my situation "upload_max_filesize"
was set higher than 8Mb (tho this may not have any effect
on the bug).

When a big (11Mb) file was posted with multipart/form-data,
PHP ignored all the data, but it seems part of the POST
data was *reparsed* by Apache! In the apache access logs it
shows the post, then the next request looks like this
(wrapped):

> 24.58.34.117 - - [16/Aug/2002:11:49:58 -0400]
> "-1103527590377401575662824084"
> 200 6568 "-" "-"

This seems to be caused since PHP stopped after reading the
HTTP header (ending in "Content-Length: 11993812\n\n"). The
next lines in the post were:

> 1103527590377401575662824084
> Content-Disposition: form-data; name="bar"
>
> [EMAIL PROTECTED]
> 1103527590377401575662824084
>  and so on until the tcp session was reset.

Does anyone see something odd here? :-) Enjoy. This does
not happen on FreeBSD/Apache-1.3.26/PHP-cvs.

But hey, I learned that a shortcut for "GET / HTTP/1.0\n\n"
is "-\n", and there are no headers to parse. :-)

-James


-- 
PHP Development Mailing List 
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] REPOST: Class Autoloading [PATCH]

2002-08-16 Thread phpsurf

sure, you can try with brad's script, removing his includes. this gives the
following files, all in the same directory:

Foo.php


MyFoo.php


index.php


when you call index.php, it crashes with the following error:

Fatal error:  Class myfoo:  Cannot inherit from undefined class foo
in c:\webroot\ze2\myfoo.php on line 2

I'm working with the 4.3.0 alpha with ZE2 released on 02/07/2002 on windows
2000 with apache 1.3.24

> -Original Message-
> From: Andi Gutmans [mailto:[EMAIL PROTECTED]]
> Sent: vendredi 16 août 2002 18:04
> To: phpsurf; Brad LaFountain; Ivan Ristic
> Cc: [EMAIL PROTECTED]; [EMAIL PROTECTED]
> Subject: [Zend Engine 2] RE: [PHP-DEV] Re: [Zend Engine 2] RE: [PHP-DEV]
> REPOST: Class Autoloading [PATCH]
>
>
> At 06:24 PM 8/7/2002 +0200, phpsurf wrote:
> >Hi
> >
> >I'm testing this great feature ...
> >but unfortunately, it lokos like it doesn't work for extended
> classes either
> >!
> >
> >in brad's example (in the history of this mail)
> >you cannot remove the include_once statements in the children classes (I
> >would rather replace them with the apropriate call to the __autoload
> >function)
> >
> >the class MyFoo extends Foo
> >when you try to instantiate Foo, __autoload works perfectly.
> >but when you try to instantiate MyFoo, it fails with the
> following message:
> >"Fatal error: Class myfoo: Cannot inherit from undefined class foo in
> >c:\webroot\ze2\myfoo.php on line 2"
> >
> >andi ? is it not supposed to work either with extended classes ?
>
> Can you please send me a very short script which reproduces your problem?
>
> Thanks,
>
> Andi
>
> > > -Original Message-
> > > From: Andi Gutmans [mailto:[EMAIL PROTECTED]]
> > > Sent: mercredi 26 juin 2002 21:02
> > > To: Brad LaFountain; Ivan Ristic; phpsurf
> > > Cc: [EMAIL PROTECTED]; [EMAIL PROTECTED]
> > > Subject: Re: [PHP-DEV] Re: [Zend Engine 2] RE: [PHP-DEV] REPOST: Class
> > > Autoloading [PATCH]
> > >
> > >
> > > Hey,
> > >
> > > What I meant was nested classes, my bad :)
> > > I meant it won't work for Foo::Bar::Barbara but only for class Foo.
> > >
> > > Andi
> > >
> > > At 11:56 AM 6/26/2002 -0700, Brad LaFountain wrote:
> > > > > - will never work for sub-classes so don't even ask!
> > > >
> > > >Andi,
> > > >
> > > >  This doesn't need to be an issue. The way that I use
> > > sub-classes is I ALWAYS
> > > >include_once("subclass.php"); at the top of each superclass
> file. I know
> > > >everyone doesn't code the same way but maybe you can have that
> > > as a suggestion
> > > >to people who use __autoload.
> > > >
> > > >Foo.php
> > > >class Foo{}
> > > >
> > > >Bar.php
> > > >class Bar{}
> > > >
> > > >MyFoo.php
> > > >include_once("Foo.php");
> > > >class MyFoo extends Foo{}
> > > >
> > > >MyBar.php
> > > >include_once("Bar.php");
> > > >class MyBar extends Bar{}
> > > >
> > > >
> > > >auto_test.php
> > > > > > >function __autoload($name) {
> > > >  include_once("$name.php");
> > > >}
> > > >$f = new MyFoo();
> > > >$b = new MyBar();
> > > >?>
> > > >
> > > >- brad
> > > > >
> > > > > At 11:27 PM 6/11/2002 +0100, Ivan Ristic wrote:
> > > > > > > Okay, I guess I can live with it :)
> > > > > > >
> > > > > > > Andi
> > > > > >
> > > > > >   Is there anyone else who would like to comment on the
> > > > > >   patch?
> > > > > >
> > > > > >   http://www.webkreator.com/download/class_autoload.patch
> > > > > >
> > > > > >   Or can we have it committed?
> > > > > >
> > > > > >--
> > > > > >Ivan Ristic, [EMAIL PROTECTED]
> > > > > >[ Weblog on PHP, Software development, Intranets,
> > > > > >and Knowledge Management: http://www.webkreator.com ]
> > > > > >
> > > > > >
> > > > > >--
> > > > > >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
> > > > >
> > > >
> > > >
> > > >__
> > > >Do You Yahoo!?
> > > >Yahoo! - Official partner of 2002 FIFA World Cup
> > > >http://fifaworldcup.yahoo.com
> > >
> > >
> > > --
> > > PHP Development Mailing List 
> > > To unsubscribe, visit: http://www.php.net/unsub.php
> > >
> >
> >
> >_
> _
> >i (france), c'est aussi une gamme complète de PC en exclusivité avec DELL
> >http://www.ifrance.com/_reloc/signedell
>


__
Pour mieux recevoir vos emails, utilisez un PC plus performant !
Découvrez la nouvelle gamme DELL en exclusivité sur i (france)
http://www.ifrance.com/_reloc/signedell


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




[PHP-DEV] PATCH: debug_backtrace() function for 4.3-dev/ZE1

2002-08-16 Thread Thies C. Arntzen


hi,

this patch adds the extremely useful debug_backtrace()
function to ZE1.  as it's more-or-less the same
implementation as in ZE2 so it should be "fast and efficient"
enough for inclusion in 4.3 IMHO.

it has one extra feature over the ZE2 implementation by
giving some extra information if a method was called
using :: or -> (see the 'type' attribute in the array
returned by debug_backtrace).

zeev, andi one question: i had to comment line 1628 (just
apply the patch and see for yourself) to make the following
code work correctly (= show the class in the backtrace):

dump();
?>

(just uncomment line 1628 in the patched sources and see how
the output of debug_backtrace doesn't show the class-name for
this script any more)

i don't think that commenting this line will have any
side-effect as EG(object).ptr will be re-initialized in 1665
and i don't see any references to it in between.

i'd love to have this included in 4.3.0 and i think a lot of
people would be happy as well.

implementation:
to make this whole thing work i simply added the class_entry
to the execute_data and am pushing and popping it together
with (object).ptr.

if this patch gets accepted i'll add an php.ini seting so
that errors and warnings will optionally have the full
call-stack.


comments are welcome - especially from andi & zeev.
tc

PS: patch is against -HEAD

-- 
Thies C. Arnzten   -   Looking for all sorts of freelance work  -   just ask..
Whishlist: http://www.amazon.de/exec/obidos/wishlist/AB9DY62QWDSZ/ref=wl_em_to


? ext/tca_prof
Index: Zend/zend_builtin_functions.c
===
RCS file: /repository/Zend/zend_builtin_functions.c,v
retrieving revision 1.118
diff -u -r1.118 zend_builtin_functions.c
--- Zend/zend_builtin_functions.c   12 Jun 2002 17:02:22 -  1.118
+++ Zend/zend_builtin_functions.c   16 Aug 2002 17:22:01 -
@@ -65,6 +65,7 @@
 static ZEND_FUNCTION(extension_loaded);
 static ZEND_FUNCTION(get_extension_funcs);
 static ZEND_FUNCTION(get_defined_constants);
+static ZEND_FUNCTION(debug_backtrace);
 #if ZEND_DEBUG
 static ZEND_FUNCTION(zend_test_func);
 #endif
@@ -116,6 +117,7 @@
ZEND_FE(extension_loaded,   NULL)
ZEND_FE(get_extension_funcs,NULL)
ZEND_FE(get_defined_constants,  NULL)
+   ZEND_FE(debug_backtrace,NULL)
 #if ZEND_DEBUG
ZEND_FE(zend_test_func, NULL)
 #endif
@@ -1133,6 +1135,69 @@
array_init(return_value);
zend_hash_apply_with_argument(EG(zend_constants), (apply_func_arg_t) 
add_constant_info, return_value TSRMLS_CC);
 }
+
+/* {{{ proto void debug_backtrace(void)
+   Prints out a backtrace */
+ZEND_FUNCTION(debug_backtrace)
+{
+   zend_execute_data *ptr;
+   int lineno;
+   char *function_name;
+   char *filename;
+   char *class_name;
+   zend_uint class_name_length;
+   zval *stack_frame;
+
+   ptr = EG(execute_data_ptr);
+
+   /* Skip debug_backtrace() itself */
+   ptr = ptr->prev_execute_data;
+   
+   array_init(return_value);
+
+   while (ptr) {
+   MAKE_STD_ZVAL(stack_frame);
+   array_init(stack_frame);
+
+
+/* if (ptr->object) {
+   class_name = Z_OBJCE(*ptr->object)->name;
+   class_name_length = Z_OBJCE(*ptr->object)->name_length;
+   }
+   if (ptr->function_state.function->common.scope) {
+   class_name = ptr->function_state.function->common.scope->name;
+   }
+*/
+   if (ptr->ce) {
+   add_assoc_string_ex(stack_frame, "type", sizeof("type"), "::", 
+1);
+   class_name = ptr->ce->name;
+   } else if (ptr->object.ptr) {
+   add_assoc_string_ex(stack_frame, "type", sizeof("type"), "->", 
+1);
+   class_name = ptr->object.ptr->value.obj.ce->name;
+
+   } else {
+   class_name = NULL;
+   }
+
+   function_name = ptr->function_state.function->common.function_name;
+   
+   filename = ptr->op_array->filename;
+   lineno = ptr->opline->lineno;
+
+   if (function_name) {
+   add_assoc_string_ex(stack_frame, "function", 
+sizeof("function"), function_name, 1);
+   }
+   if (class_name) {
+   add_assoc_string_ex(stack_frame, "class", sizeof("class"), 
+class_name, 1);
+   }
+   add_assoc_string_ex(stack_frame, "file", sizeof("file"), filename, 1);
+   add_assoc_long_ex(stack_frame, "line", sizeof("line"), lineno);
+   add_next_index_zval(return_value, stack_frame);
+
+   ptr = ptr->

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

2002-08-16 Thread Andi Gutmans

At 06:24 PM 8/7/2002 +0200, phpsurf wrote:
>Hi
>
>I'm testing this great feature ...
>but unfortunately, it lokos like it doesn't work for extended classes either
>!
>
>in brad's example (in the history of this mail)
>you cannot remove the include_once statements in the children classes (I
>would rather replace them with the apropriate call to the __autoload
>function)
>
>the class MyFoo extends Foo
>when you try to instantiate Foo, __autoload works perfectly.
>but when you try to instantiate MyFoo, it fails with the following message:
>"Fatal error: Class myfoo: Cannot inherit from undefined class foo in
>c:\webroot\ze2\myfoo.php on line 2"
>
>andi ? is it not supposed to work either with extended classes ?

Can you please send me a very short script which reproduces your problem?

Thanks,

Andi

> > -Original Message-
> > From: Andi Gutmans [mailto:[EMAIL PROTECTED]]
> > Sent: mercredi 26 juin 2002 21:02
> > To: Brad LaFountain; Ivan Ristic; phpsurf
> > Cc: [EMAIL PROTECTED]; [EMAIL PROTECTED]
> > Subject: Re: [PHP-DEV] Re: [Zend Engine 2] RE: [PHP-DEV] REPOST: Class
> > Autoloading [PATCH]
> >
> >
> > Hey,
> >
> > What I meant was nested classes, my bad :)
> > I meant it won't work for Foo::Bar::Barbara but only for class Foo.
> >
> > Andi
> >
> > At 11:56 AM 6/26/2002 -0700, Brad LaFountain wrote:
> > > > - will never work for sub-classes so don't even ask!
> > >
> > >Andi,
> > >
> > >  This doesn't need to be an issue. The way that I use
> > sub-classes is I ALWAYS
> > >include_once("subclass.php"); at the top of each superclass file. I know
> > >everyone doesn't code the same way but maybe you can have that
> > as a suggestion
> > >to people who use __autoload.
> > >
> > >Foo.php
> > >class Foo{}
> > >
> > >Bar.php
> > >class Bar{}
> > >
> > >MyFoo.php
> > >include_once("Foo.php");
> > >class MyFoo extends Foo{}
> > >
> > >MyBar.php
> > >include_once("Bar.php");
> > >class MyBar extends Bar{}
> > >
> > >
> > >auto_test.php
> > > > >function __autoload($name) {
> > >  include_once("$name.php");
> > >}
> > >$f = new MyFoo();
> > >$b = new MyBar();
> > >?>
> > >
> > >- brad
> > > >
> > > > At 11:27 PM 6/11/2002 +0100, Ivan Ristic wrote:
> > > > > > Okay, I guess I can live with it :)
> > > > > >
> > > > > > Andi
> > > > >
> > > > >   Is there anyone else who would like to comment on the
> > > > >   patch?
> > > > >
> > > > >   http://www.webkreator.com/download/class_autoload.patch
> > > > >
> > > > >   Or can we have it committed?
> > > > >
> > > > >--
> > > > >Ivan Ristic, [EMAIL PROTECTED]
> > > > >[ Weblog on PHP, Software development, Intranets,
> > > > >and Knowledge Management: http://www.webkreator.com ]
> > > > >
> > > > >
> > > > >--
> > > > >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
> > > >
> > >
> > >
> > >__
> > >Do You Yahoo!?
> > >Yahoo! - Official partner of 2002 FIFA World Cup
> > >http://fifaworldcup.yahoo.com
> >
> >
> > --
> > PHP Development Mailing List 
> > To unsubscribe, visit: http://www.php.net/unsub.php
> >
>
>
>__
>i (france), c'est aussi une gamme complète de PC en exclusivité avec DELL
>http://www.ifrance.com/_reloc/signedell


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




Re: [PHP-DEV] ZE2 and PHP

2002-08-16 Thread Zeev Suraski

At 18:26 16/08/2002, Dan Hardiker wrote:
> >>2. When is it expected to be available in a development (experimental)
> >> or production release?
> >
> > It already is - go to www.php.net, and search for 'alpha'.
> > 
> http://www.php.net/do_download.php?download_file=php-4.3.0-dev-zend2-alpha2.tar.gz
>
>Forgive me for my ignorance... but does that mean PHP-4.3.0 release will
>have a stable ZE2 version as well as the standard ZE1 one?

No, not at all.  It's just a (then) current snapshot of PHP, with the new 
engine.  PHP 4.x is based on ZE1.

Zeev


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




Re: [PHP-DEV] ZE2 and PHP

2002-08-16 Thread Dan Hardiker

>>2. When is it expected to be available in a development (experimental)
>> or production release?
>
> It already is - go to www.php.net, and search for 'alpha'.
> http://www.php.net/do_download.php?download_file=php-4.3.0-dev-zend2-alpha2.tar.gz

Forgive me for my ignorance... but does that mean PHP-4.3.0 release will
have a stable ZE2 version as well as the standard ZE1 one?


-- 
Dan Hardiker [[EMAIL PROTECTED]]
ADAM Software & Systems Engineer
First Creative Ltd



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




Re: [PHP-DEV] objects as string and arrays as string

2002-08-16 Thread Brad LaFountain

I went back and read the lists about why people don't like __to_string() or
__string_value() method.

the arguments were the differences in when
convert_to_string vs zend_make_printable_zval were called differently.

I believe andi isn't against it but wants it implemented good and zeev was all
for it.

I think it should be implemented, Like I said before its not that creating your
own "stringify" and calling it is being lazy. Sometimes when debugging you
don't necesarrly know what "Object" you are printing out.. say because of
nested objects.

The issues that were brought up were it would't be consisitant becuase of echo
$obj; or $p = (string)$obj; I think that everytime it should be used in the
context of a string the method should be called. Not when you use var_dump.
var_dump means you want to dump the contents of the variable (object in this
case). You don't want to convert it to a string.

$p = (string)$obj; // will call method
$p .= $obj; // will call method
var_dump($obj); // wont call method
$p = $obj . "\n"; // will call method
$p = "$obj\n"; // will call method

The other consern was recursive nature that could be introduced. As mentioned
in the other posts you could either require to return a string or try and
handle the recursion (maybe like var_dump currently does it).

 -brad


--- Brad LaFountain <[EMAIL PROTECTED]> wrote:
> I want to throw together a quick hack so that objects can implement a
> __as_string() method that will get called when the string is used in a string
> contex. Instead of append "Object".
> 
> $s = (string)$object;
>  or
> $s .= $object;
> 
> also the same things with arrays that will do something similar to
> $s = implode(" ", $array);
> 
> $s = (string)$array;
> $s = $array . "\n";
> 
> Before anyone jumps on this and says no way cause it easy to implemnt your
> own
> __to_string() and call it when you want it or what is wrong with implode(" ",
> $array). Think of exactly how usefull is appending the word "Array" or
> "Object".
> 
>  Thoughts?
> 
>  - brad
> 
> __
> Do You Yahoo!?
> HotJobs - Search Thousands of New Jobs
> http://www.hotjobs.com
> 
> -- 
> PHP Development Mailing List 
> To unsubscribe, visit: http://www.php.net/unsub.php
> 


__
Do You Yahoo!?
HotJobs - Search Thousands of New Jobs
http://www.hotjobs.com

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




Re: [PHP-DEV] ZE2 and PHP

2002-08-16 Thread Zeev Suraski

At 17:43 16/08/2002, Brad LaFountain wrote:

>--- Zeev Suraski <[EMAIL PROTECTED]> wrote:
> > At 14:21 16/08/2002, Dan Hardiker wrote:
> > >Hi,
> > >
> > >As php user's requests are getting closer and closer to what ZE2 is
> > >offering (eg: back tracing, private/protected classes, extra inheritance
> > >functionality, etc) ...
> > >
> > >1. When is ZE2 expected to be released (if its not already)
> >
> > My guess is early 2002.  A zillion things may affect that release date,
> > though, so it really is just a guess.
>
>  Don't you mean 2003?

Yeah.  Waiting for 12002 would be too long...

Zeev


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




[PHP-DEV] Gathering library thread safety info

2002-08-16 Thread Rasmus Lerdorf

Folks, I started a table here:

http://httpd.apache.org/docs-2.0/developer/thread_safety.html

To try to get started down the bumpy road of figuring out which PHP
extensions are likely to be thread unsafe based on their usage of thread
unsafe libraries.

Please help out by either adding more libraries to the list (even if you
don't know if they are thread safe or not, get them in there so someone
else will fill in the data) or by providing info about an existing entry.

If you have commit access to Apache 2, you can modify the file yourself
at:

httpd-2.0/docs/manual/developer/thread_safety.html

If you don't have commit access, send your info to [EMAIL PROTECTED] or
directly to me if you want.

By the way, I did this at the Apache level because I am trying to get this
to be more of a cross-project effort.

-Rasmus


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




Re: [PHP-DEV] ZE2 and PHP

2002-08-16 Thread Brad LaFountain


--- Zeev Suraski <[EMAIL PROTECTED]> wrote:
> At 14:21 16/08/2002, Dan Hardiker wrote:
> >Hi,
> >
> >As php user's requests are getting closer and closer to what ZE2 is
> >offering (eg: back tracing, private/protected classes, extra inheritance
> >functionality, etc) ...
> >
> >1. When is ZE2 expected to be released (if its not already)
> 
> My guess is early 2002.  A zillion things may affect that release date, 
> though, so it really is just a guess.

 Don't you mean 2003?

 - brad


__
Do You Yahoo!?
HotJobs - Search Thousands of New Jobs
http://www.hotjobs.com

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




Re: [PHP-DEV] ZE2 and PHP

2002-08-16 Thread Zeev Suraski

At 14:21 16/08/2002, Dan Hardiker wrote:
>Hi,
>
>As php user's requests are getting closer and closer to what ZE2 is
>offering (eg: back tracing, private/protected classes, extra inheritance
>functionality, etc) ...
>
>1. When is ZE2 expected to be released (if its not already)

My guess is early 2002.  A zillion things may affect that release date, 
though, so it really is just a guess.

>2. When is it expected to be available in a development (experimental) or
>production release?

It already is - go to www.php.net, and search for 
'alpha'. 
http://www.php.net/do_download.php?download_file=php-4.3.0-dev-zend2-alpha2.tar.gz

Zeev


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




Re: [PHP-DEV] objects as string and arrays as string

2002-08-16 Thread Jason T. Greene

stratification = stringification
(damn spellchecker)

On Fri, 2002-08-16 at 09:30, Jason T. Greene wrote:
> Perl has this (it's called "stratification"), and it is quite useful.
> One example is that you have an error object that contains various
> properties (line location, error class, error level, error code, etc).
> And on evaluating the object as a string, it dumps it as an easy to read
> error message.
> 
> -Jason
> 
> 
> 
> On Fri, 2002-08-16 at 08:52, Brad LaFountain wrote:
> > I want to throw together a quick hack so that objects can implement a
> > __as_string() method that will get called when the string is used in a string
> > contex. Instead of append "Object".
> > 
> > $s = (string)$object;
> >  or
> > $s .= $object;
> > 
> > also the same things with arrays that will do something similar to
> > $s = implode(" ", $array);
> > 
> > $s = (string)$array;
> > $s = $array . "\n";
> > 
> > Before anyone jumps on this and says no way cause it easy to implemnt your own
> > __to_string() and call it when you want it or what is wrong with implode(" ",
> > $array). Think of exactly how usefull is appending the word "Array" or
> > "Object".
> > 
> >  Thoughts?
> > 
> >  - brad
> > 
> > __
> > Do You Yahoo!?
> > HotJobs - Search Thousands of New Jobs
> > http://www.hotjobs.com
> > 
> > -- 
> > 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
> 



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




Re: [PHP-DEV] objects as string and arrays as string

2002-08-16 Thread Jason T. Greene

Perl has this (it's called "stratification"), and it is quite useful.
One example is that you have an error object that contains various
properties (line location, error class, error level, error code, etc).
And on evaluating the object as a string, it dumps it as an easy to read
error message.

-Jason



On Fri, 2002-08-16 at 08:52, Brad LaFountain wrote:
> I want to throw together a quick hack so that objects can implement a
> __as_string() method that will get called when the string is used in a string
> contex. Instead of append "Object".
> 
> $s = (string)$object;
>  or
> $s .= $object;
> 
> also the same things with arrays that will do something similar to
> $s = implode(" ", $array);
> 
> $s = (string)$array;
> $s = $array . "\n";
> 
> Before anyone jumps on this and says no way cause it easy to implemnt your own
> __to_string() and call it when you want it or what is wrong with implode(" ",
> $array). Think of exactly how usefull is appending the word "Array" or
> "Object".
> 
>  Thoughts?
> 
>  - brad
> 
> __
> Do You Yahoo!?
> HotJobs - Search Thousands of New Jobs
> http://www.hotjobs.com
> 
> -- 
> 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] objects as string and arrays as string

2002-08-16 Thread Marcus Börger

At 15:52 16.08.2002, Brad LaFountain wrote:
>I want to throw together a quick hack so that objects can implement a
>__as_string() method that will get called when the string is used in a string
>contex. Instead of append "Object".
>
>$s = (string)$object;
>  or
>$s .= $object;
>
>also the same things with arrays that will do something similar to
>$s = implode(" ", $array);
>
>$s = (string)$array;
>$s = $array . "\n";
>
>Before anyone jumps on this and says no way cause it easy to implemnt your own
>__to_string() and call it when you want it or what is wrong with implode(" ",
>$array). Think of exactly how usefull is appending the word "Array" or
>"Object".
>
>  Thoughts?


Nice to have...

marcus


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




[PHP-DEV] objects as string and arrays as string

2002-08-16 Thread Brad LaFountain

I want to throw together a quick hack so that objects can implement a
__as_string() method that will get called when the string is used in a string
contex. Instead of append "Object".

$s = (string)$object;
 or
$s .= $object;

also the same things with arrays that will do something similar to
$s = implode(" ", $array);

$s = (string)$array;
$s = $array . "\n";

Before anyone jumps on this and says no way cause it easy to implemnt your own
__to_string() and call it when you want it or what is wrong with implode(" ",
$array). Think of exactly how usefull is appending the word "Array" or
"Object".

 Thoughts?

 - brad

__
Do You Yahoo!?
HotJobs - Search Thousands of New Jobs
http://www.hotjobs.com

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




Re: [PHP-DEV] Build warnings on OSX in sockets

2002-08-16 Thread Jason T. Greene

All of the warning messages you list, with the exception of the last, is
specific to the readmsg() sendmsg() code which uses msghdr's (A messgae
header has all void * members).  They should not cause any problems, but
I will clean them up.

The last message is referring to a buffer that is used in the case that
you are running windows, or your platform does not support hsterror(). I
can clean that up as well

-Jason



On Thu, 2002-08-15 at 10:37, Dan Kalowsky wrote:
> Haven't noticed this before, so I'm guessing this isn't a good thing.
> 
> /Users/dank/Development/php4-cvs/ext/sockets/sockets.c: In function
> `zif_socket_recvmsg'
> /Users/dank/Development/php4-cvs/ext/sockets/sockets.c:1524: warning:
> assignment from incompatible pointer type
> /Users/dank/Development/php4-cvs/ext/sockets/sockets.c:1529: warning:
> assignment from incompatible pointer type
> /Users/dank/Development/php4-cvs/ext/sockets/sockets.c:1578: warning:
> assignment from incompatible pointer type
> /Users/dank/Development/php4-cvs/ext/sockets/sockets.c:1584: warning:
> assignment from incompatible pointer type
> /Users/dank/Development/php4-cvs/ext/sockets/sockets.c: In function
> `zif_socket_sendmsg':
> /Users/dank/Development/php4-cvs/ext/sockets/sockets.c:1670: warning:
> assignment from incompatible pointer type
> /Users/dank/Development/php4-cvs/ext/sockets/sockets.c:1698: warning:
> assignment from incompatible pointer type
> /Users/dank/Development/php4-cvs/ext/sockets/sockets.c: At top level:
> /Users/dank/Development/php4-cvs/ext/sockets/sockets.c:115: warning:
> `php_strerror_buf' defined but not used
> 
> >---<
> Dan Kalowsky  "A little less conversation,
> http://www.deadmime.org/~dank  a little more action."
> [EMAIL PROTECTED]  - "A Little Less Conversation",
> [EMAIL PROTECTED]  Elvis Presley
> 
> 
> 
> -- 
> 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] Data Hiding Implementation in PHP Classes

2002-08-16 Thread Marcus Börger

We also have public as an alias for variable.

marcus

At 15:09 16.08.2002, Brad LaFountain wrote:
>That .txt only talks about private members. Zend2 also implements protected
>data members.
>
>  - brad
>--- Sander Roobol <[EMAIL PROTECTED]> wrote:
> > The Zend Engine 2 implements this. See http://www.php.net/ZEND_CHANGES.txt
> >
> > Sander
> >
> > On Fri, Aug 16, 2002 at 03:13:57AM -0500, Ben Dischinger wrote:
> > > Hello,
> > >
> > > My question is if there is anyone working on an implementation of data
> > hiding in php? IE Public, private, and protected data types within php
> > classes.  I can not find anywhere mentioning this besides very few websites
> > that say it is on the "TODO" list.
> > >
> > > The research that I'm doing involves dynamically programming php from the
> > internet collectively with many users, of which some would have restricted
> > access rights to specific objects.  All objects would have certain data 
> that
> > I would need to be of type private, ie owner id, permission mode, 
> etc...  in
> > order for the object security model to be safe.  Without data hiding 
> any user
> > using this system could simply type $Current_User->UID=0  which would then
> > change the owner of this object, which happens to be a user to 0, or god.
> > There may be a different way to implement this that I'm not seeing, but any
> > model that I come up with in php I can circumvent by some simular means.
> > >
> > > I may need to implement a servlet in java that keeps track of currently
> > logged in users and objects in memory, but this would be more overhead than
> > wanted.  If data hiding was implemented in PHP I would be very excited.  If
> > there is not already someone working on it, perhaps I will roll up my 
> sleeves
> > and get my elbows dirty.
> > >
> > > Thank you so much for reading.
> > >
> > > Ben Dischinger
> > > NDSU Computer Science
> >
> > --
> > PHP Development Mailing List 
> > To unsubscribe, visit: http://www.php.net/unsub.php
> >
>
>
>__
>Do You Yahoo!?
>HotJobs - Search Thousands of New Jobs
>http://www.hotjobs.com
>
>--
>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] Data Hiding Implementation in PHP Classes

2002-08-16 Thread Brad LaFountain

That .txt only talks about private members. Zend2 also implements protected
data members.

 - brad
--- Sander Roobol <[EMAIL PROTECTED]> wrote:
> The Zend Engine 2 implements this. See http://www.php.net/ZEND_CHANGES.txt
> 
> Sander
> 
> On Fri, Aug 16, 2002 at 03:13:57AM -0500, Ben Dischinger wrote:
> > Hello,
> > 
> > My question is if there is anyone working on an implementation of data
> hiding in php? IE Public, private, and protected data types within php
> classes.  I can not find anywhere mentioning this besides very few websites
> that say it is on the "TODO" list.
> > 
> > The research that I'm doing involves dynamically programming php from the
> internet collectively with many users, of which some would have restricted
> access rights to specific objects.  All objects would have certain data that
> I would need to be of type private, ie owner id, permission mode, etc...  in
> order for the object security model to be safe.  Without data hiding any user
> using this system could simply type $Current_User->UID=0  which would then
> change the owner of this object, which happens to be a user to 0, or god. 
> There may be a different way to implement this that I'm not seeing, but any
> model that I come up with in php I can circumvent by some simular means.
> > 
> > I may need to implement a servlet in java that keeps track of currently
> logged in users and objects in memory, but this would be more overhead than
> wanted.  If data hiding was implemented in PHP I would be very excited.  If
> there is not already someone working on it, perhaps I will roll up my sleeves
> and get my elbows dirty.
> > 
> > Thank you so much for reading.
> > 
> > Ben Dischinger
> > NDSU Computer Science
> 
> -- 
> PHP Development Mailing List 
> To unsubscribe, visit: http://www.php.net/unsub.php
> 


__
Do You Yahoo!?
HotJobs - Search Thousands of New Jobs
http://www.hotjobs.com

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




[PHP-DEV] ZE2 and PHP

2002-08-16 Thread Dan Hardiker

Hi,

As php user's requests are getting closer and closer to what ZE2 is
offering (eg: back tracing, private/protected classes, extra inheritance
functionality, etc) ...

1. When is ZE2 expected to be released (if its not already)
2. When is it expected to be available in a development (experimental) or
production release?

Any ideas?


-- 
Dan Hardiker [[EMAIL PROTECTED]]
ADAM Software & Systems Engineer
First Creative Ltd



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




Re: [PHP-DEV] trans-sid warning?

2002-08-16 Thread Giancarlo Pinerolo

Edin Kadribasic wrote:
> 
> > I absolutely agree with Stefan here. It is *not* PHP's job to
> secure
> > a connection. SSL does this.
> 
> Like that's going to stop users from pasting url with SID in it to
> an email, which is what this thread is about.
> 
> Edin

The issue is also that anyone can provide an URL wich can force  the
creation of  any user-provided ID and, at_the_same_time, force the use
of URL propagation instead of cookie propagation, on ANY cookie-enabled
client.

It is unconceivable that any user is given trust in supplying his
'unpredictable' session ID. At the moment only the (forthcoming?)
session.use_only_cookies php.ini directive can block that.

I know nothing can be secure 100%, but the fact that 'a horse with three
legs can still walk' is no good reson not to shoot that leg (hey, I love
horses, but this one is an enemy one...;-)

Giancarlo

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




[PHP-DEV] domxml updates

2002-08-16 Thread Christian Stocker

Hi

I fixed almost all reported bugs for domxml and made some more W3C
compliant, therefore some stuff changed the behaviour (slightly). It
shouldn't break BC for most of the scripts, but i can't make happy both
camps (BC and W3C compliance), and i prefer W3C compliance.

I would be very glad, if people who rely on domxml could test the changes
I made and report problems/bugs/memleaks/segfaults...

chregu




-- 
christian stocker | bitflux GmbH | schöneggstrasse 5 | ch-8004 zurich
phone +41 1 240 56 70 | mobile +41 76 561 88 60 | fax +41 1 240 56 71
http://www.bitflux.ch  |  [EMAIL PROTECTED]  | gnupg-keyid 0x5CE1DECB




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




Re: [PHP-DEV] Data Hiding Implementation in PHP Classes

2002-08-16 Thread Sander Roobol

The Zend Engine 2 implements this. See http://www.php.net/ZEND_CHANGES.txt

Sander

On Fri, Aug 16, 2002 at 03:13:57AM -0500, Ben Dischinger wrote:
> Hello,
> 
> My question is if there is anyone working on an implementation of data hiding in 
>php? IE Public, private, and protected data types within php classes.  I can not find 
>anywhere mentioning this besides very few websites that say it is on the "TODO" list.
> 
> The research that I'm doing involves dynamically programming php from the internet 
>collectively with many users, of which some would have restricted access rights to 
>specific objects.  All objects would have certain data that I would need to be of 
>type private, ie owner id, permission mode, etc...  in order for the object security 
>model to be safe.  Without data hiding any user using this system could simply type 
>$Current_User->UID=0  which would then change the owner of this object, which happens 
>to be a user to 0, or god.  There may be a different way to implement this that I'm 
>not seeing, but any model that I come up with in php I can circumvent by some simular 
>means.
> 
> I may need to implement a servlet in java that keeps track of currently logged in 
>users and objects in memory, but this would be more overhead than wanted.  If data 
>hiding was implemented in PHP I would be very excited.  If there is not already 
>someone working on it, perhaps I will roll up my sleeves and get my elbows dirty.
> 
> Thank you so much for reading.
> 
> Ben Dischinger
> NDSU Computer Science

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




[PHP-DEV] Data Hiding Implementation in PHP Classes

2002-08-16 Thread Ben Dischinger

Hello,

My question is if there is anyone working on an implementation of data hiding in php? 
IE Public, private, and protected data types within php classes.  I can not find 
anywhere mentioning this besides very few websites that say it is on the "TODO" list.

The research that I'm doing involves dynamically programming php from the internet 
collectively with many users, of which some would have restricted access rights to 
specific objects.  All objects would have certain data that I would need to be of type 
private, ie owner id, permission mode, etc...  in order for the object security model 
to be safe.  Without data hiding any user using this system could simply type 
$Current_User->UID=0  which would then change the owner of this object, which happens 
to be a user to 0, or god.  There may be a different way to implement this that I'm 
not seeing, but any model that I come up with in php I can circumvent by some simular 
means.

I may need to implement a servlet in java that keeps track of currently logged in 
users and objects in memory, but this would be more overhead than wanted.  If data 
hiding was implemented in PHP I would be very excited.  If there is not already 
someone working on it, perhaps I will roll up my sleeves and get my elbows dirty.

Thank you so much for reading.

Ben Dischinger
NDSU Computer Science



Re: [PHP-DEV] Re: #18401 [Opn->Ana]: shuffle() broken (fwd)

2002-08-16 Thread Tim Converse

--- Yasuo Ohgaki <[EMAIL PROTECTED]> wrote:
> Dan Kalowsky wrote:
> > Anyone able to confirm or deny the validity of this
> patch?
> > 
> > 
> > -- Forwarded message --
> > 
> > [2002-07-18 01:03:51] [EMAIL PROTECTED]
> > 
> > The shuffle() function in the CVS is (still) broken. It
> does not
> > correctly generate all possible combinations of the
> array. (I know this
> > function was recently updated, this test is with new
> version.)
> > 
> > Here is a diff to fix the problem:
> > 
> > --- array.c Thu Jul 18 00:50:54 2002
> > +++ array.new.c Thu Jul 18 00:49:35 2002
> > @@ -1441,7 +1441,7 @@
> >  {
> > Bucket **elems, *temp;
> > HashTable *hash;
> > -   int j, n_elems, cur_elem = 0, rnd_idx, n_left;
> > +   int j, n_elems, rnd_idx, n_left;
> > 
> > n_elems = zend_hash_num_elements(Z_ARRVAL_P(array));
> > 
> > @@ -1457,13 +1457,12 @@
> > elems[j++] = temp;
> > while (--n_left) {
> > rnd_idx = php_rand(TSRMLS_C);
> > -   RAND_RANGE(rnd_idx, cur_elem, n_left, PHP_RAND_MAX);
> > -   if (rnd_idx != cur_elem) {
> > -   temp = elems[cur_elem];
> > -   elems[cur_elem] = elems[rnd_idx];
> > +   RAND_RANGE(rnd_idx, 0, n_left, PHP_RAND_MAX);
> > +   if (rnd_idx != n_left) {
> > +   temp = elems[n_left];
> > +   elems[n_left] = elems[rnd_idx];
> > elems[rnd_idx] = temp;
> > }
> > -   cur_elem++;
> > }
> > 
> > HANDLE_BLOCK_INTERRUPTIONS();
> > 
> 
> I've send the message to Dan, already.
> Just posting php-dev again.
> 
> Top elements have more chance than end elements.
> All elements should have equal chance to be shuffled.

Actually, I think the algorithm of the patched version is
correct.  It's counterintuitive, but it doesn't matter how
many times any slot has an element shuffled out of it. 
What matters is the invariant that whenever elems[n_left]
is set, it's being set to an element randomly chosen from
the subset of elements that are left (including
elems[n_left]), and also that elems[n_left] is not messed
with thereafter. 

You would think that the right thing to do is to set
elems[n_left] to a random choice from _all_ the elements in
the array, but this leads to some orderings being favored
over others.  (Check out Intro. to Algo., Cormen, 2nd ed.,
p 103)

--tim



__
Do You Yahoo!?
HotJobs - Search Thousands of New Jobs
http://www.hotjobs.com

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




Re: [PHP-DEV] PHP extension initialisation

2002-08-16 Thread Pete Dishman

Hi,

I asked about this a few weeks ago with apache on windows.

The best answer I got was from George Schlossnagle:

I believe this is because when apache does it's intial configtest run
as
part of start (to validate it's config), it has to do a complete startup
(otherwise it wouldn't know about conf params used by modules loaded as
DSOs.  So you see a startup; shutdown; startup.

that's exactly what I saw happen so seeing as shutdown occurs as well it
wasn't a problem in my case.


Pete

--
"Tom Oram" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
On Thu, 15 Aug 2002, you wrote:
> --- Tom Oram <[EMAIL PROTECTED]> wrote:
>> Hi,
>> Can someone please answer my question?
>>
>> When running a PHP extension when PHP is running as an apache module on
linux
>> it's module init function (PHP_MINIT_FUNCTION) gets called twice, once
before
>> apache forks then once after, is there any way of finding out which
>> init you are in. I can't keep a global variable because it get losted in
>> between init calls, and environment vars/file locks/shared mem/semephores
are
>> not options.
>
> Are you on Windows IIS? I believe someone recently just asked about that
same
> thing. There was a valid explination for it.

No linux, I did say ;), but thanks anyway.
The question still stands open, anyone?

>> One other quicky, is there a way to find out inside the extension if it
is
>> being run from with an apache module or its it a standalone executable
(or
>> running under a different webserver as my module can only ever run with
>> apache)?
>
> I believe you could
> #include "SAPI.h"
>
> if(!strcmp(sapi_module.name, "cgi") || strcmp(sapi_module.name, "cli")) {
>   printf("compiled as a command line executable");
> }

This is probably what I need thanks

>>
>> Thanks for your time,
>> Tom
>>
>> --
>>
>> ***
>> Tom Oram
>> SCL Computer Services
>> URL http://www.scl.co.uk/
>> ***
>>
>> --
>> PHP Development Mailing List 
>> To unsubscribe, visit: http://www.php.net/unsub.php
>>
>
>
> __
> Do You Yahoo!?
> HotJobs - Search Thousands of New Jobs
> http://www.hotjobs.com
--

***
Tom Oram
SCL Computer Services
URL http://www.scl.co.uk/
***



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




Re: [PHP-DEV] Hiding the remote server

2002-08-16 Thread Matthew Walker

The tool you're looking for is 'curl'. Look it up in PHP's docs.

Michael said:
> Is it possible to write a script that:
> 1) gathers information
> 2) upon clicking a "submit" button, "posts" this information to a remote
> server for processing. 3) the remote server, by default, will generate
> results and display on it's own web page generated dynamically. 4) can we
> "intercept" this response back to the browser, parse through the
> information and generate our own presentation of the page on our site?
>
> Example:
> http://www.siteA.com/change_password_script (I don't know what kind of
> scripting this is, but it is dynamic) Site A has this interface that takes
> in the username, old password, and new password. If we change the password
> at Site A, we would be brought back that same page with a result
> displayed.
>
> What I need is:
> http://www.mysite.com/my_change_password_script.php?action=change-password
> Present my own look and feel.
> Collect the same information (username, old password, new password), and
> send to: http://www.siteA.com/change_password_script
>
> The challenge is that we don't want the url of Site A appearing at any one
> moment. So we need to get responses from the remote server, parse through
> for results, and display this information:
> http://www.mysite.com/my_change_password_script.php?result=success
>
> Is this possible at all with just PHP scripting?
> I am just guessing can the header() function be used to send
> information like a form-POST? and receive responses that is parsable prior
> to printing to the browser?




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