Re: [PHP-DEV] Pb : access control
here a code to test private variables ?php // test private variables class foo { private $name = foo; function __construct() { $this-name = foo2; } } class baz extends foo { function show() { echo name : $this-name \n; } } $test = new baz(); $test-show(); echo name : $test-name \n; ? this code expose the variable foo2 in the baz object (method show) which normally can't be visible (private variable of the parent class), and expose the variable in the main context. Normally a fatal error must be generated when accessing private variables in the main context (echo name : $test-name \n;) and in the inheritance context ($test-show();) Hope that will help debug PHP5 Fabrice Le Coz [EMAIL PROTECTED] - Original Message - From: Andi Gutmans [EMAIL PROTECTED] To: Fabrice Le Coz [EMAIL PROTECTED]; [EMAIL PROTECTED] Sent: Monday, March 17, 2003 9:00 PM Subject: Re: [PHP-DEV] Pb : access control Can you cut down the script to like 10 lines and say what your result is and what you'd expect? At 05:37 PM 3/17/2003 +0100, Fabrice Le Coz wrote: Hi, I'm playing with PHP5 and have some trouble wtith access control, here's the code I run with last php5 from snaps.php.net under windows XP : ?php class pere { private $var3; public$var1; protected $var2; function __construct() { $this-var1 = public; $this-var2 = protected; $this-var3 = private; } function show() { echo pere::show() \n; echo var1 : $this-var1\n; echo var2 : $this-var2\n; echo var3 : $this-var3\n; echo \n; } } class fils extends pere { protected $var = fils; private $var4 = test; function __construct() { parent::__construct(); } function show_fils() { echo fils::show() \n; echo var1 : $this-var1\n; echo var2 : $this-var2\n; echo var3 : $this-var3\n; echo var : $this-var\n; echo \n; } } function show_var($obj) { $obj_vars = get_object_vars($obj); foreach ($obj_vars as $name = $value) { if($name != ) echo $name : $value\n; } echo \n; } $test1 = new pere(); $test1-show(); echo Affichage des variables visibles de test1 :\n; show_var($test1); $test2 = new fils(); $test2-show_fils(); echo Affichage des variables visibles de test2 :\n; show_var($test2); $test2-show(); echo var3 : .$test2-var3.\n; echo var4 : .$test2-var4.\n; ? and I've the following result : pere::show() var1 : public var2 : protected var3 : private Affichage des variables visibles de test1 : var1 : public fils::show() var1 : public var2 : protected var3 : private var : fils Affichage des variables visibles de test2 : var1 : public var2 : var3 : private pere::show() var1 : public var2 : protected var3 : private var3 : private Fatal error: Cannot access private property fils::$var4 in D:\www\test\heritier.php on line 59 Normally in the instance of fils object ($test2), I mustn't see $this-var3 which is private variable of the parent. if I comment the line 'echo var3 : $this-var3\n;' in the show_fils method, $test2-var3 is empty but do not generate an error ! The show_var($test2) function expose a var2 variable which normally must send an Fatal error. Fabrice Le Coz [EMAIL PROTECTED] -- PHP Development Mailing List http://www.php.net/ To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DEV] add SMTP authentication to php.mail() function
Hello, I'm interested to add SMTP authentication to the php.mail() function. Is this something that the PHP dev community would endorse? I'm told that as a newbie contributor I wouldn't have direct access to the CVS, that I'd have to post my diffs to this list or get an existing developer to sponsor my changes. I already did the digging around and know what needs to happen: a small number of lines of code in /win32/sendmail.c SendText() to add the necessary SMTP AUTH commands. Maybe this has come up before and been rejected. Let me know. I did a search in the list archives but didn't turn anything up. Here is some background: I'm developing a website that will be hosted on a linux box (LAMP), however my work machine is MS Windows 2000. The website includes a submission page which e-mails some HTTP form posted data back to me. For simplicity I'm simply using the php.mail() function. However, when I'm developing on Windows 2000, if I want to test the mail submission, I don't have an SMTP relay running locally and my ISP requires authentication for outgoing SMTP. So for now the php.mail() fails and I fake it until the php pages are uploaded to the server. I know I could switch to another means of sending mail (PHP class for SMTP, etc) but I thought it would be cool to hack PHP to add this minor feature. I would plan to add two new php.ini settings SMTP_usr and SMTP_pwd. Looking forward to your comments. John M. Calvert, M.Sc., MCSD 1310521 Ontario Inc. 49 Belmont Ave. Ottawa ON K1S 0V2 (613) 730-9851 http://members.rogers.com/john-m-calvert/ -- PHP Development Mailing List http://www.php.net/ To unsubscribe, visit: http://www.php.net/unsub.php