[PHP-DEV] php-dev summaries (Re: [PHP-DEV] suggestions for ze2)

2003-01-14 Thread Leon Atkinson
 Actually, I think it's a good idea to make a
 summary of all those discussions

 What about an always available discussion documentation on php.net ?

Avi Lewin writes an excellent weekly column that summarizes discussions on
this list.

http://www.zend.com/zend/week/index.php

Leon



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




Re: [PHP-DEV] when PHP code causes crash due to bad input, is it a bug?

2003-01-10 Thread Leon Atkinson
Thanks for sticking with the issue, Greg.

If I may make an objective observation... Random users constantly submit
issues to the bug database that are clearly not problems with PHP, issues
that are better addressed in the mailing lists.  I imagine it must be
frustrating to the QA team to have people constantly blaming PHP for bugs
in their scripts.  Sometimes issues are mistakenly changed to bogus when
they shouldn't be.  And as a bug submitter it's easy to think bogus really
means you're a liar or an idiot.  It doesn't.  It just seems to be a space
we've reached where resolution of bug reports isn't perfect.  The best
idea I have is to remain polite and persistent.  Hey, at least no one used
a swear word.

Since you have lots of experience doing QA, you probably already
understand this and maybe you have some ideas for how the process can
improve.

Leon



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




[PHP-DEV] patch for libgd/gd.c (gdImageRotate90 x,y transposed)

2003-01-09 Thread Leon Atkinson
This function isn't making the new image with the right dimensions. 

# cvs diff ext/gd/libgd/gd.c
Index: ext/gd/libgd/gd.c
===
RCS file: /repository/php4/ext/gd/libgd/gd.c,v
retrieving revision 1.39
diff -u -r1.39 gd.c
--- ext/gd/libgd/gd.c   18 Dec 2002 21:13:21 -  1.39
+++ ext/gd/libgd/gd.c   10 Jan 2003 01:02:06 -
@@ -2492,10 +2492,10 @@
FuncPtr f;

if (src-trueColor) {
-   dst = gdImageCreateTrueColor ( src-sx,src-sy);
+   dst = gdImageCreateTrueColor (src-sy, src-sx);
f = gdImageGetTrueColorPixel;
} else {
-   dst = gdImageCreate (src-sx, src-sy);
+   dst = gdImageCreate (src-sy, src-sx);
f = gdImageGetPixel;
}



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




[PHP-DEV] Is exif_tagname() useful?

2003-01-07 Thread Leon Atkinson
The undocumented function exif_tagname() does lookups on the table
tag_table_IFD which matches IDF0 tags to human-readable names.  Considering
exif_read_data() already uses this table, is there a reason to have this
function around?  Debugging?

---
Leon Atkinson http://www.leonatkinson.com/


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




[PHP-DEV] imageline drawing twice

2003-01-07 Thread Leon Atkinson
It looks like imageline() draws the line twice.

RCS file: /repository/php4/ext/gd/gd.c,v
retrieving revision 1.241
diff -u -r1.241 gd.c
--- ext/gd/gd.c 31 Dec 2002 16:06:39 -  1.241
+++ ext/gd/gd.c 7 Jan 2003 21:54:37 -
@@ -2149,8 +2149,7 @@
else
 #endif
gdImageLine(im, Z_LVAL_PP(x1), Z_LVAL_PP(y1), Z_LVAL_PP(x2),
Z_LVAL_PP(y2), Z_LVAL_PP(col));
-
-   gdImageLine(im, Z_LVAL_PP(x1), Z_LVAL_PP(y1), Z_LVAL_PP(x2),
Z_LVAL_PP(y2), Z_LVAL_PP(col));
+
RETURN_TRUE;
 }
 /* }}} */



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




Re: [PHP-DEV] Generic expressions interpolation in strings

2003-01-06 Thread Leon Atkinson
 print END
 table
 trtdName:/tdtd{$= text2html($data['name']) }/td/tr
 trtdAddress:/tdtdinput type=text value={$=
htmlspecialchars($data['address']) }/td/tr
 /table
 END;

Federico, you can always do this:

?
table
trtdName:/tdtd?= text2html($data['name']) ?/td/tr
trtdAddress:/tdtdinput type=text value=?=
htmlspecialchars($data['address']) ?/td/tr
/table
?

Cheers,
Leon



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




Re: [PHP-DEV] Designing for PHP4 with PHP5 in mind...

2003-01-06 Thread Leon Atkinson
 Any good links you could throw my way describing proposed changes?

There are archives of the Zend Engine 2 list at zend.com:
http://www.zend.com/lists.php

There is one big change with objects that will break BC.  Objects pass by
reference instead of value, both for function calls and assignments.  For
example:

?
class a {}

function c($c)
{
$c-name = 'C';
}

$a = new a;
$b = $a;

$a-name = A;
print($a-name);
$b-name = B;
print($a-name);
c($a);
print($a-name);
?

In ZE1 you get AAA. In ZE2 you get ABC.

Leon

---
Leon Atkinson http://www.leonatkinson.com/



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




Re: [PHP-DEV] string functions

2003-01-05 Thread Leon Atkinson
 Because this behavior is not documented

For the record, it is documented:
http://www.php.net/manual/en/function.strstr.php

If needle is not a string, it is converted to an integer and applied as the
ordinal value of a character. 

And I'm sure it's worked this way for at least three years.

Leon





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




Re: [PHP-DEV] PHP Look Back 2002

2002-12-30 Thread Leon Atkinson
A friend of mine had an uncle who taught dancing to middle-aged couples.
One day he visited some lessons and noticed that all the couples were
fussing, stepping on each other's feet and arguing.  When he asked, what
gives?  his uncle told him, if you're not fighting, you're not dancing.
(It may help to imagine this said with a yiddish accent).  Damn me if this
doesn't describe the PHP community.

Thanks for reminding us to keep our sense of humor, Derick. ;)

Leon



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




Re: [PHP-DEV] Warning in wrong parameter

2002-12-24 Thread Leon Atkinson
 Is there any possibility that
 PHP return me a warning with the message (e.g.) Warning parameter
 number for [function name] in [page.php] line [line number] ???

If you really need this behavior, do something like

assert('func_num_args() == 1');

That should generate the warning you describe if assertions are turned on.

Leon



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




Re: [PHP-DEV] RC4: ground rules

2002-12-21 Thread Leon Atkinson
 Possible values are:

 - php_auth_exposure=user
   Only PHP_AUTH_USER is exposed.

 - php_auth_exposure=pw
   Only PHP_AUTH_PW is exposed

 - php_auth_exposure=user,pw
   Both PHP_AUTH_USER and PHP_AUTH_PW are exposeed

Moriyoshi, have you considered using constants here instead of strings?  For
example:

- php_auth_exposure=AUTH_EXPOSE_USER
  Only PHP_AUTH_USER is exposed.

- php_auth_exposure=AUTH_EXPOSE_PW
  Only PHP_AUTH_PW is exposed

- php_auth_exposure=AUTH_EXPOSE_USER | AUTH_EXPOSE_PW
  Both PHP_AUTH_USER and PHP_AUTH_PW are exposeed

It resembles the style used by error reporting, which will be less confusing
for novices.

Regards,
Leon


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




Re: [PHP-DEV] RC4: ground rules

2002-12-21 Thread Leon Atkinson
 There is no difference here, both are strings anyway. And the latest
 option AUTH_EXPOSE_USER | AUTH_EXPOSE_PW wont work in an httpd.conf
 file. Also, this is NOT the style we have in php.ini. I don't see any
 valid point to use this thing.

Derick,

you may have a point about it not being as friendly to httpd.conf, but if
you look at php.ini-dist, you'll see:

; If you use constants in your value, and these constants belong to a
; dynamically loaded extension (either a PHP extension or a Zend extension),
; you may only use these constants *after* the line that loads the
extension.

Which implies constants ARE available inside php.ini.  (Yes, I know they
aren't in httpd.conf or .htaccess).

You'll also see this:

; error_reporting is a bit-field.  Or each number up to get desired error
; reporting level
[snip]
; Examples:
;
;   - Show all errors, except for notices
;
;error_reporting = E_ALL  ~E_NOTICE

Which is the style I was talking about.

The patch in question is using two flags, which suggests the a bitfield.

It's true there's at least one ini setting that uses a string of
comma-separated values (mbstring's encoding settings), but are there other
examples of setting a couple of on/off values in a string like this?  I
guess variables_order is kind of like this.

Maybe it would be better to have two flag directives instead of one value
directive.

Anyway, it probably doesn't matter.

Regards,
Leon



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




Re: [PHP-DEV] CGI and CLI (compromise proposal)

2002-12-19 Thread Leon Atkinson
 After having consulted with Andrei, Derick and others on irc here is
 a proposal for a compromise:

 On Unix:

 1. Both cgi and cli are built as 'php' in their respective sapi
 directories (pretty much as it is today except that cgi gets renamed
 back from php-cgi to just php).
 2. Make install will *not* install cli if cgi build was selected
 (only cgi gets installed).
 3. A new install target 'install-cli' is introduced so that make
 install-cli will overwrite whatever is in $(PREFIX)/bin/php.

 On Windows:

 1. php.exe in the root of distribution is php cgi sapi.
 2. New cli directory is included with php.exe (cli) in it.

 If this is an acceptable compromise I volunteer to do the changes
 required.

This goes to show that good ideas usually win out and our system works.  I
proposed cli/php.exe on Windows back on December 9th, but there was a fear
it would be a support nightmare.  I take it those fears have subsided.  I'm
also glad that limb I went out on didn't break afterall.

I'd say that I fully support this proposal but I'm not sure my opinion
matters. ;)

Leon



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




Re: [PHP-DEV] php.exe - php-cgi.exe

2002-12-10 Thread Leon Atkinson
  out on a limb
  Would it be a tragedy to name both the CLI and CGI versions php on
UNIX
  and php.exe on Windows?

 Yes, it's a support nightmare.

limb broken=yes /
I defer to you.

Leon



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




Re: [PHP-DEV] php.exe - php-cgi.exe

2002-12-10 Thread Leon Atkinson
 P.S. I wish people were following this list more closely so that we don't 
 have to discuss same issues over and over again.

But it's fun to argue over the same things every six months! :P

Leon



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




Re: [PHP-DEV] php.exe - php-cgi.exe

2002-12-09 Thread Leon Atkinson
out on a limb
Would it be a tragedy to name both the CLI and CGI versions php on UNIX
and php.exe on Windows?

On UNIX, it doesn't seem like there'd be much confusion because make
install would put sapi/cli/php in /usr/local/bin and sapi/cgi/php in
/usr/local/apache/cgi-bin.

For the Windows distro, php.exe in the root of the archive could be the CGI
(as usual) and sapi/php.exe could be the CLI version.

It might be better to have sapi/cli/php.exe (along with parallel changes for
the DLLs in that directory).
/out on a limb

Leon



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




Re: [PHP-DEV] php.exe - php-cgi.exe

2002-12-09 Thread Leon Atkinson
  As Leon has suggested, why not just compile the variants into different
  directories?  Say add a cli/ (since the CLI is newer).  Only one
 directory
  would go into the PATH (presumably).
 

 That would also affect the ini setting for extension_dir. The default
 value is ./ indicating the same directory as the executable. I would
 prefer everthing to be in the same directory. This way I dont have to mess
 with php.ini when I have multiple installations on the same system.

Yes, that's true.  On the other hand, there's something strange about
php.ini's extension_dir and the extensions directory.  I found it a lot
easier and cleaner to wipe out that line from php.ini than move all the
extension up a directory.  (If you don't set extension_dir, it uses
c:\php4\extensions.)  Wow, I guess I may have really stepped in it because
I was just about to suggest the php.ini default setting change. ;)

Leon



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




[PHP-DEV] Making NULL a scalar

2002-11-21 Thread Leon Atkinson
It seems like the NULL type is a scalar type, ie it has a discrete set of
values.  I suppose from an SQL perspective, one could argue NULL is a
special value that destroys any attempts at evaluation.  However, PHP has a
precedent that relates to this issue: the ctype functions.  For example,
is_alpha('') is TRUE...of course, because the null set is always a part of
every set (in textbook mathematics, anyway).

Anyway, the is_scalar() function  is currently returning FALSE when passed a
NULL value.  May I suggest adding the IS_NULL constant to the top part of
this function's case statement?  I'm not sure if this has negative BC
issues.

I don't feel particularly passionate about this issue, it just occurred to
me as I was reviewing the function.

Comments?

Thanks,
Leon

---
Leon Atkinson http://www.leonatkinson.com/


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




[PHP-DEV] is_callable Bug 20216

2002-11-18 Thread Leon Atkinson
Can someone shed some light on is_callable?  I think I understand it's meant
for testing whether a function or method is callable, but it would be nice
to get some confirmation from someone who knows for sure.  Philip and I are
trying to add this function to the manual.

Here are some rough notes I have on my understanding of the function (from
http://bugs.php.net/bug.php?id=20216):

This function wraps zend_is_callable.  The first argument is the name
of a function or method.  Class and object methods are specified by
passing an array with two elements: class or object and method name.

The second argument seems to be for checking syntax only, but I can't
figure out how to make is_callable return FALSE when the second
argument is TRUE.

The third argument receives the callable name.  In the example below
it's a::b.  Note, however, that despite the implication that a::b()
is a callable static method, this is not the case.

?
  class a
  {
var $c;

function b()
   {
 return($this-c);
}
  }

  $d = new a;

  if(is_callable(array($d, 'b'), FALSE, $name))
  {
print($name);
  }
?

Thanks!

---
Leon Atkinson http://www.leonatkinson.com/


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




Re: [PHP-DEV] is_callable Bug 20216

2002-11-18 Thread Leon Atkinson
  The second argument seems to be for checking syntax only, but I can't
  figure out how to make is_callable return FALSE when the second
  argument is TRUE.

 Try this:

 var_dump(is_callable(array(1,2), true));

Hmm...OK.  Yes, that does make is_callable return false.  Can you explain
the logic behind this?  I tried lots of other values and got TRUE.  For
example:

var_dump(is_callable(array('$$$','%^'), true));
var_dump(is_callable('%^', true));

These aren't valid identifiers, but the function is (apparently) reporting
that syntax is OK.


 Well, $name is just supposed to indicate which class/method you were
 checking. It doesn't tell you whether the method is static or not,
 because in PHP 4 it doesn't make sense.

Ah, yeah, I guess there isn't a way to tell if a method is callable
statically or not unless you check that it contains no references to
instance properties.

So, would it be fair to say this function is intended for debugging the
core?  And, if you have the time, could you describe the situation where
this function is useful?

Thanks Much!

Leon



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




Re: [PHP-DEV] PHP and Threading

2002-11-15 Thread Leon Atkinson
 I was wondering, is PHP in future going to support threading? This would
be
 a very nice feature.
 I'am currently working on this project of mine, a FTP Server build in PHP
 which serve MySQL database records. It actually does work very nice, also
 multiple clients at the same time. It supports passive and active FTP.
 But my problem here is that the FTP server only can handle one file
transfer
 at a time. Threading would be the solution. Are there any plans
implementing
 it?

Take a look at the process control functions.  (I only recently noticed them
myself).
http://www.php.net/manual/en/ref.pcntl.php

It sounds like you need to fork on an accepted connection.

Leon



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




Re: [PHP-DEV] abstract functions

2002-11-09 Thread Leon Atkinson
How about testing for the parent?  Such as:

?

class AbstractClassException { }

 class MyClass
 {
  var $salutation;

function MyClass()
{
  if(!get_parent_class($this))
  {
 throw new AbstractClassException();
}

$this-salutation = 'Hello';
}

 function test()
 {
  print($this-salutation);
 }
 }

class MyOtherClass extends MyClass
{
 function MyOtherClass()
 {
  MyClass::MyClass();
 }
}

//use the abstract class correctly
$c = new MyOtherClass;
$c-test();

//use it incorrectly, get an exception
$c = new MyClass;

?

Regards,
Leon


- Original Message -
From: Jens Rehsack [EMAIL PROTECTED]
To: Andrei Zmievski [EMAIL PROTECTED]
Cc: [EMAIL PROTECTED]
Sent: Saturday, November 09, 2002 8:22 AM
Subject: Re: [PHP-DEV] abstract functions


 Andrei Zmievski wrote:
  ZE1 way:
 
   class MyClass {
  function MyClass()
  {
   die('MyClass is an abstract class');
  }
   }
 
  ZE2 way:
 
   class AbstractClassException {
   }
 
   class MyClass {
  function MyClass()
  {
  throw new AbstractClassException();
  }
   }
 
  On Sat, 09 Nov 2002, Jens Rehsack wrote:

 That's not ok, cause (very simple)
 class Calcer
 {
function Calcer() { die('abstract'); }
function ShowResult( $a )
{
  echo $this-CalcResult( $a )
}
abstract function CalcResult( $a );
 }

 class Square extends Calcer
 {
function Square()
{
  Calcer::Calcer(); // cause inherited could do sth.
}

function CalcResult( $a )
{
  return $a * $a;
}
 }

 class Adder extends Calcer
 {
var $Summand;

function Adder( $aSummand )
{
  Calcer::Calcer();
  $this-Summand = $aSummand;
}

function CalcResult( $a )
{
  return $a + $this-Summand;
}
 }

 I can give a more complex example, if you want, but it's not ok to die
 in constructor of an abstract class, cause the main logic could be
 implemented in this class and it needs to be derived cause for helper
 functions...

 An example is a cache control class which is able to access cached
 objects through it real name and is either able to store in filesystem
 or in database.

 Jens
 Hi,
 
 does PHP4 with the ZE2 supports abstract function like Delphi or C++?
 That would be very useful for class development, cause we can avoid
 testing if a class is abstract if an abstract class couldn't be
 instantiated?
 
 Syntax could be like in C++
 class X
 {
   X(){}
   int y() = 0;
 }
 
 or little bit more like pascal
 
 class X
 {
   X(){} // PHP
   function x(); abstract;
 }
 
 or
 
 class X
 {
   X(){} // PHP
   abstract function x();
 }
 
 Greetings,
 Jens
 --
 L i  W W W  i Jens Rehsack
 LW W W
 L i   W   W W   W   i  nnnLiWing IT-Services
 L iW W   W Wi  n  n  g   g
   i W W i  n  n  g   gFriesenstraße 2
   06112 Halle
  g
  g   g
 Tel.:  +49 - 3 45 - 5 17 05 91ggg e-Mail: [EMAIL PROTECTED]
 Fax:   +49 - 3 45 - 5 17 05 92http://www.liwing.de/
 
 
 --
 PHP Development Mailing List http://www.php.net/
 To unsubscribe, visit: http://www.php.net/unsub.php
 
 
 
 
  -Andrei   http://www.gravitonic.com/
  * A feature is a bug with seniority. *
 
 



 --
 L i  W W W  i Jens Rehsack
 LW W W
 L i   W   W W   W   i  nnnLiWing IT-Services
 L iW W   W Wi  n  n  g   g
   i W W i  n  n  g   gFriesenstraße 2
06112 Halle
   g
   g   g
 Tel.:  +49 - 3 45 - 5 17 05 91ggg e-Mail: [EMAIL PROTECTED]
 Fax:   +49 - 3 45 - 5 17 05 92http://www.liwing.de/



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



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




[PHP-DEV] Is socket_create_pair() useful?

2002-11-08 Thread Leon Atkinson
I understand how (in C) socketpair() is useful if I can fork().  It's not
obvious what I can do with the two sockets that socket_create_pair()
creates.  What am I missing?

Thanks,
Leon

---
Leon Atkinson http://www.leonatkinson.com/


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