[PHP-DEV] Reflection Memory leak fix

2004-03-28 Thread Timm Friebe
Hi,
this fixes a memory leak in Reflection_Property::getModifiers().

- Timm
Index: Zend/zend_reflection_api.c
===
RCS file: /repository/ZendEngine2/zend_reflection_api.c,v
retrieving revision 1.94
diff -u -r1.94 zend_reflection_api.c
--- Zend/zend_reflection_api.c	9 Mar 2004 16:38:34 -	1.94
+++ Zend/zend_reflection_api.c	28 Mar 2004 13:46:07 -
@@ -2702,8 +2702,6 @@
 	METHOD_NOTSTATIC_NUMPARAMS(0);
 	GET_REFLECTION_OBJECT_PTR(ref);
 
-	array_init(return_value);
-
 	RETURN_LONG(ref-prop-flags);
 }
 /* }}} */

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

[PHP-DEV] Bus error w/ __PHP_Incomplete_Class

2004-03-28 Thread Timm Friebe
Hi,
accessing a non-existant member of (or calling a member function on) an
instance of __PHP_Incomplete_Class results in a bus error:

[EMAIL PROTECTED]:~/devel/php/php  cat incomplete_class.php
?php
  $o= unserialize('O:1:a:1:{s:5:value;s:3:100;}');
  var_dump($o);
  var_dump($o-member);
?
[EMAIL PROTECTED]:~/devel/php/php  php-dev incomplete_class.php 
object(__PHP_Incomplete_Class)#1 (2) {
  [__PHP_Incomplete_Class_Name]=
  string(1) a
  [value]=
  string(3) 100
}
Bus error (core dumped)

Expected output: a return value of NULL for access to a non-existant
member and E_ERROR for trying to invoke a member function.

-- gdb output --
Program received signal SIGBUS, Bus error.
0x828401b in zend_mm_create_new_free_block (heap=0x83b0cc8,
mm_block=0x8639004, 
true_size=96) at /usr/home/thekid/devel/php/php/Zend/zend_mm.c:210
210 zend_mm_add_to_free_list(heap, new_free_block);

Backtrace ends in an endless loop of:

#0  0x828401b in zend_mm_create_new_free_block (heap=0x83b0cc8,
mm_block=0x8639004, 
true_size=96) at /usr/home/thekid/devel/php/php/Zend/zend_mm.c:210
#1  0x82838b1 in zend_mm_alloc (heap=0x83b0cc8, size=84)
at /usr/home/thekid/devel/php/php/Zend/zend_mm.c:341
#2  0x824bf4b in _emalloc (size=40, 
__zend_filename=0x82f8640
/usr/home/thekid/devel/php/php/Zend/zend_object_handlers.c,
__zend_lineno=675, __zend_orig_filename=0x0, __zend_orig_lineno=0)
at /usr/home/thekid/devel/php/php/Zend/zend_alloc.c:168
#3  0x8281953 in zend_std_get_method (object=0x83c15d0, 
method_name=0x82f87a0 __call, method_len=6, tsrm_ls=0x8399050)
at /usr/home/thekid/devel/php/php/Zend/zend_object_handlers.c:675
#4  0x825d71c in zend_call_function (fci=0xbfb001fc, fci_cache=0x0,
tsrm_ls=0x8399050)
at /usr/home/thekid/devel/php/php/Zend/zend_execute_API.c:686
#5  0x825cf93 in call_user_function_ex (function_table=0x0,
object_pp=0xbfb002d0, 
function_name=0xbfb00288, retval_ptr_ptr=0xbfb00274, param_count=2, 
params=0xbfb00278, no_separation=0, symbol_table=0x0,
tsrm_ls=0x8399050)
at /usr/home/thekid/devel/php/php/Zend/zend_execute_API.c:550
#6  0x828165a in zend_std_call_user_call (ht=2, return_value=0x8638e30, 
this_ptr=0x83c15d0, return_value_used=1, tsrm_ls=0x8399050)
at /usr/home/thekid/devel/php/php/Zend/zend_object_handlers.c:565
#7  0x825e4ac in zend_call_function (fci=0xbfb003bc, fci_cache=0x0,
tsrm_ls=0x8399050)
at /usr/home/thekid/devel/php/php/Zend/zend_execute_API.c:853
#8  0x825cf93 in call_user_function_ex (function_table=0x0,
object_pp=0xbfb00490, 
function_name=0xbfb00448, retval_ptr_ptr=0xbfb00434, param_count=2, 
params=0xbfb00438, no_separation=0, symbol_table=0x0,
tsrm_ls=0x8399050)
at /usr/home/thekid/devel/php/php/Zend/zend_execute_API.c:550


- Timm

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



[PHP-DEV] Re: class constants in RC1 - why not __self:: then?

2004-03-28 Thread Luna Kid
Andi Gutmans [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED]
 At 10:07 AM 3/15/2004 -0500, Hans Lellelid wrote:
  ...
 You must now use self::MY_CONST to reference the class constant.  While I
 can see that the pre-RC1 behavior would not provide a way to access global
 constant if class had const of same name ... I figured I'd ask anyway
 whether this change is intended or a side-effect of some other fix.  I
 fall into the category of people who were really enjoying not having to
 specify self:: before (so now I have a lot of code to fix, apparently).
 ...
 I fixed it intentionally. That piece of code was left over from the days of
 our broken namespaces implementation where we would do two lookups. Methods
 were fixed a long time ago but we forgot to remove the old code from constants.

 Andi


Well, I guess there is no easy solution, but anyhow, this is still very unfortunate.

The basic Don't Repeat Yourself (or DRY) principle, which could forunately
eliminate the

function Classname() { // constructor

syntax replacing it with the much cleaner and saner __construct (THANKS!!!),
now fails to prevent creeping in of another sort of harmful hardcoded redundancy
to our code...

I'd say I'd rather pay the price of any double lookup any day than loading my code
with useless duplication of information.

As a cheap and effective compromise, would that be a possible to introduce something
like a

__thisclass

keyword so that those of us who are concerned about code duplication could avoid
this newly introduced unnecessary repeating of class names when qualifying consts
within the defining class?

This way (writing __thisclass::MYCONST instead of MyParticularClassName::CONST
we could freely decide to favor clean style, or performance, depending on the specific
situation.


Whichever way, thanks very much for your efforts, guys!

The Luna Kid

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



Re: [PHP-DEV] Re: class constants in RC1 - why not __self:: then?

2004-03-28 Thread Marcus Boerger
Hello Luna,

Sunday, March 28, 2004, 6:56:00 PM, you wrote:

 Andi Gutmans [EMAIL PROTECTED] wrote in message
 news:[EMAIL PROTECTED]
 At 10:07 AM 3/15/2004 -0500, Hans Lellelid wrote:
  ...
 You must now use self::MY_CONST to reference the class constant.  While I
 can see that the pre-RC1 behavior would not provide a way to access global
 constant if class had const of same name ... I figured I'd ask anyway
 whether this change is intended or a side-effect of some other fix.  I
 fall into the category of people who were really enjoying not having to
 specify self:: before (so now I have a lot of code to fix, apparently).
 ...
 I fixed it intentionally. That piece of code was left over from the days of
 our broken namespaces implementation where we would do two lookups. Methods
 were fixed a long time ago but we forgot to remove the old code from constants.

 Andi


 Well, I guess there is no easy solution, but anyhow, this is still very unfortunate.

 The basic Don't Repeat Yourself (or DRY) principle, which could forunately
 eliminate the

 function Classname() { // constructor

 syntax replacing it with the much cleaner and saner __construct (THANKS!!!),
 now fails to prevent creeping in of another sort of harmful hardcoded redundancy
 to our code...

 I'd say I'd rather pay the price of any double lookup any day than loading my code
 with useless duplication of information.

 As a cheap and effective compromise, would that be a possible to introduce something
 like a

 __thisclass

 keyword so that those of us who are concerned about code duplication could avoid
 this newly introduced unnecessary repeating of class names when qualifying consts
 within the defining class?

 This way (writing __thisclass::MYCONST instead of MyParticularClassName::CONST
 we could freely decide to favor clean style, or performance, depending on the 
 specific
 situation.


No need for that we have 'self':
php -r 'class c { const c=Hello\n; static function f() { return self::c; }} echo 
c::f();'



-- 
Best regards,
 Marcusmailto:[EMAIL PROTECTED]

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



Re: [PHP-DEV] Problem starting PHP5 with apache 1.3.29 on Win

2004-03-28 Thread Erik Franzén
Problem solved. Changed system path as follows:

C:\Program\PHP\php5-win32;%SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem;C:\Program\mysql\bin 

Apparently, storing php5ts.dll into system32 is not a bad idea...

Sorry for posting, I should have found the solution myself. This is what 
we in Sweden call SBS (English translation: Shit Behind Keyboard)

Erik franzén wrote:

Yes it is very strange. Sometimes apache starts with no error, but that 
is almost an exception...

Path is set as follows:

%SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem;C:\Program\PHP\php5-win32;C:\Program\mysql\bin 

Andi Gutmans wrote:

Sounds strange.
Have you made sure that php5ts.dll is in your system path?
At 11:03 AM 3/26/2004 +0100, Erik Franzén wrote:

I still have a problem when starting apache 1.3.29 with PHP5 on 
Windows XP Pro. I have tried two different Win installations with no 
success.

I am getting the following error:

SzAppName: apache.exe szAppver: 0.0.0.0 SzModName: php5ts.dll
sZModVer: 5.0.0.0 offset: 0003d0c3
For more debug information, please see
http://www.nordicaudi.com/public/temp/apache-php5.zip
--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php



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


Re: [PHP-DEV] Re: class constants in RC1 - why not __self:: then?

2004-03-28 Thread Luna Kid
  This way (writing __thisclass::MYCONST instead of MyParticularClassName::CONST
  we could freely decide to favor clean style, or performance, depending on the 
  specific
  situation.

 No need for that we have 'self':
 php -r 'class c { const c=Hello\n; static function f() { return self::c; }} echo 
 c::f();'

Yoohoo!!! Wonderful, thanks! :)
(Dunno how I could miss this, but who cares now that PHP is PERFECT... :) )

Cheers,
Lunatic

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



[PHP-DEV] $$$wanna make real money$$$..you will no longer need student loans

2004-03-28 Thread theeb
EXCELLENT CASH INCOME
I started out with $6. Now, I am making thousands.
I found this on a bulletin board and decided to try it. A little
while back, I was browsing through newsgroups, just like you are now,
and came across an article similar to this that said you could make
thousands of dollars within weeks with only an initial investment of
$6.00! So I thought, Yeah right, this must be a scam, but
like most of us, I was curious, so I kept reading. Anyway, it said
that you send $1.00 to each of the 6 names and addresses stated in the
article. You then place your own name and address in the bottom of
the list at #6, and post the article in at least 200 newsgroups.
(There are thousands) No catch, that was it. So after thinking it
over, and talking to a few people first, I thought about trying it. I
figured: what have I got to lose except 6 stamps and $6.00,
right? Then I invested the measly $6.00. Well GUESS WHAT!?...
within 7 days, I started getting money in the mail! I was shocked! I
figured it would end soon, but the money just kept coming in. In my
first week, I made about $25.00. By the end of the second week I had
made a total of over $1,000.00! In the third week I had over
$10,000.00 and it's still growing. This is now my fourth week and I
have made a total of just over $42,000.00 and it's still coming in
rapidly. It's certainly worth $6.00, and 6 stamps, I have spent more
than that on the lottery!! Let me tell you how this works and most
importantly, WHY it works... Also, make sure you print a copy of this
article NOW, so you can get the information off of it as you need it.
I promise you that if you follow the directions exactly, that you
will start making more money than you thought possible by doing
something so easy!
Suggestion: Read this entire message carefully! (print it out or
download it.) Follow the simple directions and watch the money come
in!
It's easy. It's legal. And your investment is only $6.00 (Plus
postage)
IMPORTANT: This is not a rip-off; it is not indecent; it is not
illegal; and it is 99% no risk - it really works!
If all of the following instructions are adhered to, you will receive
extraordinary dividends.
PLEASE NOTE:
Follow these directions EXACTLY, and $50,000.00 or more can be
yours in 20 to 60 days. This program remains successful because of
the honesty and integrity of the participants. Please continue its
success by carefully adhering to the instructions.
You will now become part of the Mail Order business. In this business
your product is not solid and tangible, it's a service. You are in
the business of developing Mailing Lists. Many large corporations are
happy to pay big bucks for quality lists. However, the money made
from the mailing lists is secondary to the income which is made from
people like you and me asking to be included in that list.
Here are the 4 easy steps to success:
STEP 1:
Get 6 separate pieces of paper and write down your name and address
followed by the words PLEASE ADD ME TO YOUR MAILING LIST on each
of them. Now get 6 US $1.00 bills and place ONE inside EACH of the
6 pieces of paper so the bill will not be visible through the envelope
(to prevent thievery). Next, place one paper in each of the 6 envelopes
and seal them. You should now have 6 sealed envelopes, each with a piece of
paper stating the above phrase, your name and address, and a $1.00
bill. What you are doing is creating a service. THIS IS ABSOLUTELY
LEGAL! You are requesting a legitimate service and you are paying for
it! Like most of us I was a little skeptical and a little worried
about the legal aspects of it all. So I checked it out with the U.S.
Post Office (1-800-725-2161) and they confirmed that it is indeed
legal. Mail the 6 envelopes to the following addresses:
1) Jay foresman
1925 Elmeda
Muskogee Ok, 74403
2) John Visser
11140 Streets Ridge
RR#2 Oxford, NS Canada, B0M 1P0
3) C. Warren
721 W. 1500 S.
Provo, UT 84601
4) justin s
12 bense ct
Washington, NJ 07882
5) Rueben Hernandez
709 3rd ave apt B
Bradley Beach, NJ 07720
6)Salameh basheer
  9331
Sakhnin, Israel 20173
STEP 2:
Now take the #1 name off the list that you see above, move
the other names up (6 becomes 5, 5 becomes 4, etc...) and add YOUR
Name as number 6 on the list.
STEP 3:
Change anything you need to, but try to keep this article as
close to original as possible. Now, post your amended article to at
least 200 newsgroups. (I think there are close to 24,000 groups) All
you need is 200, but remember, the more you post, the more money you
make! You won't get very much unless you post like crazy.
This is perfectly legal! If you have any doubts, refer to Title 18
Sec. 1302  1341 of the Postal lottery laws.
Keep a copy of these steps for yourself and, whenever you need money,
you can use it again, and again.
PLEASE REMEMBER that this program remains successful because of the
honesty and integrity of the participants and by their carefully
adhering to the directions. Look at it this way. If you are of

Re: [PHP-DEV] Studlycaps and MySQLi

2004-03-28 Thread John Coggeshall
On Sun, 2004-03-28 at 04:35, Zeev Suraski wrote:
 Very well put.
 +1 for consistency and going all the way with StudlyCaps from me.

+1 for consistency, but unless someone is willing to change Georg's
extension for him I don't see this happening.

John

-- 
-=~=--=~=--=~=--=~=--=~=--=~=--=~=--=~=--=~=--=~=--=~=--=~=-
John Coggeshall   http://www.coggeshall.org/
The PHP Developer's Handbookhttp://www.php-handbook.com/
-=~=--=~=--=~=--=~=--=~=--=~=--=~=--=~=--=~=--=~=--=~=--=~=-

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



[PHP-DEV] CVS Account Request: shakaali

2004-03-28 Thread Arttu Tervo
Well I'm interested in translating the PHP manual into Finnish and Henry Karpatskij 
(his nick is spheroid) said I'm welcome to the project. I want a CVS access to the 
phpdoc-fi section.

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



[PHP-DEV] reload() in Python, Possible in PHP?

2004-03-28 Thread Andrew Heebner
AFAIK, Python supports the reload() method, which lets you dynamically 
control includes while a script is running.

In PHP, even workarounds are tough to create reloadable modules for 
scripts, so, what other means are there to reload includes, and 
redeclare functions?

Thank you,
Andrew Heebner, EvilWalrus.com
--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP-DEV] reload() in Python, Possible in PHP?

2004-03-28 Thread Jon Parise
On Sun, Mar 28, 2004 at 03:57:22PM -0500, Andrew Heebner wrote:

 AFAIK, Python supports the reload() method, which lets you dynamically 
 control includes while a script is running.

This is conceptually easier to implement in Python because a module is
its own namespace.  In PHP, the stuff that is included from another
file has no such common organization.
 
 In PHP, even workarounds are tough to create reloadable modules for 
 scripts, so, what other means are there to reload includes, and 
 redeclare functions?

If it's not already safe to include() your file multiple times, I
don't think adding a reload() function to PHP is going to improve your
situation all that much.  The engine would have to do a fair amount of
work to figure out how to reload the contents of the external
script.

-- 
Jon Parise ([EMAIL PROTECTED]) :: The PHP Project (http://www.php.net/)

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



Re: [PHP-DEV] reload() in Python, Possible in PHP?

2004-03-28 Thread George Schlossnagle
On Mar 28, 2004, at 4:36 PM, Jon Parise wrote:

On Sun, Mar 28, 2004 at 03:57:22PM -0500, Andrew Heebner wrote:

AFAIK, Python supports the reload() method, which lets you dynamically
control includes while a script is running.
This is conceptually easier to implement in Python because a module is
its own namespace.  In PHP, the stuff that is included from another
file has no such common organization.
In PHP, even workarounds are tough to create reloadable modules for
scripts, so, what other means are there to reload includes, and
redeclare functions?
If it's not already safe to include() your file multiple times, I
don't think adding a reload() function to PHP is going to improve your
situation all that much.  The engine would have to do a fair amount of
work to figure out how to reload the contents of the external
script.
You can do this easily enough in an extension.  Combine the 
function/class tracking stuff that APC performs and internally use the 
overide_function() function from APD.  Obviously that would require a 
bit of glue to get it working, but the primitive facilities are all 
there.

I don't see any of that ever making it's way into PHP proper though.

George

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


[PHP-DEV] PHP-4.3.5 problem

2004-03-28 Thread Phillip Porch
There seems to be a problem in the streams.c code. There is a line that
has the construct

#if defined(S_ISFIFO) || defined(S_ISSOCK)

the problem is the the code below assumes that S_ISSOCK is defined but the
if statement is true if either S_ISFIFO or S_ISSOCK is defined. If you
have a system (like I do) that defines S_ISFIFO but not S_ISSOCK, the code
fails. I looked at the PHP-4.3.4 code and munged the code as per the patch
below to make it compile. Someone might want to look at this further.

Thanks,


*** streams.c Tue Mar 16 17:23:25 2004
--- streams.c.new Sun Mar 28 08:06:00 2004
***
*** 2016,2022 
  {
php_stdio_stream_data *self;
php_stream *stream;
! #if defined(S_ISFIFO) || defined(S_ISSOCK)
struct stat sb;
int stat_ok;

--- 2016,2022 
  {
php_stdio_stream_data *self;
php_stream *stream;
! #if defined(S_ISFIFO)  defined(S_ISSOCK)
struct stat sb;
int stat_ok;

***
*** 2037,2044 

  #ifdef S_ISFIFO
/* detect if this is a pipe */
!   if (stat_ok) {
!   self-is_pipe = S_ISFIFO(sb.st_mode) ? 1 : 0;
}
  #elif defined(PHP_WIN32)
{
--- 2037,2045 

  #ifdef S_ISFIFO
/* detect if this is a pipe */
!   if (self-fd = 0) {
!   struct stat sb;
!   self-is_pipe = (fstat(self-fd, sb) == 0  S_ISFIFO(sb.st_mode)) ? 
1 : 0;
}
  #elif defined(PHP_WIN32)
{

-- 
Phillip P. Porch [EMAIL PROTECTED]  NIC:PP1573 finger for
http://www.theporch.com36 1.187 N 86 44.018 W GnuPG key

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