Re: [PHP-DEV] Internals read-only

2007-12-13 Thread Richard Quadling
On 13/12/2007, Jani Taskinen [EMAIL PROTECTED] wrote:
 You're all just proving my point by replying to this stupid thread.
 Thank you for that. :D

Spleen venting provides a calming effect on one's nerves.


-- 
-
Richard Quadling
Zend Certified Engineer : http://zend.com/zce.php?c=ZEND002498r=213474731
Standing on the shoulders of some very clever giants!

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



Re: [PHP-DEV] Namespace

2007-12-08 Thread Richard Quadling
On 07/12/2007, Lokrain [EMAIL PROTECTED] wrote:
 Hello all,

 I just wanted to drop an opp. Just to see the logic, when we have
 programming structure class, interface, function, if statement, switch
 statement etc, we have bracers encapsulation. This is the logic that most
 programming language give to show a programmer that something is inside
 something. We here have namespace with the same idea, and no bracers.

 Conclusion: namespaces are not logical = no thanks

 PS. By the way, I do not think that any workarounds on that logic will not
 be nice.


I'm trying to understand the argument against using braces.

And that has led me to the following question.

Assuming no braces, how would I put code OUTSIDE of the namespace in a
single file.

?php
namespace XYZ;

xyz related code goes here

non xyz related code goes here but how do I let PHP know it isn't part of xyz?



Do I have to change namespace by using a dummy namespace? Same issue
how do I refer to the global namespace.


Richard.

-- 
-
Richard Quadling
Zend Certified Engineer : http://zend.com/zce.php?c=ZEND002498r=213474731
Standing on the shoulders of some very clever giants!

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



Re: [PHP-DEV] private properties ....

2007-12-01 Thread Richard Quadling
On 01/12/2007, Jingcheng Zhang [EMAIL PROTECTED] wrote:
 Well, yes, private denies accessing from other class(including its child
 class), this is what encapsulation means. But when refering to
 inheritance, why forbids private properties/methods being *extended* to
 child classes? This is what I mean, as the following example:

 ?php
 class p {
 protected $foo = 'foo';
 private   $bar = 'bar';
 }
 class c extends p {
 public function f() {
 $o = new p();
 $o-foo = 'FOO';// Correct, foo is protected property of p and
 thus allow accessing from child class

This is not allowed. $o is in a different context (I think that's the
right way of describing this) and as such has no access to the private
or protected members of $o. Just because it $o is created within class
c, it is not related.

 $o-bar = 'BAR';// Incorrect, bar is private property of
 *class p* here
 }
 public function g() {
 $this-foo = 'FOO'; // Correct, foo is
 $this-bar = 'BAR'; // Should be OK, as bar is private property of
 *class c* here

Private means only of use in the class in which is created, not
sub-classes or public space.
 }
 }
 ?

 Thanks.


 On Dec 1, 2007 12:57 AM, Johannes Schlüter [EMAIL PROTECTED] wrote:

  Hi,
 
  On Sat, 2007-12-01 at 00:24 +0800, Jingcheng Zhang wrote:
   Hi Etienne,
 Is private only an access limiter between classes?If so, I think
  private
   properties and methods should be OK to be extended into the child class,
  but
   currently that's not the case, and there is also a bug here, consider
  the
   following example:
 
  The child class is another class, private gives you encapsulation
  inside the base class's context. and preventing acces from other class's
  context.
 
  johannes
 
 


 --
 Best regards,
 Jingcheng Zhang
 Room 304, Dormitory 26 of Yuquan Campus, Zhejiang University
 P.R.China



-- 
-
Richard Quadling
Zend Certified Engineer : http://zend.com/zce.php?c=ZEND002498r=213474731
Standing on the shoulders of some very clever giants!


Re: [PHP-DEV] late static binding php6

2007-11-23 Thread Richard Quadling
On 22/11/2007, Marco Kaiser [EMAIL PROTECTED] wrote:
 Hi again,

 to explain the main idea a bit more, the code below work and moves the
 main getInstance function from the class and its possible to abstract
 this.
 it would be cool to get the protected property also into the abstract
 class. Any idea or maybe a solution in the near future?

 ?php
 abstract class singleton
 {
 static public function getInstance()
 {
 $caller = get_called_class();
 if (!static::$_instance instanceof $caller) {
 static::$_instance = new $caller;
 }

 return static::$_instance;
 }
 }

 class foo extends singleton {
 static protected $_instance = null;
 }

 class bar extends singleton {
 static protected $_instance = null;
 }

 var_dump(foo::getInstance());
 var_dump(bar::getInstance());
 var_dump(foo::getInstance());
 var_dump(bar::getInstance());
 ?

 On Nov 22, 2007 9:29 PM, Marco Kaiser [EMAIL PROTECTED] wrote:
  Hi List,
 
  just to drop my note here, i asked (i think) 2 years ago for such a
  feature to automate my singleton pattern. Not with late static
  bindings this is possible.
 
  ?php
  class singleton
  {
  static protected $_instance = null;
 
  static public function getInstance()
  {
  $caller = get_called_class();
  if (!static::$_instance instanceof $caller) {
  static::$_instance = new $caller;
  }
 
  return static::$_instance;
  }
  }
 
  class foo extends singleton
  {
  }
 
  var_dump(foo::getInstance());
  var_dump(foo::getInstance());
  ?
 
  i think this will also drop much redundant code from some frameworks. :)
  So this is one of my examples that helps much.
 
 
  --
  Marco Kaiser
 



 --
 Marco Kaiser

?php
abstract class singleton
{
   static protected $_instance = null;
   static public function getInstance()
   {
   $caller = get_called_class();
   if (!static::$_instance instanceof $caller) {
   static::$_instance = new $caller;
   }

   return static::$_instance;
   }
}

class foo extends singleton {
}

class bar extends singleton {
}

var_dump(foo::getInstance());
var_dump(bar::getInstance());
var_dump(foo::getInstance());
var_dump(bar::getInstance());
?

returns ...

object(foo)#1 (0) {
}
object(bar)#2 (0) {
}
object(foo)#1 (0) {
}
object(bar)#2 (0) {
}

in PHP 5.3.0-dev (cli) (built: Nov 20 2007 08:19:12)

I think this is great! Well done everyone. Unless I've completely
missed the point.


-- 
-
Richard Quadling
Zend Certified Engineer : http://zend.com/zce.php?c=ZEND002498r=213474731
Standing on the shoulders of some very clever giants!

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



Re: [PHP-DEV] late static binding php6

2007-11-23 Thread Richard Quadling
On 23/11/2007, Richard Quadling [EMAIL PROTECTED] wrote:
 On 22/11/2007, Marco Kaiser [EMAIL PROTECTED] wrote:
  Hi again,
 
  to explain the main idea a bit more, the code below work and moves the
  main getInstance function from the class and its possible to abstract
  this.
  it would be cool to get the protected property also into the abstract
  class. Any idea or maybe a solution in the near future?
 
  ?php
  abstract class singleton
  {
  static public function getInstance()
  {
  $caller = get_called_class();
  if (!static::$_instance instanceof $caller) {
  static::$_instance = new $caller;
  }
 
  return static::$_instance;
  }
  }
 
  class foo extends singleton {
  static protected $_instance = null;
  }
 
  class bar extends singleton {
  static protected $_instance = null;
  }
 
  var_dump(foo::getInstance());
  var_dump(bar::getInstance());
  var_dump(foo::getInstance());
  var_dump(bar::getInstance());
  ?
 
  On Nov 22, 2007 9:29 PM, Marco Kaiser [EMAIL PROTECTED] wrote:
   Hi List,
  
   just to drop my note here, i asked (i think) 2 years ago for such a
   feature to automate my singleton pattern. Not with late static
   bindings this is possible.
  
   ?php
   class singleton
   {
   static protected $_instance = null;
  
   static public function getInstance()
   {
   $caller = get_called_class();
   if (!static::$_instance instanceof $caller) {
   static::$_instance = new $caller;
   }
  
   return static::$_instance;
   }
   }
  
   class foo extends singleton
   {
   }
  
   var_dump(foo::getInstance());
   var_dump(foo::getInstance());
   ?
  
   i think this will also drop much redundant code from some frameworks. :)
   So this is one of my examples that helps much.
  
  
   --
   Marco Kaiser
  
 
 
 
  --
  Marco Kaiser

 ?php
 abstract class singleton
 {
static protected $_instance = null;
static public function getInstance()
{
$caller = get_called_class();
if (!static::$_instance instanceof $caller) {
static::$_instance = new $caller;
}

return static::$_instance;
}
 }

 class foo extends singleton {
 }

 class bar extends singleton {
 }

 var_dump(foo::getInstance());
 var_dump(bar::getInstance());
 var_dump(foo::getInstance());
 var_dump(bar::getInstance());
 ?

 returns ...

 object(foo)#1 (0) {
 }
 object(bar)#2 (0) {
 }
 object(foo)#1 (0) {
 }
 object(bar)#2 (0) {
 }

 in PHP 5.3.0-dev (cli) (built: Nov 20 2007 08:19:12)

 I think this is great! Well done everyone. Unless I've completely
 missed the point.

Also, you can make the getInstance() method final so it cannot be
overridden in sub-classes...

?php
abstract class singleton
{
   static protected $_instance = null;
   static final public function getInstance()
   {
   $caller = get_called_class();
   if (!static::$_instance instanceof $caller) {
   static::$_instance = new $caller;
   }

   return static::$_instance;
   }
}

class foo extends singleton {
public function getInstance() { return 'foobar'; }
}

class bar extends singleton {
}

var_dump(foo::getInstance());
var_dump(bar::getInstance());
var_dump(foo::getInstance());
var_dump(bar::getInstance());
?

returns ...

Fatal error: Cannot override final method singleton::getInstance() in
C:\sing.php on line 18

So, a very useful addition to the language.

-- 
-
Richard Quadling
Zend Certified Engineer : http://zend.com/zce.php?c=ZEND002498r=213474731
Standing on the shoulders of some very clever giants!

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



Re: [PHP-DEV] late static binding php6

2007-11-23 Thread Richard Quadling
On 23/11/2007, Marcus Boerger [EMAIL PROTECTED] wrote:
 Hello Richard,

   that kind of stuff is the reason we added LSB. There is only one tiny
 thing I am not to happy about. You do not at all have to declare static
 $instance. Simply because you never use it. And for that reason you guys
 have your code worng. Use the following snippet for verification:
 var_dump($u=foo::getInstance());
 var_dump($v=bar::getInstance());
 var_dump($w=foo::getInstance());
 var_dump($x=bar::getInstance());
 var_dump(array($u,$v,$w,$x));

 When you want to have a factory of singletons that can create one single
 member of every derived class than you need to add an array to store those
 inside the abstract base class. That also allows to make that member
 private and thereby disallowing any derived class to interfere with the
 static member and get rid of them to overthrow the singleton limitation...
 You also have no need for the instanceof operation with the array. See here:

 ?php
 abstract class singleton
 {
 static private $instances = array();
 static final public function getInstance()
 {
 $caller = get_called_class();
 if (!isset(self::$instances[$caller])) {
 self::$instances[$caller] = new $caller;
 }
 return self::$instances[$caller];
 }
 }

 class foo extends singleton {
 }

 class bar extends singleton {
 }

 var_dump($u=foo::getInstance());
 var_dump($v=bar::getInstance());
 var_dump($w=foo::getInstance());
 var_dump($x=bar::getInstance());
 var_dump(array($u,$v,$w,$x));
 ?

Changing bar to extend from foo gives the same results.

We have a singleton of the class bar because somewhere in the chain it
has the singleton class.

Excellent.




 Friday, November 23, 2007, 10:21:51 AM, you wrote:

  On 23/11/2007, Richard Quadling [EMAIL PROTECTED] wrote:
  On 22/11/2007, Marco Kaiser [EMAIL PROTECTED] wrote:
   Hi again,
  
   to explain the main idea a bit more, the code below work and moves the
   main getInstance function from the class and its possible to abstract
   this.
   it would be cool to get the protected property also into the abstract
   class. Any idea or maybe a solution in the near future?
  
   ?php
   abstract class singleton
   {
   static public function getInstance()
   {
   $caller = get_called_class();
   if (!static::$_instance instanceof $caller) {
   static::$_instance = new $caller;
   }
  
   return static::$_instance;
   }
   }
  
   class foo extends singleton {
   static protected $_instance = null;
   }
  
   class bar extends singleton {
   static protected $_instance = null;
   }
  
   var_dump(foo::getInstance());
   var_dump(bar::getInstance());
   var_dump(foo::getInstance());
   var_dump(bar::getInstance());
   ?
  
   On Nov 22, 2007 9:29 PM, Marco Kaiser [EMAIL PROTECTED] wrote:
Hi List,
   
just to drop my note here, i asked (i think) 2 years ago for such a
feature to automate my singleton pattern. Not with late static
bindings this is possible.
   
?php
class singleton
{
static protected $_instance = null;
   
static public function getInstance()
{
$caller = get_called_class();
if (!static::$_instance instanceof $caller) {
static::$_instance = new $caller;
}
   
return static::$_instance;
}
}
   
class foo extends singleton
{
}
   
var_dump(foo::getInstance());
var_dump(foo::getInstance());
?
   
i think this will also drop much redundant code from some frameworks.
So this is one of my examples that helps much.
   
   
--
Marco Kaiser
   
  
  
  
   --
   Marco Kaiser
 
  ?php
  abstract class singleton
  {
 static protected $_instance = null;
 static public function getInstance()
 {
 $caller = get_called_class();
 if (!static::$_instance instanceof $caller) {
 static::$_instance = new $caller;
 }
 
 return static::$_instance;
 }
  }
 
  class foo extends singleton {
  }
 
  class bar extends singleton {
  }
 
  var_dump(foo::getInstance());
  var_dump(bar::getInstance());
  var_dump(foo::getInstance());
  var_dump(bar::getInstance());
  ?
 
  returns ...
 
  object(foo)#1 (0) {
  }
  object(bar)#2 (0) {
  }
  object(foo)#1 (0) {
  }
  object(bar)#2 (0) {
  }
 
  in PHP 5.3.0-dev (cli) (built: Nov 20 2007 08:19:12)
 
  I think this is great! Well done everyone. Unless I've completely
  missed the point.

  Also, you can make the getInstance() method final so it cannot be
  overridden in sub-classes...

  ?php
  abstract class singleton
  {
 static protected $_instance = null;
 static final public function getInstance()
 {
 $caller

Re: [PHP-DEV] Disabling the built-in POST handler

2007-11-22 Thread Richard Quadling
On 21/11/2007, Hannes Magnusson [EMAIL PROTECTED] wrote:
 On Nov 21, 2007 6:30 PM, Stefanos Stamatis [EMAIL PROTECTED] wrote:
  So setting post_max_size to zero for the script with php_value in the
  apache configuration disables the built-in post form handler resulting in
  the desired behaviour!
 
  My question is whether this is the expected behavior of php that we can
  count on and can be used as a solution to our problem.

 Yes. http://www.php.net/manual/en/ini.core.php#ini.post-max-size

 -Hannes

Would it be worth stating specifically that a post-max-size of zero
inhibits $_POST/$_FILES?
-- 
-
Richard Quadling
Zend Certified Engineer : http://zend.com/zce.php?c=ZEND002498r=213474731
Standing on the shoulders of some very clever giants!

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



Re: [PHP-DEV] [PATCH] Optional scalar type hinting

2007-11-19 Thread Richard Quadling
::STRING);
   }
   }
   class Float extends Types {
   public function __construct($val) {
   parent::__construct($val, Types::FLOAT);
   }
   }
   class Object extends Types {
   public function __construct($val) {
   parent::__construct($val, Types::OBJECT);
   }
   }
   class Boolean extends Types {
   public function __construct($val) {
   parent::__construct($val, Types::BOOLEAN);
   }
   }
   function type_hint_integer(Integer $val) {
   echo $val, \n;
   }
   function type_hint_string(String $val) {
   echo $val, \n;
   }
   function type_hint_float(Float $val) {
   echo $val, \n;
   }
  
  
  
   type_hint_integer(new Integer(123));
   type_hint_string(new String(string));
   type_hint_float(new Float(0.25));
  
 
  Nice implementation, so ? Still more code to include in your code.
  Anyways, the Optional part in the subject means ... optional. Which
  means that it does not *have* to be used and that the default hinting
  will still be loose.
 
  That gives the chance to anyone to use either strongly-typed code or
  loosely-typed code. You know as much as I do that it's quite easy to
  do (implement - like you just did), but if it's not in by default,
  people won't care about doing it or implementing it.
 
  On the other hand, if it's there, some people might be tempted to use
  it, and will. But hey.. php's a loosely typed language and it'll
  definitely stay that way. But only giving the choice to someone to use
  what he feels like is quite interesting in my opinion.
 
  Anyways, no need to get all grumpy, you can just say you don't like
  the idea, that'll do just as well. Anyways, that was a thought, it's
  quite easy to implement as an extension and would be light and simple
  for anyone to either use or ignore it.
 
 
   -Hannes
  
 
 
 
  --
  David Coallier,
  Founder  Software Architect,
  Agora Production (http://agoraproduction.com)
  51.42.06.70.18

What if type hinting just generated an E_NOTICE. Nothing more for the
time being.

Call it an experimental option.

I already use hungarian notation for all my params ( cause I'm
unimaginative with my var names I suppose!), so the type hinting would
help me enforce this and reduce errors in the long run (code goes from
me to other developers who only glance at the dox)

-- 
-
Richard Quadling
Zend Certified Engineer : http://zend.com/zce.php?c=ZEND002498r=213474731
Standing on the shoulders of some very clever giants!

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



Re: [PHP-DEV] Providing Visual Studio 2005 builds (again)

2007-11-15 Thread Richard Quadling
On 14/11/2007, Steph Fox [EMAIL PROTECTED] wrote:
 Hi Richard,

  It would be useful to see some stats about actual performance
  increases from using the new runtime. If it is minimal, then
  cost/benifit isn't great and we are probably going to have to
  make-do for a while on VC6.

 Agree.

  But, if MSVC2005EE (Microsoft Visual C++ 2005 Express Edition -
  specifically chosen because of the free nature of the product -
  giving more opportunity to us unfortunates who have to normally pay
  for all of our development tools to have a go at building our own
  PHP binaries), offers a significant performance increase, then this is
  the marketing tool we use.

 'marketing tool'???

PHPx will run with these Microsoft libraries and provide a 25% on
average performance increase in real world tests sort of thing. If
the new libraries REALLY are that much better we owe it to the users
to give it to them!

  Sure, we will have to explain why you need to install a runtime
  library, but this is windows.

 And these are Windows users.

Ha. Yes. I see your point, but for those INSTALLING PHP, they would
prefer an MSI which just did it. So, bundle the libs and move on.


 Windows users unknowningly install the
  latest runtime all the time. Many MSI installers have them there
  simply because that is the safest way to install it and have you app
  run.
 
  Sure it makes the binary package bigger, so you have 2 packages - one
  with and one without. You make the recommendation that you have the
  with package if you are not sure of the difference.
 
  Even at this current time, PHP is relying on the presence of a runtime
  library. It just so happens that it is so ancient that it is not
  possible to be on windows without it.

 'Relies on the presence of' is not the same thing as 'distributes'. The
 runtime library we rely on the presence of has been shipped by MS since
 Windows 98.

  So, give 'Liz the space. Please. So those of us who will benefit from
  her expertise can do so.

 Where did anyone say she should have no space?

Ok, support then. Rather than a no we are not, but an OK, yes, good
idea, let's do it and see what the problems are.

 
  I really feel that the core developers who only deal with *nix really
  should allow those that deal with windows be allowed to do so. It has
  no impact on *nix development other than making code compliant across
  multiple platforms (a good thing, surely?)

 Couldn't agree more. Although actually most of the *nix guys have ended up
 having to load doze at some point because otherwise Windows bugs don't get
 tested/fixed.

Some of us doze users submit patches which are overlooked or ignored!

  As a windows user I feel that we need to move forward and offer
  another binary which takes advantage of a more modern run time - if
  the benefit can be expressed.

 Are you assuming a Windows user is a rarity? lol

No, I would guess that most people who INTERACT with PHP are windows
users. Most people who CODE PHP with are probably NOT windows users.
So, more *nix webservers, but more IE browsers.

Prove the benefit! Enhance the world! (to suckingly paraphrase Heroes).


 - Steph



Richard.
-- 
-
Richard Quadling
Zend Certified Engineer : http://zend.com/zce.php?c=ZEND002498r=213474731
Standing on the shoulders of some very clever giants!

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



Re: [PHP-DEV] Providing Visual Studio 2005 builds (again)

2007-11-15 Thread Richard Quadling
On 15/11/2007, Mario Brandt [EMAIL PROTECTED] wrote:
 PHPx will run with these Microsoft libraries and provide a 25% on
 average performance increase in real world tests

 Using Apache compiled with VS8 and PHP 5.2.4 compiled with VS8 bootest
 the application speed of my scripts.


 Ha. Yes. I see your point, but for those INSTALLING PHP, they would
 prefer an MSI which just did it. So, bundle the libs and move on.

 I'm one of these Win32 user. Me and others hate *.msi files.
 It puts info in the registry and you need to uninstall it over the
 control panel.
 zip pack is much easier to install / testing and removing.

So how would you expect to deal with a new MS runtime environment for PHP?

I suppose, no matter how many times the message This version of PHP
requires this pack of files from Microsoft with a link to the files
you are still going to get users complaining that their PHP doesn't
work.

Just like the number of bogus Doc bugs for the CHM being downloaded
via IE (See the warning on http://www.php.net/download-docs.php).




-- 
-
Richard Quadling
Zend Certified Engineer : http://zend.com/zce.php?c=ZEND002498r=213474731
Standing on the shoulders of some very clever giants!

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



Re: [PHP-DEV] [PATCH] Optional scalar type hinting

2007-11-15 Thread Richard Quadling
On 15/11/2007, Sam Barrow [EMAIL PROTECTED] wrote:

 I found a patch by Derick online to allow for scalar type hinting, and
 made it work with the newest snapshot of PHP 5.3. I also added the
 ability to type hint for resources. I would like to ask that it be added
 to the next PHP release. It allows type hinting for int, float, bool,
 string, resource, and object, I also added the ability to use the
 secondary keywords for all of these types (such as double, real, long,
 etc.).

 It will maintain 100% backwards compatibility, as the type hinting is
 100% optional, implemented in the same way as array/class type hinting.

 I have the patch on my PC, please let me know where and when i can
 submit it. I'd be happy to do the patching and submission myself, just
 asking for permission here.

What happens for type conversion? Is the param cast to the hinted type?

The idea of type hinting for array and class is to make sure you get
something appropriate.

Rarely would you think of an array and cast it as an integer (or vice
versa), so it makes sense.

But with a string (0), an integer (0) or a boolean (false), they are
all the same, so does this mean we would be having to cast all the
params to the function/method?




-- 
-
Richard Quadling
Zend Certified Engineer : http://zend.com/zce.php?c=ZEND002498r=213474731
Standing on the shoulders of some very clever giants!

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



Re: [PHP-DEV] Providing Visual Studio 2005 builds (again)

2007-11-14 Thread Richard Quadling
.  Is there some kind of issue with third party
  providers not being able to have the same service, just because
  they're for Windows?  If it's simply because PHP provides windows
  binaries already...if the binaries are inferior to third party
  offerings...
 
  Anyway, the offer stands to help get libraries up to speed...  I'll
  see if I can get a hold of Edin, I have space and bandwidth if that's
  his biggest issue.  I could argue with you all night Steph, but it's
  obvious you have an issue with the C runtime changing that Microsoft
  has done with its compilers, and so no matter what I say you won't
  change your opinion ;)  Anyone else (other than Steph or Stas) care to
  weigh in?
 

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




-- 
-
Richard Quadling
Zend Certified Engineer : http://zend.com/zce.php?c=ZEND002498r=213474731
Standing on the shoulders of some very clever giants!

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



[PHP-DEV] Win32 builds on snaps.php.net still down.

2007-11-08 Thread Richard Quadling
Hey!

Does anyone other than me care?

-- 
-
Richard Quadling
Zend Certified Engineer : http://zend.com/zce.php?c=ZEND002498r=213474731
Standing on the shoulders of some very clever giants!

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



[PHP-DEV] Win32 Build not updated on http://snaps.php.net.

2007-11-05 Thread Richard Quadling
Hi.

Last build for V5.3 at Nov 03, 2007 20:30 UTC

The next build says PHP 5.3 Win32 in please consult /dev/urandom.
What is this really saying?

-- 
-
Richard Quadling
Zend Certified Engineer : http://zend.com/zce.php?c=ZEND002498r=213474731
Standing on the shoulders of some very clever giants!

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



Re: [PHP-DEV] Method overloading by method signature

2007-10-17 Thread Richard Quadling
On 17/10/2007, Stanislav Malyshev [EMAIL PROTECTED] wrote:
  suit fully fitted) catch-up. (Hey when has documentation EVER been
  ahead of the game!?!).

 Always? Otherwise there would be no need for documentation, if
 everything was in the code. Some people even start with writing docs and
 only then implement the actual code. Of course, it is not always the
 case (and some code, like Zend Engine, is so obvious that no docs are
 needed anyway ;) but documentation containing more insight and more
 content than the pure code is almost always the case, especially with
 properly documented code.

So all I need to do is document this great new feature, hope no-one
notices and then come screaming saying that it doesn't work as
documented.

Hmm.

Possibly not a good way to make friends and influence people.

This feature, along with property accessibility via some sort of
read/write mechanism would be more useful to me than some other
features (like cough-cough unicode cough-cough).

It is something I am familiar with in other languages.
-- 
-
Richard Quadling
Zend Certified Engineer : http://zend.com/zce.php?c=ZEND002498r=213474731
Standing on the shoulders of some very clever giants!

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



[PHP-DEV] My thanks to the PHP community.

2007-10-16 Thread Richard Quadling
http://news.php.net/php.internals/32789

On 15/10/2007, Antony Dovgal [EMAIL PROTECTED] wrote:
 Thank you? I can't recall when I heard it last time.

Really, how about right now!

Unconditionally and without reservation, I would like to take this
opportunity to say thank you to every single developer, documenter,
debugger who has ever responded to my sometimes lengthy
comments/posts.

Without all of your skill, dedication, understanding, and more often
than not, perseverance, I would be having a harder time doing my job.

The effort you have all put into making PHP the truly successful
language it is today has allowed me to be gainfully employed for many
years.

I would like to make special mention of Nuno Lopes who, many years
ago, helped me get into the PHP documentation system and also to
Hannes Magnusson for his continual support and advice in aid of my
lack of understanding of some of the sometimes quite basic concepts of
the new PHD documentation system.

As I have in my signature, I am Standing on the shoulders of some
VERY clever giants!.

Thank you.

Richard Quadling.


-- 
-
Richard Quadling
Zend Certified Engineer : http://zend.com/zce.php?c=ZEND002498r=213474731
Standing on the shoulders of some very clever giants!

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



Re: [PHP-DEV] Method overloading by method signature

2007-10-16 Thread Richard Quadling
On 15/10/2007, Hans Moog [EMAIL PROTECTED] wrote:
 When it would be:

 ==
   function xpath(DomDocument $arg) {
 return new DomXPath($arg);
   }

   function xpath(XmlTree $arg) {
 return new DomXPath($this-loadXML($arg-getSource(;
   }

   function xpath(string $arg) {
 return new DomXPath($this-loadXML($arg));
   }
 ==

 (since when method overloding by sigantures wer put into php, scalar types 
 should be possible, too, shouldn't they?)

 I would prefer the second one because I understand the behaviour much faster 
 than analyzing the if switch (and this if switch is really simple to 
 understand because there is only one command in every block). The second 
 reason for me to select the second version is, that I am able to write better 
 documentation for each behaviour (although, in this situation there isn't 
 that much to be commented).

 -Ursprüngliche Nachricht-
 Von: Timm Friebe [mailto:[EMAIL PROTECTED]
 Gesendet: Montag, 15. Oktober 2007 20:47
 An: internals@lists.php.net
 Betreff: Re: [PHP-DEV] Method overloading by method signature

 Hi,

 [...]
  Later we added type hints to help code readability.

 Let me jump at this:

 ==
   function xpath($arg) {
 if ($arg instanceof DomDocument) {
   return new DomXPath($arg);
 } else if ($arg instanceof XmlTree) {
   return new DomXPath($this-loadXML($arg-getSource()));
 } else if (is_string($arg)) {
   return new DomXPath($this-loadXML($arg));
 } else {
   throw new IllegalArgumentException('Unsupported argument type');
 }
   }

 == vs. ==

   function xpath(DomDocument $arg) {
 return new DomXPath($arg);
   }

   function xpath(XmlTree $arg) {
 return new DomXPath($this-loadXML($arg-getSource(;
   }

   function xpath($arg) {  // Untyped = default
 if (!is_string($arg)) {
   throw new IllegalArgumentException('Unsupported argument type');
 }
 return new DomXPath($this-loadXML($arg));
   }

 ==

 If we consider the readability argument only: Which one of the above more
 readable? You decide:)

 - Timm

As the PHP Documentation may have to is starting adding multiple
signatures (Docbook has no mechanism if grouping optional parameters
it seems), it seems only fair that PHP itself should (flame-retardant
suit fully fitted) catch-up. (Hey when has documentation EVER been
ahead of the game!?!).

If this feature makes PHP (or at least some aspects of it), a typed
language, then that's OK by me. It means my code is more consistent
with other languages.




-- 
-
Richard Quadling
Zend Certified Engineer : http://zend.com/zce.php?c=ZEND002498r=213474731
Standing on the shoulders of some very clever giants!


Re: AW: [PHP-DEV] Method overloading by method signature

2007-10-15 Thread Richard Quadling
On 14/10/2007, Hans Moog [EMAIL PROTECTED] wrote:
 You are missing something. Using this new feature would be voluntarily (it is 
 optional like type hints are already).

 If you want to code the old way and you don't want to force coders to use 
 your functions correctly, you could leave out typehints an check the 
 parameters manually.

 But if you want to write strict API's, that accept only a special type of 
 parameters (and type hinted parameters were introduced to be able to do this) 
 you would still be able to accept more than one type of parameters (without 
 this additional feature you are not able to do it right now).


 You do not use type hints in your functions, thats why you don't understand 
 the need of overloding methods by parameter siganture. If you would 
 understand the need of type hints for robust applications you would 
 understand the need of overloading typehinted methods.


 Btw: You could call foo((integer) $x); to ensure the right method is called.

 Like I already said, this feature is only require for people writing complex 
 web applications, offering api's to 3rdparty coders that are very strict. If 
 you are coding a project within your company you can rely on the fact, that 
 programmers should know how to use your methods, but a 3rdparty coder who 
 extends the functionality of your product doesn't know and there should be no 
 chance to crash the application.

For what it is worth, I would find this functionality EXTREMELY useful.

The classes I create ARE used by other developers both within my
organisation and outside and as I'm currently porting GUI apps from
Delphi to web apps using PHP and missing things like type hinting of
scalars AND overloaded function defs is a pain as I now have 1 method
with a header which has to parse the parameter types to determine what
is required  to be called.

I think this is a GREAT feature. Even if it was JUST for E_STRICT OOP code.

-- 
-
Richard Quadling
Zend Certified Engineer : http://zend.com/zce.php?c=ZEND002498r=213474731
Standing on the shoulders of some very clever giants!

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



[PHP-DEV] Q. zend_parse_parameters() - allow grouping of optional parameters.

2007-10-10 Thread Richard Quadling
Hi.

From what I understand about the argument list for
zend_parse_parameters(), you separate optional parameters from
mandatory ones using pipe (|).

e.g.

if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, lll|, m,
d, y, h, n, s, ms) == FAILURE) {

In the above example, this says that there are 3 mandatory parameters
and upto 4 optional parameters.

The prototype for this looks like ...

proto bool myExampleDateFunc(int month, int day, int year, [int hour
[, int min [, int sec [,int msec)

Is there a way to make the prototype ...

proto bool myExampleDateFunc(int month, int day, int year, [int hour,
int min, int sec[, int msec]])

So, making this function accept 3 or 6 or 7 parameters only.

I'm guessing not, but I'm guessing. I think this has to be checked using ...

switch (ZEND_NUM_ARGS()) {

after parsing the parameters and generate an error for ZEND_NUM_ARGS = 4 or 5.

Regards,

Richard.

-- 
-
Richard Quadling
Zend Certified Engineer : http://zend.com/zce.php?c=ZEND002498r=213474731
Standing on the shoulders of some very clever giants!

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



Re: [PHP-DEV] substr/array_slice in []

2007-10-09 Thread Richard Quadling
On 09/10/2007, Scott MacVicar [EMAIL PROTECTED] wrote:
 Sure it works fine when it's been in the language for several years and
 it's guaranteed to be available in the version provided by your hosting
 company.

 In reality this isn't the case with PHP so everyone will end up using
 the older method to support backwards compatibility or mixing it and
 causing confusion.

 Scott

OOI. If the ISP is not on the version which would have this particular
feature, how would I create a fallback solution for my clients?

Something like PEAR's PHP Compat library. Very useful for giving
support to newer functionality.

I think I wouldn't bother with the new feature for a while. Maybe if
it was major version only (V5 vs V6 is nice and clean, but V5.2.4 vs
V5.2.5 is not so easy for some clients to understand that new
functionality - rather than bug fixes - requires an upgrade).

But having a working method already seems redundant, simply for syntactic sugar.



 Stefan Walk wrote:
  Antony Dovgal wrote:
  Right, so let's force other people to learn crappy unreadable syntax
  duplicating nice and clear function call
  Oddly, this crappy unreadable syntax doesn't lead to any confusion or
  complaints for newbies of languages like python or ruby, judging from
  the IRC channels. And it's also odd that ruby users, where String#[] is
  just an alias for String#slice, prefer this crappy unreadable syntax
  over a nice and clear method call. One starts to wonder ...
 
  Regards,
  Stefan

-- 
-
Richard Quadling
Zend Certified Engineer : http://zend.com/zce.php?c=ZEND002498r=213474731
Standing on the shoulders of some very clever giants!

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



Re: [PHP-DEV] Class Posing

2007-10-02 Thread Richard Quadling
On 02/10/2007, David Zülke [EMAIL PROTECTED] wrote:
 would it be possible to overload final classes?

 - David


 Am 02.10.2007 um 11:32 schrieb Sebastian Bergmann:

   From [1]:
 
 Objective-C permits a class to wholly replace another class
  within a
 program. The replacing class is said to pose as the target class.
 All messages sent to the target class are then instead received by
 the posing class.
 
 There are several restrictions on which classes can pose:
 
   * A class may only pose as one of its direct or indirect
 superclasses.
 
   [The other restrictions do not apply to PHP]
 
   Earlier this year, Johannes implemented class posing for PHP as
  follows:
 
 ?php
 class Foo {}
 class Bar extends Foo {}
 
 function new_overload($className)
 {
 if ($className == 'Foo') {
 return new Bar;
 }
 
 // ...
 }
 
 $o = new Foo;
 // $o is an object of Foo.
 
 register_new_overload('new_overload');
 
 $o = new Foo;
 // $o is an object of Bar.
 ?
 
   We (Johannes, Marcus, Sara, and myself) then discussed where to
  put this
   functionality. Outside of core, there were two places that both make
   sense: pecl/operator and pecl/runkit.
 
   However, to make this a viable mechanism that can be used in tools
  such
   as PHPUnit (for which I could really use this functionality), we
  agreed
   that it actually belongs into the core.
 
   Opinions? Needless to say that I would love to see this in PHP
  5.3 ;-)
 
   --
   [1] http://en.wikipedia.org/wiki/Objective_C#Posing

You're code looks like a factory. Is that your intention? Maybe
__factory would be a more obvious name?



-- 
-
Richard Quadling
Zend Certified Engineer : http://zend.com/zce.php?c=ZEND002498r=213474731
Standing on the shoulders of some very clever giants!


Re: [PHP-DEV] VS 2005 Support for 5.3?

2007-10-02 Thread Richard Quadling
On 02/10/2007, Pierre [EMAIL PROTECTED] wrote:
 Hi,

 One important thing we forgot to discuss is to drop VS6 support fin
 5.3 and finally move to VS2005.

 It has a couple of side effects but it is a one time job and should
 make our life easier on windows from 5.3 and up.

 Comments?

 Cheers,
 --Pierre

Would making the windows compiler MS VC++ Express Edition be a
better solution? That way you have what is considered a free MS
compiler.



-- 
-
Richard Quadling
Zend Certified Engineer : http://zend.com/zce.php?c=ZEND002498r=213474731
Standing on the shoulders of some very clever giants!

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



Re: [PHP-DEV] Re: Global namespace?

2007-09-12 Thread Richard Quadling
On 11/09/2007, Marcus Boerger [EMAIL PROTECTED] wrote:
 Hello emo,

 Tuesday, September 11, 2007, 4:50:01 PM, you wrote:

  I believe I read somewhere that it will look like this:

  ::class_b-method_c();

 This is the preferred way as it doesn't introduce a new keyword. Also this
 is inline with other languages.


Thank you.

-- 
-
Richard Quadling
Zend Certified Engineer : http://zend.com/zce.php?c=ZEND002498r=213474731
Standing on the shoulders of some very clever giants!

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



[PHP-DEV] Global namespace?

2007-09-11 Thread Richard Quadling
Assume for some reason you have an entity in a namespace which has the
same name as something in the global namespace.

Within the namespace, you wouldn't need to use the namespace prefix
(maybe it has been aliased, subclassed or some other reference).

How would you access the global namespaced entity?

For variables, object instances, references, etc., you can use
$GLOBALS[], but if the namespace is going to look like ...

namespace_a::class_b-method_c();

Should there be an alias for global?

global::class_b-method_c();

Or have I missed something?

-- 
-
Richard Quadling
Zend Certified Engineer : http://zend.com/zce.php?c=ZEND002498r=213474731
Standing on the shoulders of some very clever giants!

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



[PHP-DEV] Win32 Build not updated on http://snaps.php.net.

2007-09-06 Thread Richard Quadling
Hi.

No Win32 snapshot built since Sep 01, 2007 16:30 UTC.

Any reason?

Regards,

Richard Quadling.

-- 
-
Richard Quadling
Zend Certified Engineer : http://zend.com/zce.php?c=ZEND002498r=213474731
Standing on the shoulders of some very clever giants!

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



Re: [PHP-DEV] [PATCH] disallow arguments by ref in magic methods

2007-08-30 Thread Richard Quadling
On 30/08/2007, Antony Dovgal [EMAIL PROTECTED] wrote:
 Hello.

 I'd like to commit these two patches (for HEAD and 5_2 appropriately).
 The patches disallow declaring any magic methods as accepting arguments by 
 ref (which makes no sense anyway).

Why not. Sure, on __set()/__get()/__unset() it could be considered
pointless, but for __call()?

 If there are no objections, I'm going to commit them later in the evening.



-- 
-
Richard Quadling
Zend Certified Engineer : http://zend.com/zce.php?c=ZEND002498r=213474731
Standing on the shoulders of some very clever giants!

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



Re: [PHP-DEV] What is the use of unicode.semantics in PHP 6?

2007-08-21 Thread Richard Quadling
On 21/08/07, Jani Taskinen [EMAIL PROTECTED] wrote:
 On Tue, 2007-08-21 at 08:18 +0200, Derick Rethans wrote:
  On Mon, 20 Aug 2007, Andi Gutmans wrote:
   Anyway, don't want to reignite the thread here. I will take it offline
   to discuss with the people who have been involved in this project and
   discuss further. The mailing list here isn't exactly working.
 
  What makes you think that any other group can agree on this?

 When you can't get people to agree with you, choose the people who
 already agree with you..or can't afford not to agree. ;)

 --Jani

I'll agree with anyone who makes it worth my while!

-- 
-
Richard Quadling
Zend Certified Engineer : http://zend.com/zce.php?c=ZEND002498r=213474731
Standing on the shoulders of some very clever giants!

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



Re: [PHP-DEV] Renaming namespaces to packages

2007-08-17 Thread Richard Quadling
Oh dear. I thought the general feeling was to stick with namespaces?

On 17/08/07, Johannes Schlüter [EMAIL PROTECTED] wrote:
 Hi,

 I've updated the patch to be compatible with Dmitry's latest changes:
 http://schlueters.de/~johannes/php/zend_namespace_to_package_20070817.diff

 johannes

 On Fri, 2007-08-10 at 11:26 +0200, Johannes Schlüter wrote:
  Hi,
 
  I think we reached the consensus to rename namespaces to packages as our
  implementation is more package-like. Therefore I wrote the corresponding
  patch which tries to get rid of all namespaces and ns (well, not all
  ns only the namespace-related ones of course) used in the code.
  Additionally I changed all package-tests. Any objections?
 
  Does anybody (with the move-on-CVS-server powers) care about the history
  of the tests? Then please cp ZendEngine2/tests/ns_* to pkg_* there else
  I'll do a simple cvs rm and cvs add.
 
  The patch is at
  http://schlueters.de/~johannes/php/zend_namespace_to_package.diff and
  the tarball with the changed tests at
  http://schlueters.de/~johannes/php/zend_package_tests.tar.bz2
 
  johannes
 

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




-- 
-
Richard Quadling
Zend Certified Engineer : http://zend.com/zce.php?c=ZEND002498r=213474731
Standing on the shoulders of some very clever giants!


Re: [PHP-DEV] Nowdocs revised

2007-08-16 Thread Richard Quadling
On 16/08/07, Gwynne Raskind [EMAIL PROTECTED] wrote:
 On Aug 15, 2007, at 2:00 PM, Christopher Jones wrote:
  Did you get any further with merging this?  It would help users of
  the XQuery language.
 
  If I understand your intent, I would be able to change the code
  fragment
  below to use a nowdoc, and not have to escape the XQuery $i variables.
 
  Chris
 
 
  ?php
 
  $c = oci_connect(hr, hrpwd, localhost/orcl);
 
  $xq = END
  select column_value
  from xmltable('for \$i in ora:view(locations) return \$i')
  END;
 
  $s = oci_parse($c, $xq);
  oci_execute($s);
  while ($row = oci_fetch_row($s))
var_dump($row);
  ?

 I didn't get any further, no :(. The decision of whether to merge the
 nowdocs patch is out of my hands now, since I don't have source
 karma. However, since the main thing standing in the way of its
 implementation was concern over the usefulness, your comment is very
 helpful, and I'd like to open the topic for discussion again on the
 list, if no one out there has any objection :)

Being able to code templates within PHP rather than as an external
file without any escaping or variable expansion _is_ useful.


-- 
-
Richard Quadling
Zend Certified Engineer : http://zend.com/zce.php?c=ZEND002498r=213474731
Standing on the shoulders of some very clever giants!

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



Re: [PHP-DEV] Renaming namespaces to packages

2007-08-13 Thread Richard Quadling
On 10/08/07, Stanislav Malyshev [EMAIL PROTECTED] wrote:
 My perception is that when people talk about namespaces they usually
 mean logical separation of things in, well, naming space, and when they
 talk packages they usually mean files on disk and putting things into
 files and finding which thing is in which file. Our implementation is
 much more former than the later. Of course, my perception is mine, and
 everybody is entitled to have their own ones, but I would very much like
 to hear an argument which is not a Siamese twin of because C++
 namespaces have braces and PHP ones don't. If that would be the only
 reason, I don't think it is a good one. If there are more reasons - I
 would very much like to hear it before we rush forward and commit things
 that would influence PHP for next 10 years.

I don't use C#/C++, but that is what I understand a namespace to be.

We hear issues about polluting the global namespace, as I understand
it, this is having too many things which are global and this can lead
to other libraries or packages having conflicting names when they are
introduced. So by having other namespaces, we can group related
entities (classes, functions, variables). External to the namespace,
everything within it has a prefix. Ideally the namespace will be
unique (not 100% but the namespace is only required for external code
to access the content of the namespace, so, in theory, a single line
of code is required to be altered to use a different namespace (I
think). Internally, the namespace is not required (I think).

A package is something completely different. It may be a library of
code (or several libraries) or an application or something else
entirely. It may or may not implement a namespace (or even have
multiple namespaces). A newbie coming across PEAR for the first time
will see the word packages and I would suggest that trying to
separate the meanings of the word packages at this stage would
require more than normal newbie enthusiasm.

I would say a namespace is a programmers thing, whereas a package is
more of a distribution thing.

You code using namespaces to preserve your classes/functions/variables
from global namespace pollution.

When it comes to release the code, you would have a package which
could indicate dependencies on other packages (like PEAR with its
dependency support for example).

So, for what it is worth, namespaces should be called namespaces.

Richard.



-- 
-
Richard Quadling
Zend Certified Engineer : http://zend.com/zce.php?c=ZEND002498r=213474731
Standing on the shoulders of some very clever giants!

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



Re: [Fwd: Re: [PHP-DEV] Renaming namespaces to packages]

2007-08-13 Thread Richard Quadling
On 13/08/07, Tijnema [EMAIL PROTECTED] wrote:
 Since JavaScript (or ECMAScript) doesn't have namespaces, people that
 hear the name namespace for php will either don't know what it is, or
 think that it's the same as the C implementation.

 Tijnema

I don't know what namespaces look like in other langs, but the idea of
a namespace is common to many languages and promoting encapsulation
to stop adding things to the global namespace is common also.

namespace works very well for what it does (as I see it).


-- 
-
Richard Quadling
Zend Certified Engineer : http://zend.com/zce.php?c=ZEND002498r=213474731
Standing on the shoulders of some very clever giants!

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



Re: [PHP-DEV] PHP-taint update

2007-08-10 Thread Richard Quadling
On 10/08/07, Guilherme Blanco [EMAIL PROTECTED] wrote:
 Hi,

 It seems you had an interesting idea, but AFAIK it'll not incorporated
 in core by PHP Team.
 Yeah, sounds bad, but you cannot simply turn all variables into
 objects and try to get them.

 Seems you're trying something like that:

 $_GET['foo']-asString(); // echo: Bar

 This will never happen, PHP will not change its behavior to fullfil it.
 I already thought like you and I even spent some time to develop a
 tool to simplify my job. The concept you try to implement is named
 Poka-Yoke (http://en.wikipedia.org/wiki/Poka_yoke) - and please
 again... do not tell me this is like Pokémon.

 I already asked here when I was developing this feature about a
 limitation PHP currently has, but this is not the current discussion.

 Just to let you know, if you are thinking to do something as I already
 showed you as example, forget it. If you are trying something
 different, like:

 taint_string( $_GET['foo'] ); // echo: Bar

 Then you need to think correctly what do you want to achieve. There
 are zillions of PHP applications running out there and none of them
 will be converted to use taint-package.

 The first example illustrate how the PHP should behavior with a taint
 extension; and access the data directly: $_GET['foo'] should throw an
 error.

 My idea: Keep things simple and validate all your data using PHP. You
 do not have to go behind the scenes and create a C library to
 achieve it.

 If you are interested, I already implemented the PokaYoke approach and
 I put it available for you at:
 http://blog.bisna.com/files/PokaYoke.zip
 I also published the running package: http://blog.bisna.com/files/PokaYoke/
 Take a look at the examples... I published the phps files if you are
 lazy and do not want to download the zip file. You can incorporate the
 module and keep it project specific.
 My implementation was never being released to public, but it works as
 expected. It's better to make a project specific feature and use it
 instead of try to create a module.


 Best regards,


 On 8/9/07, Wietse Venema [EMAIL PROTECTED] wrote:
  Late last year I started a discussion on this list with a proposal
  to add Perl/Ruby-like taint support to PHP - a feature that a
  developer may turn on to find out where to insert explicit cleaning
  operations to avoid code injection etc. vulnerabilities.  With
  applications that are explicitly written to be taint ware, taint
  support may also help at run-time as an additional safety net.
 
  In the unavoidable trade-off between performance and developer
  impact, this approach minimizes the performance hit; the developer
  provides the explicit cleaning operations. Other taint-for-PHP
  approaches make a different trade-off; they typically avoid developer
  impact altogether, but come at the cost of a larger performance hit.
 
  After a bunch of other work that needed to be done I've resumed
  work on PHP and I'm currently working on a rough prototype that
  supports taint in the core and in a bunch of standard built-ins.
  Overhead is minimal because it's just setting and testing a few
  normally unused bits in the zval structure.  I expect to get some
  actual performance data once the implementation is complete enough,
  and to have a first implementation out the door sometime in September.
 
  Wietse
 
  --
  PHP Internals - PHP Runtime Development Mailing List
  To unsubscribe, visit: http://www.php.net/unsub.php
 
 


 --
 Guilherme Blanco - Web Developer
 CBC - Certified Bindows Consultant
 Cell Phone: +55 (16) 9166-6902
 MSN: [EMAIL PROTECTED]
 URL: http://blog.bisna.com
 São Carlos - SP/Brazil


Marco Tabini wrote a great article in php|Architect (Vol 5 Iss 2 Feb
2006 Pgs 16-24) on Poka Yoke.



-- 
-
Richard Quadling
Zend Certified Engineer : http://zend.com/zce.php?c=ZEND002498r=213474731
Standing on the shoulders of some very clever giants!


Re: [PHP-DEV] PHP-taint update

2007-08-10 Thread Richard Quadling
On 10/08/07, Guilherme Blanco [EMAIL PROTECTED] wrote:
 Hi,

 It seems you had an interesting idea, but AFAIK it'll not incorporated
 in core by PHP Team.
 Yeah, sounds bad, but you cannot simply turn all variables into
 objects and try to get them.

 Seems you're trying something like that:

 $_GET['foo']-asString(); // echo: Bar

 This will never happen, PHP will not change its behavior to fullfil it.
 I already thought like you and I even spent some time to develop a
 tool to simplify my job. The concept you try to implement is named
 Poka-Yoke (http://en.wikipedia.org/wiki/Poka_yoke) - and please
 again... do not tell me this is like Pokémon.

 I already asked here when I was developing this feature about a
 limitation PHP currently has, but this is not the current discussion.

 Just to let you know, if you are thinking to do something as I already
 showed you as example, forget it. If you are trying something
 different, like:

 taint_string( $_GET['foo'] ); // echo: Bar

 Then you need to think correctly what do you want to achieve. There
 are zillions of PHP applications running out there and none of them
 will be converted to use taint-package.

 The first example illustrate how the PHP should behavior with a taint
 extension; and access the data directly: $_GET['foo'] should throw an
 error.

 My idea: Keep things simple and validate all your data using PHP. You
 do not have to go behind the scenes and create a C library to
 achieve it.

 If you are interested, I already implemented the PokaYoke approach and
 I put it available for you at:
 http://blog.bisna.com/files/PokaYoke.zip
 I also published the running package: http://blog.bisna.com/files/PokaYoke/
 Take a look at the examples... I published the phps files if you are
 lazy and do not want to download the zip file. You can incorporate the
 module and keep it project specific.
 My implementation was never being released to public, but it works as
 expected. It's better to make a project specific feature and use it
 instead of try to create a module.


 Best regards,


 On 8/9/07, Wietse Venema [EMAIL PROTECTED] wrote:
  Late last year I started a discussion on this list with a proposal
  to add Perl/Ruby-like taint support to PHP - a feature that a
  developer may turn on to find out where to insert explicit cleaning
  operations to avoid code injection etc. vulnerabilities.  With
  applications that are explicitly written to be taint ware, taint
  support may also help at run-time as an additional safety net.
 
  In the unavoidable trade-off between performance and developer
  impact, this approach minimizes the performance hit; the developer
  provides the explicit cleaning operations. Other taint-for-PHP
  approaches make a different trade-off; they typically avoid developer
  impact altogether, but come at the cost of a larger performance hit.
 
  After a bunch of other work that needed to be done I've resumed
  work on PHP and I'm currently working on a rough prototype that
  supports taint in the core and in a bunch of standard built-ins.
  Overhead is minimal because it's just setting and testing a few
  normally unused bits in the zval structure.  I expect to get some
  actual performance data once the implementation is complete enough,
  and to have a first implementation out the door sometime in September.
 
  Wietse
 
  --
  PHP Internals - PHP Runtime Development Mailing List
  To unsubscribe, visit: http://www.php.net/unsub.php
 
 


 --
 Guilherme Blanco - Web Developer
 CBC - Certified Bindows Consultant
 Cell Phone: +55 (16) 9166-6902
 MSN: [EMAIL PROTECTED]
 URL: http://blog.bisna.com
 São Carlos - SP/Brazil

Marco Tabini wrote a great article in php|Architect (Vol 5 Iss 2 Feb
2006 Pgs 16-24) on Poka Yoke.

http://www.phparch.com/issue.php?mid=74

-- 
-
Richard Quadling
Zend Certified Engineer : http://zend.com/zce.php?c=ZEND002498r=213474731
Standing on the shoulders of some very clever giants!


Re: [PHP-DEV] Getting Windows exec to work better.

2007-08-10 Thread Richard Quadling
On 09/08/07, Tim Starling [EMAIL PROTECTED] wrote:
 Richard Quadling wrote:

 On 09/08/07, Nuno Lopes [EMAIL PROTECTED] wrote:
 
 
 Things are not that simple.
 I would advise you to read a more than one year thread about the very same
 subject: http://marc.info/?l=php-devm=113919491216978
 
 
 
 
 Ok. Thanks for the link. I have read similar notes but no response as
 to why the patches supplied have NOT been committed.
 
 
 My patch wasn't committed because it didn't supply a backwards
 compatibility option and nobody provided one. It should be a fairly
 simple task.

 -- Tim Starling

Being slightly sarcy, the current mechanism DOESN'T work unless you
know about wrapping the entire string in double quotes. So, we are
going from a broken mechanism to a working mechanism. I don't see why
BC cannot be broken for this!?
-- 
-
Richard Quadling
Zend Certified Engineer : http://zend.com/zce.php?c=ZEND002498r=213474731
Standing on the shoulders of some very clever giants!

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



[PHP-DEV] Getting Windows exec to work better.

2007-08-09 Thread Richard Quadling
Hi.

http://bugs.php.net/bug.php?id=25361

I supplied a patch to fix this bug.

The issue is NOT a PHP bug, but a that's how it is on windows issue.

On *nix, if you want to exec a program via PHP whose program name or
parameters contain spaces, do you need to use a pair of double quotes
around the name/parameter? If so, are there any issues if you have
many sets of double quotes? If not, then this is a difference between
*nix and windows for the operation of PHP.

With the patch it should deal with this, allowing PHP userland code to
operate in the same way on both platforms.

If someone could take a look, I'd be grateful.

Richard.

-- 
-
Richard Quadling
Zend Certified Engineer : http://zend.com/zce.php?c=ZEND002498r=213474731
Standing on the shoulders of some very clever giants!

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



Re: [PHP-DEV] Getting Windows exec to work better.

2007-08-09 Thread Richard Quadling
On 09/08/07, Nuno Lopes [EMAIL PROTECTED] wrote:
 Things are not that simple.
 I would advise you to read a more than one year thread about the very same
 subject: http://marc.info/?l=php-devm=113919491216978

 Nuno


 - Original Message -
 From: Richard Quadling [EMAIL PROTECTED]
 To: PHP Developers Mailing List internals@lists.php.net
 Sent: Thursday, August 09, 2007 8:43 AM
 Subject: [PHP-DEV] Getting Windows exec to work better.


  Hi.
 
  http://bugs.php.net/bug.php?id=25361
 
  I supplied a patch to fix this bug.
 
  The issue is NOT a PHP bug, but a that's how it is on windows issue.
 
  On *nix, if you want to exec a program via PHP whose program name or
  parameters contain spaces, do you need to use a pair of double quotes
  around the name/parameter? If so, are there any issues if you have
  many sets of double quotes? If not, then this is a difference between
  *nix and windows for the operation of PHP.
 
  With the patch it should deal with this, allowing PHP userland code to
  operate in the same way on both platforms.
 
  If someone could take a look, I'd be grateful.

Ok. Thanks for the link. I have read similar notes but no response as
to why the patches supplied have NOT been committed.

IIRC ...

[2007-08-03 10:03:00] Pierre we don't care about 9x
[2007-08-03 10:03:27] Pierre RichardQ, did you test it on recent
windows too? I wonder if we can have more tests about this problem (if
possible)

Is PHP on 9x supported?

I'm using XP, and from the command line, calling ...

%comspec% /s /c program name here with spaces parameter here with spaces

works fine.

e.g.

%comspec% /c C:\Program Files\Internet Explorer\iexplore.exe
http://www.google.com/search?q=php with spaces

Loads internet explorer with the appropriate google page.

In PHP ...

?php
exec('C:\Program Files\Internet Explorer\iexplore.exe
http://www.google.com/search?q=php with spaces');
?

as does ...

cd Program Files\Internet Explorer
%comspec% /s /c iexplore.exe http://www.google.com/search?q=php with spaces



But having to wrap your entire command line with quotes is not
consistent with *nix platforms. And for the sake of a few additional
characters in the exec method for windows (with the split for NT+ vs
9x), then this would save a lot of headache and once again, make PHP
windows compatible.


-- 
-
Richard Quadling
Zend Certified Engineer : http://zend.com/zce.php?c=ZEND002498r=213474731
Standing on the shoulders of some very clever giants!

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



[PHP-DEV] Patch for bug #25361

2007-08-02 Thread Richard Quadling
Hi.

Whilst 25361 is not a PHP bug per se, the patch I've built (but can't
test) should deal with it.

The patch is available at http://pastie.caboo.se/84303

If you need more info, I'm more than willing to help out.

Ashar Lohmar [EMAIL PROTECTED] put me onto this fix - he had a
similar issue with wscript.

Regards,

Richard Quadling.

-- 
-
Richard Quadling
Zend Certified Engineer : http://zend.com/zce.php?c=ZEND002498r=213474731
Standing on the shoulders of some very clever giants!

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

[PHP-DEV] Alternative to previously suggested patch.

2007-08-02 Thread Richard Quadling
Hi.

It seems that the /S is not required.

http://pastie.caboo.se/84306 may be a simpler solution.



-- 
-
Richard Quadling
Zend Certified Engineer : http://zend.com/zce.php?c=ZEND002498r=213474731
Standing on the shoulders of some very clever giants!

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



Re: [PHP-DEV] Re: multi-threaded run-tests.php

2007-07-25 Thread Richard Quadling

On 25/07/07, Nuno Lopes [EMAIL PROTECTED] wrote:

So here it is my first attempt:
http://gcov.php.net/~nlopess/multi_threaded_run_tests.txt
WARNING: The patch is ugly and the output of the script isn't the prettiest.

Anyway, for automated testing seems to be good enough.

Nuno

P.S.: after this little hack, I also start to feel that run-tests.php should
be rewritten :P


Nuno Lopes [EMAIL PROTECTED] wrote:
 Hi,

 Recently we have moved http://gcov.php.net to a new (and much faster)
 server. This allowed us to reduce the time to build all branches to just
 2 days (compared with almost one week that would take previously).
 However I'm still not happy :P The server has 2x2 CPU cores and I would
 like to use them :) Currently I can speed-up the make process, because it
 can be parallelized (with -j xx). But the major time is still spent with
 run-tests.php.

 So, what I would like to propose is a multi-threaded version of
 run-tests.php. We could spawn x processes (configurable) and one of them
 would test y extensions (I think it's better to have each extension's
 tests tested serially or they may break, because they may use the same
 resources: BDs, files, etc..).

 Any comments?

 Thanks,
 Nuno


Hey Nuno, you should stop looking at things. PhD and now run-tests.
Soon you'll be taking a look at the php-src and thinking, pah, look
what those idiots have done, time for a rewrite!. :-)


--
-
Richard Quadling
Zend Certified Engineer : http://zend.com/zce.php?c=ZEND002498r=213474731
Standing on the shoulders of some very clever giants!

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



Re: [PHP-DEV] Re: SNAPS+SNAPSPecl different to Pecl4Win

2007-07-13 Thread Richard Quadling

On 12/07/07, Gaetano Giunta [EMAIL PROTECTED] wrote:

I think I finally have something demoable, regarding the possibility of
extending pecl4win to offer compiled dlls of the released version pf
pecl packages, besides the compiled cvs version.

The build process is almost ok:
+ two separate build environments (incl. pecl trees) are used: one for
pecl cvs, one for packaged versions
+ after pulling via http the released packages from pecl.php.net, if
file config.win32 is missing. it is pulled in from cvs. This brought
total compiled dll count (for php 5.2.3) up to 38 (there are 3/4
config.w32 files that still need to be patched by hand, but you only
have to do it once)
+ I still have to sort out some troubles in building single extensions...

A modified version of the pecl4win site is available here:
http://gggeek.altervista.org/sw/pecl4in/
Please note that all links on the pages are broken (no postgres support
on that shared host, so I took snapshots of the actual php scripts), you
can only access the pages via the main index.
It is built on a very small, hand inserted data set, with the only
purpose of testing php+sql code.

There is a lot more info than before available, but I somehow have the
feeling that the disposition is  messy. Any suggestion for a better
layout/infoset is welcome.
Please note that:
+ page titles / table column headers have been reworked a bit, for
greater consistency
+ the single ext.page layout has seen a column/row swap to accommodate
many releases of the same extension
+ a link back to pecl has been added on the single extension page
+++ there is a huge inconsistency between pecl and pecl4win: whereas the
former uses the term PACKAGE, the latter uses EXTENSION. Maybe it would
be a good idea to fix this?

Bye
Gaetano

ps: I'm still polishing the code, but it is available to everybody who
requests it...

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




http://gggeek.altervista.org/sw/pecl4win/ if you hadn't already guessed.

--
-
Richard Quadling
Zend Certified Engineer : http://zend.com/zce.php?c=ZEND002498r=213474731
Standing on the shoulders of some very clever giants!

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



Re: [PHP-DEV] What is the use of unicode.semantics in PHP 6?

2007-07-11 Thread Richard Quadling

On 11/07/07, Evert | Rooftop [EMAIL PROTECTED] wrote:

Larry Garfield wrote:

 Top 10 by what metric?  If I had to guess based on market share, I'd say
 (unordered):

 Drupal
 Squirrelmail
 WordPress
 phpMyAdmin
 MediaWiki
 Joomla
 PHPBB


That will keep me busy =)

Evert



Would it also be worth checking some of the frameworks too? Prado, eZ, Zend?
--
-
Richard Quadling
Zend Certified Engineer : http://zend.com/zce.php?c=ZEND002498r=213474731
Standing on the shoulders of some very clever giants!

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



Re: [PHP-DEV] CVS Account Request: bugra

2007-07-09 Thread Richard Quadling

Make a request to [EMAIL PROTECTED]

There is a Turkish translation
(http://www.php.net/manual/tr/index.php), but it is defunct as the
preface was last made on 17th July 2004.




On 09/07/07, Bugra Yazar [EMAIL PROTECTED] wrote:

Greetings,
I'm using Php over 5 years and I really would like to help translation of Php 
Documentation. As far as i see there is a lot of work in Turkish Documentation 
(it is even not in the list), so i decided to spend my spare time for 
translating, besides I can use both English and Turkish fluently.
Best regards,
Bugra Yazar

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





--
-
Richard Quadling
Zend Certified Engineer : http://zend.com/zce.php?c=ZEND002498r=213474731
Standing on the shoulders of some very clever giants!

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



Re: [PHP-DEV] What is the use of unicode.semantics in PHP 6?

2007-07-06 Thread Richard Quadling

On 06/07/07, Antony Dovgal [EMAIL PROTECTED] wrote:

On 06.07.2007 15:32, Richard Quadling wrote:
 If Unicode had been an extension (one of those that are part of the
 core and cannot be disabled) with its own
 classes/exceptions/functions/etc, then everyone would have been happy.

Moreover, we do have such an extension, it's called mbstring and you can use 
it even in PHP4.
But the point is that it's _just an extension_, hence the Unicode support is 
far far from full.

 Unicode is a great idea, but I don't use unicode at the moment, but
 I'd still like to have PHP6 when it is officially released without
 having to do major work to make my code compliant AND without having
 to turn Unicode off.

If you don't need Unicode, you don't need PHP6.
It's that simple.


So, all the time and effort going into PHP6 is for 1 maybe-used set of
functionality which also seems to slow down the entire system. I know
I MUST be missing something here.



--
-
Richard Quadling
Zend Certified Engineer : http://zend.com/zce.php?c=ZEND002498r=213474731
Standing on the shoulders of some very clever giants!

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



Re: [PHP-DEV] What is the use of unicode.semantics in PHP 6?

2007-07-06 Thread Richard Quadling

On 06/07/07, Antony Dovgal [EMAIL PROTECTED] wrote:

On 06.07.2007 14:04, Lukas Kahwe Smith wrote:
 To me it boils down how we want to maintain the fork:

 1) PHP5 and PHP6
 2) PHP6 unicode off/on (with PHP5 in maintenance mode)

 Considering that people will not jump on PHP6 immediately anyways, I
 think 1) is more realistic, if we make best efforts to back port new
 features to PHP5, but still require that new features go into PHP6
 first. Some features might not get back ported and that is a somewhat
 unfriendly nudge towards PHP6. So it goes.

I tend to agree with this POV more and more.

Especially considering this:
--
 Rasmus Lerdorf wrote:

 So yes, the only real customers for this full Unicode mode in PHP 6 are
 going to be the folks that have full control over their servers and
 their software which will likely limit it to hosted services and exclude
 large PHP software packages that will necessarily need to be written to
 be portable.
--

If we admit that we release a special PHP version for a very limited set
of users then keeping that On/Off switch makes no sense to me.
And it's not about choice, customers DO have a choice - either it's PHP5 (which 
will
still be there for the next 10 years at the very least) or PHP6 aka Unicode PHP.

You don't by a Porsche if you need a taxi, why would you install PHP6 if you 
don't need Unicode?
New features? Let's just agree that we can (and definitely will) backport all 
the fancy looking
new features from PHP6 to PHP5 and both these branches can live together 
happily.

 This way the PHP6 code base stays lean and people can realistically code
 against PHP6. Hosters will hopefully offer both PHP5 and PHP6. I doubt
 that many hosters would be interested in offering 3 versions at once
 (PHP5, PHP6 unicode on/off).


If Unicode had been an extension (one of those that are part of the
core and cannot be disabled) with its own
classes/exceptions/functions/etc, then everyone would have been happy.
Unicode is a great idea, but I don't use unicode at the moment, but
I'd still like to have PHP6 when it is officially released without
having to do major work to make my code compliant AND without having
to turn Unicode off.

For those that need it, then they can code for it. For those that
don't they still get all the other improvements in PHP6 and without
the reported speed issues as they are not using the extension.

This seems like a winner to me.


-
Richard Quadling
Zend Certified Engineer : http://zend.com/zce.php?c=ZEND002498r=213474731
Standing on the shoulders of some very clever giants!

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



Re: [PHP-DEV] What is the use of unicode.semantics in PHP 6?

2007-07-06 Thread Richard Quadling

On 06/07/07, Antony Dovgal [EMAIL PROTECTED] wrote:

On 06.07.2007 15:32, Richard Quadling wrote:
 If Unicode had been an extension (one of those that are part of the
 core and cannot be disabled) with its own
 classes/exceptions/functions/etc, then everyone would have been happy.

Moreover, we do have such an extension, it's called mbstring and you can use 
it even in PHP4.
But the point is that it's _just an extension_, hence the Unicode support is 
far far from full.


Why couldn't mbstring be upgraded to offer full Unicode support?

--
-
Richard Quadling
Zend Certified Engineer : http://zend.com/zce.php?c=ZEND002498r=213474731
Standing on the shoulders of some very clever giants!

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



Re: [PHP-DEV] What is the use of unicode.semantics in PHP 6?

2007-07-06 Thread Richard Quadling

On 06/07/07, Lukas Kahwe Smith [EMAIL PROTECTED] wrote:

Richard Quadling wrote:

 So, all the time and effort going into PHP6 is for 1 maybe-used set of
 functionality which also seems to slow down the entire system. I know
 I MUST be missing something here.

yes you are missing the point both Anthony and I made, that if we remove
the unicode switch we would commit to backporting most non unicode
features to PHP5.


Which would be great for PHP5 and stone cold killer for PHP6 surely?
Unless you needed Unicode. Hmmm.

So whats the expected future of PHP? PHP4 old now, PHP5 much life yet,
PHP6 obscure functionality only for those that know/need it. ISPs
thinking its great to stay with PHP4/5 as the little guys don't need
or ask for Unicode and therefore very little PHP6 take-up.



--
-
Richard Quadling
Zend Certified Engineer : http://zend.com/zce.php?c=ZEND002498r=213474731
Standing on the shoulders of some very clever giants!

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



Re: [PHP-DEV] RIP PHP 4?

2007-07-06 Thread Richard Quadling

On 06/07/07, Derick Rethans [EMAIL PROTECTED] wrote:

Ladies, Gentlemen, Kings and Princesses,

With the nice PHP 5 / PHP 6 unicode semantics thread under way I am
trying to gauge what people feel about dropping support for PHP 4 at the
end of this year. That does not mean that we will not fix security
issues, we have to as the install base is too large, but that would be
the only thing that would warrant a new release. I already sort of
mentioned this on april 1st, but I think we should come with a slightly
more official statement. Your votes please (only -1 and +1 are
allowed)!

regards,
Derick


+1

--
-
Richard Quadling
Zend Certified Engineer : http://zend.com/zce.php?c=ZEND002498r=213474731
Standing on the shoulders of some very clever giants!

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



Re: [PHP-DEV] What is the use of unicode.semantics in PHP 6?

2007-06-29 Thread Richard Quadling

On 29/06/07, Tomas Kuliavas [EMAIL PROTECTED] wrote:

 It comes down to predicting the future.  Whichever way we go, the
 decision is going to be second-guessed.  If we have critical mass for
 a
 clean BC break, then I am ok with it.  For me personally it would make
 things a bit easier, but I think it would be a long long time before
 we
 saw any large hosts out there switch to a PHP 6 that can't run common
 PHP 5 apps.

 If they switch to 6 with unicode off, and never ever get around to
 turning unicode on, will it really be any better?

 They'll just be running some weird-o setup that causes all kinds of
 bugs and issues and you'll have users with php 6 apps that won't work
 in php 6 and who submit bogus bug reports about it, because of the
 setting.

 A clean break is probably better, especially if it makes php 6 much
 more maintainable.

 Large-scale hosts won't switch to 6 any faster than they switched to
 5, unless there are ZERO BC breaks.

 And nobody can guarantee zero breaks, because there are always buglets.

buglet = small break and not something that requires massive code rewrite.
Rewritten code is no longer backwards compatible. So developers have to
maintain two code branches or two different sets of libraries. If code is
maintained in one branch, scripts will need wrapper functions for most of
PHP string and stream function calls. Instead of having performance loss
in interpreter, you will force performance loss in portable scripts.

 The effort to have unicode off in 6 is probably larger than the effort
 to document what needs to be done to a PHP 5 app to make it be
 6-friendly, or even write tools to auto-convert the buik of a script.

 If unicode semantics are on what exactly is borked in PHP 5?

In Unicode mode \[0-7]{1,3} and \x[0-9A-Fa-f]{1,2} refer to unicode code
points and not to octal or hexadecimal byte values. Fix is not backwards
compatible.

Scripts can't match bytes. How they are supposed to check if string is in
plain ascii or in 8bit? Do conversion to ASCII and check for errors
instead of looking for 8bit byte values? How can scripts replace 8bit
bytes with some other strings? ISO-8859-2 decoding table contains 95
entries written and evaluated as binary strings. Same thing applies to
other iso-8859 and windows-125x character sets. iso-89859-1 and utf-8
decoding does not use mapping tables and performs complex calculations
with byte values. multibyte character set decoding might actually benefit
from unicode_encode(), if Table 325 (http://www.php.net/unicode) provides
more information about U_INVALID_SUBSTITUTE and other unicode. settings.

PHP6 does not provide backwards compatible functions to work with bytes.
Provided constructs are not backwards compatible. If scripts want to do
MIME Q encoding, they must work with bytes. Doing Q encoding with provided
PHP extensions adds extra dependencies.

ICU does not support HTML target. Text conversion to iso-8859-x or
windows-125x targets will be lossy.

 Can that be fixed to be BC without resorting to this toggle?

Unicode and binary typecasting causes E_PARSE error in PHP 5.2.0 and older.

PHP6 could introduce new Unicode aware functions, but Unicode
implementation choose to modify existing ones. All low level string
operations ($string[1]) are Unicode aware by default and not when script
actually asks for it. Such implementation is designed for developers, who
don't care about Unicode support and want it out of the box without any
changes in their Unicode unaware scripts. It is not designed for
developers that actually need it and want to have code working in PHP6 and
PHP4/5.

Unicode code points can be defined with \u, but PHP6 breaks existing octal
and hex escape sequences.

PHP6 is very noisy (Notice: fwrite(): 13 character unicode buffer
downcoded for binary stream runtime_encoding, Warning: base64_encode()
expects parameter 1 to be strictly a binary string, Unicode string given)
about data stream and string operations. even when fwrite() or
base64_encode() works only with plain ascii data. PHP script developers
are not used to strict variable type checks in string functions. Which
functions are modified to require binary typecasting? Do I have to make a
list myself every time some function freaks out?


--
Tomas


The more I read about what is in place for PHP6 with regard to
Unicode, I feel Unicode should have been an extension included in the
core, rather than rewriting the core. Provide a series of useful
classes and functions. It is there if you want it and as more and more
people get used to it, more use will be made of it. It almost looks
like all the time and energy (thank you to you all) that has been put
into PHP6 to make it Unicode aware will be wasted if it is disabled by
default. I also feel that if it is enabled by default and causes so
much BC that no one will upgrade.



--
-
Richard Quadling
Zend Certified Engineer : http://zend.com/zce.php?c=ZEND002498r=213474731
Standing on the shoulders of some

Re: [PHP-DEV] Feature(let) idea

2007-06-21 Thread Richard Quadling

On 21/06/07, William A. Rowe, Jr. [EMAIL PROTECTED] wrote:

Windows Explorer on WinXP does a fine job for me displaying binary
version numbers, pulling up dll properties of .so files, etc.

Not sure which issue you are seeing?



Andi Gutmans wrote:
 Damn, I think you are right :)
 That's weird. There are some tools which only work with the .dll
 filename (i.e. Windows Explorer).

 Maybe my idea is better then :)
 Andi

 -Original Message-
 From: William A. Rowe, Jr. [mailto:[EMAIL PROTECTED]
 Sent: Wednesday, June 20, 2007 10:53 PM
 To: Andi Gutmans
 Cc: internals@lists.php.net
 Subject: Re: [PHP-DEV] Feature(let) idea

 Andi Gutmans wrote:
 I got a feature idea from Apache. Apache will automatically
 translate
 mod_rewrite.so in LoadModule to mod_rewrite.dll on Windows.
 It does?  Apache/Win32 actually names the '.dll' as
 mod_rewrite.so on windows.  There's nothing special about the
 '.dll' filename extension, a similar example is the .cpl
 control panel extensions, which are .dll's that are loaded
 into the system settings schema, .scr for screensaver dll's
 following that API, etc.

 In general, it's a good idea.  My builds of php on win32
 *are* entirely in the unix-style, for my customers who need
 to toggle between win32 and unix.  It makes the documentation
 much simpler when you don't need two entirely different sets.

 Bill


In the main, I think it would be very odd for Windows users to see .so
files in place of .dlls.

For those not aware, in windows the extension is linked to a handler
(Run, Open, Edit, Print, etc) via the registry.

A .dll file is known to be an Application Extension and has no
default Run/Open handler, though you can install something like a
resource explorer to examine the dll as they often contain menus,
bitmaps, icons, dialogs, etc (resources).

So, making the files .so for compatibility to other OS's, as far as
windows goes, is fine.

But, confusing for many probably.

--
-
Richard Quadling
Zend Certified Engineer : http://zend.com/zce.php?c=ZEND002498r=213474731
Standing on the shoulders of some very clever giants!

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



[PHP-DEV] Re: SNAPS+SNAPSPecl different to Pecl4Win

2007-06-18 Thread Richard Quadling

Anyone?



On 29/05/07, Richard Quadling [EMAIL PROTECTED] wrote:

Hi.

If you take the extensions in
http://snaps.php.net/win32/php5.2-win32-200705291230.zip (has 45
extensions) and in
http://snaps.php.net/win32/pecl5.2-win32-200705291230.zip (has 77
extensions). They are all dated the same datetime and are not
duplicated, so an extension is in 1 of the archives, but not both. So,
this is a combined count of 122 files - 120  DLLs and 2 JARs.

Now, compare that the the PECL4Win archive
(http://pecl4win.php.net/get_all.php/5_2/pecl4win_5_2.zip), there are
94 files in PECL4Win.

The following are only available from the PECL4Win archive:

php_filter.dll
php_hash.dll
php_hidef.dll
php_ixsfunc.dll
php_xdebug.dll
php_yaz.dll

If they are extensions, I assume they are not part of the normal
build. If so, why are they not in the snapshots pecl archive?

Is there a separation between PHP core dealing with an extension and a
PECL extension?

So, in using ...

php -n -m

I see that filter and hash are built in, so for windows, why are they
available as extensions?



And php_yaz.dll requires yaz.dll, but this is not been part of the
php5.2-win32-latest.zip archive since 1st May 2007. Should this be
part of the archive?

--
-
Richard Quadling
Zend Certified Engineer : http://zend.com/zce.php?c=ZEND002498r=213474731
Standing on the shoulders of some very clever giants!




--
-
Richard Quadling
Zend Certified Engineer : http://zend.com/zce.php?c=ZEND002498r=213474731
Standing on the shoulders of some very clever giants!

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



Re: [PHP-DEV] Re: SNAPS+SNAPSPecl different to Pecl4Win

2007-06-18 Thread Richard Quadling

Sorry. Not complaining, just looking for clarification.

On 18/06/07, Steph Fox [EMAIL PROTECTED] wrote:

We all know it's problematic already. Everyone's looking for solutions
rather than complaints here :)

- Original Message -
From: Richard Quadling [EMAIL PROTECTED]
To: internals internals@lists.php.net
Sent: Monday, June 18, 2007 11:53 AM
Subject: [PHP-DEV] Re: SNAPS+SNAPSPecl different to Pecl4Win


 Anyone?



 On 29/05/07, Richard Quadling [EMAIL PROTECTED] wrote:
 Hi.

 If you take the extensions in
 http://snaps.php.net/win32/php5.2-win32-200705291230.zip (has 45
 extensions) and in
 http://snaps.php.net/win32/pecl5.2-win32-200705291230.zip (has 77
 extensions). They are all dated the same datetime and are not
 duplicated, so an extension is in 1 of the archives, but not both. So,
 this is a combined count of 122 files - 120  DLLs and 2 JARs.

 Now, compare that the the PECL4Win archive
 (http://pecl4win.php.net/get_all.php/5_2/pecl4win_5_2.zip), there are
 94 files in PECL4Win.

 The following are only available from the PECL4Win archive:

 php_filter.dll
 php_hash.dll
 php_hidef.dll
 php_ixsfunc.dll
 php_xdebug.dll
 php_yaz.dll

 If they are extensions, I assume they are not part of the normal
 build. If so, why are they not in the snapshots pecl archive?

 Is there a separation between PHP core dealing with an extension and a
 PECL extension?

 So, in using ...

 php -n -m

 I see that filter and hash are built in, so for windows, why are they
 available as extensions?



 And php_yaz.dll requires yaz.dll, but this is not been part of the
 php5.2-win32-latest.zip archive since 1st May 2007. Should this be
 part of the archive?

 --
 -
 Richard Quadling
 Zend Certified Engineer :
 http://zend.com/zce.php?c=ZEND002498r=213474731
 Standing on the shoulders of some very clever giants!



 --
 -
 Richard Quadling
 Zend Certified Engineer : http://zend.com/zce.php?c=ZEND002498r=213474731
 Standing on the shoulders of some very clever giants!

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






--
-
Richard Quadling
Zend Certified Engineer : http://zend.com/zce.php?c=ZEND002498r=213474731
Standing on the shoulders of some very clever giants!

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



Re: [PHP-DEV] Building on Windows

2007-06-15 Thread Richard Quadling

I would be REALLY grateful if you could do the whole process with no
assumed knowledge about the compiler or special tools.

Ideally, including the dependent elements too (SDK, .NET, etc).

Regards and thanks up front!

Richard.

On 15/06/07, Zoe Slattery [EMAIL PROTECTED] wrote:

Rob, Pierre, Stanislav - thank you!!!

I have PHP6 building with a free development environment. Elizabeth's
tutorial + the manual covers most of it. I still have a few spurious
compiler warnings which I think I can deal with but I have a working
php.exe.

It's been such a pain getting here that I'm going to rip it all out and
do it again :-) I'll write up the steps and make them available
somewhere then I 'll probably need to recuperate by working exclusively
on Linux for an extended period.


Zoe Slattery
IBM

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





--
-
Richard Quadling
Zend Certified Engineer : http://zend.com/zce.php?c=ZEND002498r=213474731
Standing on the shoulders of some very clever giants!

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



Re: [PHP-DEV] FW: php fastcgi

2007-06-13 Thread Richard Quadling

I think that's a good idea.

But wouldn't letting this be controlled in userland via
set_error_handler / set_exception_handler be just as good?


On 13/06/07, Dmitry Stogov [EMAIL PROTECTED] wrote:

Hi,

Current time most PHP instalations use setting 'display_error=0'.
This setting hides errors from user but may send to him just a blank page.

The proposed patch sends HTTP 500 response on errors instead of blank pages.
The pages that already wrote something are not affectd.

Any objections or additions?

Thanks. Dmitry.


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




--
-
Richard Quadling
Zend Certified Engineer : http://zend.com/zce.php?c=ZEND002498r=213474731
Standing on the shoulders of some very clever giants!

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



[PHP-DEV] Windows and Memory Limit of -1

2007-06-13 Thread Richard Quadling

Hi.

Are there any special concerns for setting memory_limit to -1 in
PHP.INI on Windows (using Sambar Server, not IIS/Apache).

I'm getting Out of memory errors recently. Memory is good.
Admittedly the code is trying to add a 12MG file as an attachment
(using htmlmimemail5 from phpguru.org).

5MG attachments are OK, but the 12MG isn't.

The server is internal so the limit is not required.

Confused.




--
-
Richard Quadling
Zend Certified Engineer : http://zend.com/zce.php?c=ZEND002498r=213474731
Standing on the shoulders of some very clever giants!

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



Re: [PHP-DEV] Windows and Memory Limit of -1

2007-06-13 Thread Richard Quadling

It's an intranet server. I rebooted and it is working. It IS saying
out of memory

[13-Jun-2007 11:38:51] PHP Fatal error:  Out of memory (allocated
1572864) (tried to allocate 12729537 bytes) in
C:\PHP\PHP5\Includes\htmlMimeMail5\htmlMimeMail5.php on line 940

[13-Jun-2007 11:40:02] PHP Fatal error:  Out of memory (allocated
1572864) (tried to allocate 12728784 bytes) in
C:\PHP\PHP5\Includes\htmlMimeMail5\htmlMimeMail5.php on line 940

[13-Jun-2007 11:42:04] PHP Fatal error:  Out of memory (allocated
1572864) (tried to allocate 12735907 bytes) in
C:\PHP\PHP5\Includes\htmlMimeMail5\htmlMimeMail5.php on line 940

and phpinfo() does show -1 for memory limit.

I must admit it hadn't been rebooted for nearly 2 months.

Wait and see time I think.

On 13/06/07, Richard Lynch [EMAIL PROTECTED] wrote:



On Wed, June 13, 2007 7:09 am, Richard Quadling wrote:
 Hi.

 Are there any special concerns for setting memory_limit to -1 in
 PHP.INI on Windows (using Sambar Server, not IIS/Apache).

 I'm getting Out of memory errors recently. Memory is good.
 Admittedly the code is trying to add a 12MG file as an attachment
 (using htmlmimemail5 from phpguru.org).

 5MG attachments are OK, but the 12MG isn't.

 The server is internal so the limit is not required.

 Confused.

Is this a production server which might literally be running out of
RAM?...  If so, not much can be done to fix that... :-v

Does the error actually say out of memory or memory limit reached?
 I *think* you get different error if you are triggering the
memory_limit than, say, really running out of RAM.

Also double-check phpinfo() to be sure your memory_limit setting is
what you think it is.

--
Some people have a gift link here.
Know what I want?
I want you to buy a CD from some indie artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?





--
-
Richard Quadling
Zend Certified Engineer : http://zend.com/zce.php?c=ZEND002498r=213474731
Standing on the shoulders of some very clever giants!

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



Re: [PHP-DEV] pecl4win patches

2007-05-29 Thread Richard Quadling

I've attached the patch for this.

On 25/05/07, Gaetano Giunta [EMAIL PROTECTED] wrote:

Please find here: http://gggeek.altervista.org/sw/pecl4win.zip a
slightly improved version of the pecl4win pages:

+ allow sorting of columns in the DLLs page
+ more descriptive titles in the extensions list page for both search
and single branch cases

Sorry for not providing diffs - the full versions of the files are included

Ideas for further improvement:
+ add table of all available branches in the extensions list page (one
column per branch)
+ add compile log, date, size, in the extensions list page (when
filtered by single branch)
+ other ?

Bye
Gaetano Giunta

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





--
-
Richard Quadling
Zend Certified Engineer : http://zend.com/zce.php?c=ZEND002498r=213474731
Standing on the shoulders of some very clever giants!
Index: list.php
===
RCS file: /repository/pecl4win/list.php,v
retrieving revision 1.6
diff -u -r1.6 list.php
--- list.php22 Apr 2007 22:01:37 -  1.6
+++ list.php29 May 2007 13:38:40 -
@@ -9,13 +9,14 @@
 
 
 /* Are doing a search? */
-$in_search = false;
+$in_search = '';
+$branch = '';
 
 if  (isset($_GET['search_string'])  strlen($_GET['search_string'])) {
-$in_search = true;
+$in_search = ' for ' . htmlspecialchars($_GET['search_string']) . '';
 $arg = preg_split('|\\s+|', strtolower($_GET['search_string']), NULL, 
PREG_SPLIT_NO_EMPTY);
 $where = array();
-
+
 foreach($arg as $a) {
$where[] = safe_sql_str(lower(fname) like !s, % . $a . %);
 }
@@ -27,6 +28,7 @@
 
 if ($arg[0]) {
$q .= safe_sql_str( where branch=!s, $arg[0]);
+   $branch = ' for branch '.htmlspecialchars($arg[0]);
 }
 
 if ($arg[1]) {
@@ -59,10 +61,10 @@
 $layout-setTitle('The PECL Windows Repository');
 $layout-header();
 
-if ($in_search) {
-echo h2Search result/h2;
+if ($in_search != '') {
+echo h2Search results$in_search/h2;
 } else {
-echo h2Browse Extensions/h2;
+echo h2Browse Extensions$branch/h2;
 }
 ?
 
Index: list_dlls.php
===
RCS file: /repository/pecl4win/list_dlls.php,v
retrieving revision 1.2
diff -u -r1.2 list_dlls.php
--- list_dlls.php   8 Nov 2005 15:06:18 -   1.2
+++ list_dlls.php   29 May 2007 13:38:40 -
@@ -5,7 +5,17 @@
 }
 include SITE_ROOT./lib/includes/init.php;
 
-$dlls = DLLs::getAll();
+/* Set sort order */
+if (isset($_GET['sort'])  $_GET['sort'] == date) {
+   $sortq = updated desc;
+} else {
+if (isset($_GET['sort'])  $_GET['sort'] == num) {
+   $sortq = downloads desc;
+} else {
+   $sortq = name;
+}
+
+$dlls = DLLs::getAll($sortq);
 
 $layout = new Layout();
 $layout-setTitle('DLL Libraries');
@@ -15,11 +25,11 @@
 table id=packageList border=0
 tbodytr
 th class=form-label_left#/th
-th class=form-label_leftnobrFile name/nobr/th
+th class=form-label_lefta class=form-label_left href=?php echo 
$_SERVER['PHP_SELF'] ??sort=namenobrFile name/nobr/a/th
 th class=form-label_leftMD5 sum/th
-th class=form-label_leftLast update/th
+th class=form-label_lefta class=form-label_left href=?php echo 
$_SERVER['PHP_SELF'] ??sort=dateLast update/a/th
 th class=form-label_leftSize (KB)/th
-th class=form-label_leftDownloads/th
+th class=form-label_lefta class=form-label_left href=?php echo 
$_SERVER['PHP_SELF'] ??sort=numDownloads/a/th
 
 /tr
 
Index: lib/classes/DLLs.php
===
RCS file: /repository/pecl4win/lib/classes/DLLs.php,v
retrieving revision 1.2
diff -u -r1.2 DLLs.php
--- lib/classes/DLLs.php4 Oct 2006 08:54:24 -   1.2
+++ lib/classes/DLLs.php29 May 2007 13:38:40 -
@@ -3,13 +3,16 @@
 
 class DLLs
 {
-   public function getAll()
+   public function getAll($orderby = 'name')
{
global $DB;
 
$ret = array();
-   $q = select name, md5hash, updated, filesize, downloads from 
dlls where row(name, updated) in (select name, max(updated) as updated from 
dlls group by name) order by name;
-   
+   $q = select name, md5hash, updated, filesize, downloads from 
dlls where row(name, updated) in (select name, max(updated) as updated from 
dlls group by name);
+   if ($orderby != '') {
+   $q .= ' order by ' . substr(safe_sql_str('!s', 
$orderby), 1, -1);
+   }
+
if (!$res = $DB-query($q)) {
return $ret;
}
-- 
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

[PHP-DEV] SNAPS+SNAPSPecl different to Pecl4Win

2007-05-29 Thread Richard Quadling

Hi.

If you take the extensions in
http://snaps.php.net/win32/php5.2-win32-200705291230.zip (has 45
extensions) and in
http://snaps.php.net/win32/pecl5.2-win32-200705291230.zip (has 77
extensions). They are all dated the same datetime and are not
duplicated, so an extension is in 1 of the archives, but not both. So,
this is a combined count of 122 files - 120  DLLs and 2 JARs.

Now, compare that the the PECL4Win archive
(http://pecl4win.php.net/get_all.php/5_2/pecl4win_5_2.zip), there are
94 files in PECL4Win.

The following are only available from the PECL4Win archive:

php_filter.dll
php_hash.dll
php_hidef.dll
php_ixsfunc.dll
php_xdebug.dll
php_yaz.dll

If they are extensions, I assume they are not part of the normal
build. If so, why are they not in the snapshots pecl archive?

Is there a separation between PHP core dealing with an extension and a
PECL extension?

So, in using ...

php -n -m

I see that filter and hash are built in, so for windows, why are they
available as extensions?



And php_yaz.dll requires yaz.dll, but this is not been part of the
php5.2-win32-latest.zip archive since 1st May 2007. Should this be
part of the archive?

--
-
Richard Quadling
Zend Certified Engineer : http://zend.com/zce.php?c=ZEND002498r=213474731
Standing on the shoulders of some very clever giants!

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



Re: [PHP-DEV] RE: Fixing PECL + Core

2007-05-29 Thread Richard Quadling

My post about SNAPS and PECLS a little while ago seems relevant to this.

As a windows user, I have to rely on pre-compiled binaries.

It was/is my understanding that SNAPS would provide me with most
currently succesfully compiled PHP, with some extensions built in and
some extensions for my ext directory - those which are deemed
important enough (judge important as you would like).

PECL contained other extensions - those NOT part of the windows
standard package.





On 27/05/07, Gaetano Giunta [EMAIL PROTECTED] wrote:

Just to add my experience (even though the original poster explicitly
asked for single extensions not to be mentioned) from a
not-completely-unrelated problem: some extensions have an internal
version number that is not always updated when the userland API of said
extension is changed - see eg. Json and the recent change of behavior on
decoding scalar values.

This makes it very hard for people maintaining php libraries to code
defensively and test the version in use to enable workarounds:
- the extension version number is useless (if not managed correctly)
- the php version number is useless, since the extension might have been
downloaded and compiled from pecl and not correspond to the version that
is distributed with the core

The only option left in this situation is to test the functionality
needed first, then use it, much as it is done in js - a very sad state
of things... (of course I would not recommend disabling upgrade /
backport of a php extension from pecl as a solution)

The fact that the extension lives in both pecl and core and the two
might be slightly out of sync does not help at all when trying to find
out the cause of regressions...

Bye
Gaetano

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





--
-
Richard Quadling
Zend Certified Engineer : http://zend.com/zce.php?c=ZEND002498r=213474731
Standing on the shoulders of some very clever giants!

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



Re: [PHP-DEV] RE: Fixing PECL + Core

2007-05-29 Thread Richard Quadling

Isn't PECL4WIN official? It's on the php.net domain.



On 29/05/07, Gaetano Giunta [EMAIL PROTECTED] wrote:

As a side note: does anyone think that providing on pecl4win compiled
versions corresponding to the official pecl package releases besides the
compiled from cvs versions would be a good idea?

Bye
Gaetano


On 5/29/07, Richard Quadling [EMAIL PROTECTED] wrote:

 My post about SNAPS and PECLS a little while ago seems relevant to this.

 As a windows user, I have to rely on pre-compiled binaries.

 It was/is my understanding that SNAPS would provide me with most
 currently succesfully compiled PHP, with some extensions built in and
 some extensions for my ext directory - those which are deemed
 important enough (judge important as you would like).

 PECL contained other extensions - those NOT part of the windows
 standard package.





 On 27/05/07, Gaetano Giunta [EMAIL PROTECTED] wrote:
  Just to add my experience (even though the original poster explicitly
  asked for single extensions not to be mentioned) from a
  not-completely-unrelated problem: some extensions have an internal
  version number that is not always updated when the userland API of said
  extension is changed - see eg. Json and the recent change of behavior on
  decoding scalar values.
 
  This makes it very hard for people maintaining php libraries to code
  defensively and test the version in use to enable workarounds:
  - the extension version number is useless (if not managed correctly)
  - the php version number is useless, since the extension might have been
  downloaded and compiled from pecl and not correspond to the version that
  is distributed with the core
 
  The only option left in this situation is to test the functionality
  needed first, then use it, much as it is done in js - a very sad state
  of things... (of course I would not recommend disabling upgrade /
  backport of a php extension from pecl as a solution)
 
  The fact that the extension lives in both pecl and core and the two
  might be slightly out of sync does not help at all when trying to find
  out the cause of regressions...
 
  Bye
  Gaetano
 
  --
  PHP Internals - PHP Runtime Development Mailing List
  To unsubscribe, visit: http://www.php.net/unsub.php
 
 


 --
 -
 Richard Quadling
 Zend Certified Engineer : http://zend.com/zce.php?c=ZEND002498r=213474731
 Standing on the shoulders of some very clever giants!





--
-
Richard Quadling
Zend Certified Engineer : http://zend.com/zce.php?c=ZEND002498r=213474731
Standing on the shoulders of some very clever giants!

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



Re: [PHP-DEV] PHP Unicode extension in PHP6

2007-05-23 Thread Richard Quadling

On 23/05/07, Johannes Schlüter [EMAIL PROTECTED] wrote:

Hi Rangel,

for PHP 6 the basic string type ist unicode string and most functions
will accept these as primary type. But there are a few exceptions where
unicode, for different reason, makes no sense. There you have to pass a
binary string - an example is the mentioned urlencode(): It has to work
on bytes to be reliable but it has no clue on the proper encoding so you
need to tell that function Yes the, I know about the meaning, just take
this byte sequence.

A good thing would be to check the archives where most reasons were
posted before.

johannes


For us users who have the luxury of not needing to deal with unicode,
I expect that there is a steep learning curve in :

1 - Understanding why we need it.
2 - How we use it.
3 - Where does it all go wrong.
4 - How do we fix it when it does.

In truth, if it all just worked, there would be no problem. But
nothing ever just works. As someone who has been very happy with my
ASCII character set, this whole thing seems extremely complicated and
the potential for abuse, horrendous. I hope this is just FUD.

It seems a LOT of effort has gone into unicode and it does seem that a
lot of changes have had to be made. I'm all for improving and adhering
to standards and even though I'm on the extreme fringe here, I believe
adding Unicode is a good thing for PHP. But it will be needing a LOT
of good quality documentation about this to help ISPs and Users.

Its all well and good for a chosen few to understand the n'th degree
of unicode, but a lot of the rest of us are in the dark on this.



--
-
Richard Quadling
Zend Certified Engineer : http://zend.com/zce.php?c=ZEND002498r=213474731
Standing on the shoulders of some very clever giants!


Re: [PHP-DEV] PHP Unicode extension in PHP6

2007-05-23 Thread Richard Quadling

On 23/05/07, Steph Fox [EMAIL PROTECTED] wrote:

Nice article in the May edition of php|arch. Which _might_ make it online
today if we're lucky..!



Excellent! As a subscriber I'll be reading it avidly.

Is PHP6 in a state able to be used? For Windows XP that is?

--
-
Richard Quadling
Zend Certified Engineer : http://zend.com/zce.php?c=ZEND002498r=213474731
Standing on the shoulders of some very clever giants!

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



Re: [PHP-DEV] PHP Unicode extension in PHP6

2007-05-23 Thread Richard Quadling

Ah! So with this article in php|Architect and PHP6, we should be able
to see how things work!

Looking forward to it.

On 23/05/07, Alexey Zakhlestin [EMAIL PROTECTED] wrote:

On 5/23/07, Richard Quadling [EMAIL PROTECTED] wrote:

 Is PHP6 in a state able to be used? For Windows XP that is?

in a state to be tested would be more correct :)

--
Alexey Zakhlestin
http://blog.milkfarmsoft.com/




--
-
Richard Quadling
Zend Certified Engineer : http://zend.com/zce.php?c=ZEND002498r=213474731
Standing on the shoulders of some very clever giants!

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



Re: [PHP-DEV] Re: #41401 [Opn-Bgs]: Order of Operations error on divide by negative

2007-05-16 Thread Richard Quadling

On 16/05/07, Uwe Schindler [EMAIL PROTECTED] wrote:

 Should all these three examples give the same result?

 $ php -r 'var_dump(-1/2*5, 1/-2*5, 1/2*-5);'
 float(-2.5)
 float(-0.1)
 float(-2.5)

They should all give -2.5! But I think normal programmers will use braces
in such situations...

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




If you use variables, then this works fine ...

php -r $a = 1; $b = -2; $c = 5; var_dump($a/$b*$c);
float(-2.5)



--
-
Richard Quadling
Zend Certified Engineer : http://zend.com/zce.php?c=ZEND002498r=213474731
Standing on the shoulders of some very clever giants!

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



Re: [PHP-DEV] Re: #41401 [Opn-Bgs]: Order of Operations error on divide by negative

2007-05-16 Thread Richard Quadling

On 16/05/07, Brian Moon [EMAIL PROTECTED] wrote:

Michael Wallner wrote:
 [EMAIL PROTECTED] wrote:
  ID:   41401
  Updated by:   [EMAIL PROTECTED]
  Reported By:  drlippman at yahoo dot com
 -Status:   Open
 +Status:   Bogus
  Bug Type: Math related
  Operating System: Windows, Linux
  PHP Version:  4.4.7
  New Comment:

 [2007-05-15 15:44:07] drlippman at yahoo dot com

 Description:
 
 Left-to-right order of operations does not appear to be honored when
 dividing by a negative

 Reproduce code:
 ---
 1/-2*5

 Expected result:
 
 -2.5

 Actual result:
 --
 -.1

 Should all these three examples give the same result?

 $ php -r 'var_dump(-1/2*5, 1/-2*5, 1/2*-5);'
 float(-2.5)
 float(-0.1)
 float(-2.5)

According to my memory of Please My Dear Aunt Sally these should be:

-1/2*5 = -.1
1/-2*5 = -.1
1/2*-5 = -.1

So, that is bad if PHP answers that way.  Someone please correct me if
my memory is wrong.  Is there some rule that negative values should be
done first before positive values?



I'm in the UK and I was taught (over 35 years ago at least) about BODMAS

Brackets Orders Division Multiplication Addition Subtraction.

http://en.wikipedia.org/wiki/BODMAS

--

Brian Moon
Senior Developer
--
http://dealnews.com/
It's good to be cheap =)

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





--
-
Richard Quadling
Zend Certified Engineer : http://zend.com/zce.php?c=ZEND002498r=213474731
Standing on the shoulders of some very clever giants!

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



[PHP-DEV] Userspace stream wrappers and Unicode.

2007-05-15 Thread Richard Quadling

On 14/05/07, Greg Beaver [EMAIL PROTECTED] wrote:

... unicode is a killer
feature and PHP 6 will be adopted en masse, ... , it
will simply mean the death of userspace stream wrappers for anything but
custom projects.


Not being obtuse or antagonistic, just not understanding the
implications of unicode, but why will unicode kill off userspace
stream wrappers?

--
-
Richard Quadling
Zend Certified Engineer : http://zend.com/zce.php?c=ZEND002498r=213474731
Standing on the shoulders of some very clever giants!

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



Re: [PHP-DEV] Tree sort in C

2007-05-10 Thread Richard Quadling

On 09/05/07, Brian Moon [EMAIL PROTECTED] wrote:

Derick Rethans wrote:
 On Wed, 9 May 2007, Maurice Makaay wrote:

 At a really
 large number of nodes, the extension becomes slower, but the memory stays 
low.

 That is very peculiar... it should never be slower than an
 implementation in PHP - unless your algorithm isn't optimal.

Me too.  But, fwiw, the multisort method does not do the same thing.
So, its apples to oranges.  See my other email.  In the apples to apples
comparisons with use the same algorithm in PHP and in C, the C version
is always faster.



I agree with Brian here, the code I referenced was an array multisort
by column which I created based upon user notes on the array_multisort
function. You do not require a trawl through to get the list of keys
like is done here.

So,

$sorted = array_multisort_column($nodes, 'parent_id', 'id');

It is a single pass mechanism. It uses the indexes supplied to compare
them in sequence. A simple bubble sort.

BUT this is not a tree sort as this is something quite different. The
array_multisort() nor my array_multisort_column() functions will not
work for more than 1 level of parent/child relationships.

Richard



--

Brian Moon
Senior Developer
--
http://dealnews.com/
It's good to be cheap =)




--
-
Richard Quadling
Zend Certified Engineer : http://zend.com/zce.php?c=ZEND002498r=213474731
Standing on the shoulders of some very clever giants!

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



Re: [PHP-DEV] [PATCH] Passthrough MD5/SHA1 calculation of uploaded files

2007-05-09 Thread Richard Quadling

On 08/05/07, Richard Lynch [EMAIL PROTECTED] wrote:

On Tue, May 8, 2007 9:13 am, David Santinoli wrote:
 If there's enough interest in this, I will rework the patch according
 to
 Sara's hint.

I'd have to be +1 on making more than just the 2 hashes available for
this feature, though if it's a *TON* of work...



Could the result be ...

$_FILES[userfile][hash][md5] / $_FILES[userfile][hash][sha1]

If you SOMEHOW didn't know what hash had been asked for, you would
have to go through a list to find the one saved in $_FILES. Using a
key for hash, you know which hash a lot easier.

--
-
Richard Quadling
Zend Certified Engineer : http://zend.com/zce.php?c=ZEND002498r=213474731
Standing on the shoulders of some very clever giants!

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



Re: [PHP-DEV] Tree sort in C

2007-05-09 Thread Richard Quadling

On 09/05/07, Brian Moon [EMAIL PROTECTED] wrote:

A common issue in lots of applications is tree sorting with unlimited
depth.  Phorum has used a recursive function since 1999 to solve this
problem.  However, at MySQL Conference this year, we finally wrote a non
recursive function for it and acheived both memory and time savings on
very large data sets.  I always knew it could be done, I had just never
stopped and worked it out.  Most examples I found involved a left/right
model that our data does not use.  The left/right model involves
altering rows when new rows are inserted into the tree.  That is not
attractive.  Phorum uses just a parent_id field to track child members.

We would like to take this to another level and make a PHP internal
funciton to do the work.  In fact, since MySQL Conference, one of team
members has written the function as a PHP extension.  My questions is,
if we made a generic tree sorting function, could this be a function
that we could get considered for addition to the other array sorting
functions.  I have probably ported the Phorum PHP based for tree sorting
over to 100 different other applications for sorting trees in PHP.  It
would be very nice to finally have an internal function for it.

Speed is not our main benefit, although there is a noticable speed
boost.  In addition to sorting the function, each node would be assigned
a depth value (optionally named by a function parameter if needed).
This is where the biggest memory savings have been found for us.  On
large data sets (2000 members) in PHP, we have found that altering the
input array would cause copy of the whole array, blowing up the memory
usage of the script to as much as 10x.  Doing this in C helps to remove
that problem.


Basically, an array would look like:

$array = array(
1 = array(
id = 1,
parent = 0,
name = item 1
),
2 = array(
id = 2,
parent = 0,
name = item 2
),
3 =array(
id = 3,
parent = 1,
name = item 1
),
);

The function call would look like:

array_treesort($array, id, parent);

The returned array would look like:

$array = array(
1 = array(
id = 1,
parent = 0,
name = item 1,
depth = 0
),
3 =array(
id = 3,
parent = 1,
name = item 1,
depth = 1
),
2 = array(
id = 2,
parent = 0,
name = item 2,
depth = 0
),
);


Its a little funky to have a function take names of fields like this,
but this is the only way we could think of to make this work for people
without them having to change their data structure.

You can see our current work at
http://www.phorum.org/tracfcgi/browser/phorum5/trunk/extension_src  That
code has been written specifically for Phorum to replace our existing
PHP function.  It does more than the PHP internal function would do.
But, the extra parts are not the things that we were trying to overcome.
   They are just gravy.

--

Brian Moon
Senior Developer
--
http://dealnews.com/
It's good to be cheap =)

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




Take a look at http://www.php.net/manual/en/function.array-multisort.php#68689
/ http://rquadling.php1h.com/array_multisort_column.php

Richard.



--
-
Richard Quadling
Zend Certified Engineer : http://zend.com/zce.php?c=ZEND002498r=213474731
Standing on the shoulders of some very clever giants!

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



Re: [PHP-DEV] Re: Help with the snaps site

2007-05-08 Thread Richard Quadling

On 06/05/07, Tijnema ! [EMAIL PROTECTED] wrote:

On 5/6/07, David Coallier [EMAIL PROTECTED] wrote:
 On 5/5/07, Jan Reininghaus [EMAIL PROTECTED] wrote:
  I am currently working on my second draw for the page, but I have a
  question. For my first draw I assumed that all of the new features will
  be available for all three branches, but is this actually true?
 
  By the way, I don't know whether you are aware that all build processes
  of the win32 snapshots have failed for one day now.
 
  --
  PHP Internals - PHP Runtime Development Mailing List
  To unsubscribe, visit: http://www.php.net/unsub.php
 
 

 Perhaps something like this could be cool:
 http://dev.agoraproduction.com/php/snaps/

 The css might be a bit off as I just wanted to do it quick, but you
 see the idea :)


 David

Yes, it is quick, as it doesn't work good in IE6, which is the most
common browser (http://www.w3schools.com/browsers/browsers_stats.asp)
Might be a good alternative for the snaps site, as it is never too
larg :) But it should work on IE6 too of course.

Tijnema

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




In FF with no JS it looked awful too. I use NoScript which blocks
scripts unless I want them to run (whitelist).

The Sliding Doors tutorial at
http://alistapart.com/articles/slidingdoors/ is all CSS.

--
-
Richard Quadling
Zend Certified Engineer : http://zend.com/zce.php?c=ZEND002498r=213474731
Standing on the shoulders of some very clever giants!

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



Re: [PHP-DEV] Re: Help with the snaps site

2007-05-04 Thread Richard Quadling

Hey! It wasn't THAT scary! Just a table which has the most recent
activity on the left side columns.

Not too wide.

Easy to see which version and the either source or Win32 stuff.

And also all the additional files requested.

I like the idea. My implementation though. Hmmm. Ok. I agree.

Eeek!



On 03/05/07, Michael Wallner [EMAIL PROTECTED] wrote:

Richard Quadling wrote:
 How about something along these lines ...

 (Not pretty as I'm crap at the design - sorry).

 http://rquadling.php1h.com/snap.html

Eeek! ;)


--
Michael

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





--
-
Richard Quadling
Zend Certified Engineer : http://zend.com/zce.php?c=ZEND002498r=213474731
Standing on the shoulders of some very clever giants!

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



Re: [PHP-DEV] Re: Help with the snaps site

2007-05-03 Thread Richard Quadling

How about something along these lines ...

(Not pretty as I'm crap at the design - sorry).

http://rquadling.php1h.com/snap.html

Use icons for the labels (BZ2, GZ, ZIP, PECL, INST, COMP, SNAP).

The logs for failed builds could also be included.

Richard.

On 03/05/07, Tijnema ! [EMAIL PROTECTED] wrote:

On 5/2/07, Edin Kadribasic [EMAIL PROTECTED] wrote:
 Jan Reininghaus wrote:
  I would like to suggest a redesign of the page. In my opinion the page
  is too complex, so for example I find it a bit hard to match the
  information for the next snapshots in the left of the page with the
  snapshots itself on the right. I find it also complex that the source
  and the win32 packages are separated and have its own creation
  intervals. In case there is no special reason for that I would suggest
  to distribute everything together.
  I have uploaded a design I could imagine to
  http://hp-film.pytalhost.de/test/php/snaps_draw.png.

 The page is a bit confusing and I didn't want too much new stuff to it
 without thinking about it first. Your suggestion is promising, but it
 might be a bit too wide for people that have smaller screen resolutions.
 I think we need to make it look good at 1024x768.


Yes, it's very wide. So what about this: (Quick edit..)
http://86.86.80.41/PHP/snaps_draw_edit.PNG

 There are some things you have missed. There are two different source
 bundles (gz and bz2). Next build depends on the system (source or
 bins) and the PHP version (we build some windows snapshots more often
 than others).

  By the way, I can't follow the link to the PHP installer because I get
  the error message that the access to the file is Forbidden.

 Thanks for the heads up. This should be fixed now.

 Would you be willing to produce the HTML needed for the redesign?

 Edin

Else i will :)

Tijnema

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





--
-
Richard Quadling
Zend Certified Engineer : http://zend.com/zce.php?c=ZEND002498r=213474731
Standing on the shoulders of some very clever giants!

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



[PHP-DEV] Killing an ISAPI thread.

2007-04-25 Thread Richard Quadling

Hi.

Running PHP via ISAPI on Sambar Server.

I have a script which is allowed to take a long time.

The user has an Abort option and via clever use of sessions, the
script can be terminated.

All fine.

Sometimes, the user is too dumb to abort it when it has to do a LOT
more work than they expect.

In looking at the server threads, I see many of these scripts loaded,
all doing their job correctly but without ever being able to send
there details anywhere.

I understand that I can't just terminate the PHP isapi.dll as that
would bugger up the server, but does PHP have a mechanism by which a
thread that it is looking after can be terminated by the server making
a call to the isapi.dll.

I was thinking that if the max_exec_time could be manipulated
externally for a single thread within the dll, then the engine would
suddenly realise it had taken too long and would terminate.

Ideas?

Regards,

Richard Quadling.

--
-
Richard Quadling
Zend Certified Engineer : http://zend.com/zce.php?c=ZEND002498r=213474731
Standing on the shoulders of some very clever giants!

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



Re: [PHP-DEV] Build failure

2007-04-19 Thread Richard Quadling

And lo, the snapshot was A Good Thing.

On 18/04/07, Richard Quadling [EMAIL PROTECTED] wrote:

This looks like it will be available in snaps.php.net in about 40 minutes.

Looking forward to it!

On 17/04/07, Rob Richards [EMAIL PROTECTED] wrote:
 Unless anyone sees a way to do this without adding the lock, I'd like to
 commit this patch.
 It adds a php_flock call only for windows. In doing so I got rid of the
 win32/flock files and now compile with  flock_compat from main.

 Rob


 Richard Quadling wrote:
  The testing I'm using is to launch multiple copies of the same PHP
  script simultaneously using php.exe (CLI mode). This could easily be
  multiple FastCGI scripts or multiple ISAPI threads.
 
  On 16/04/07, William A. Rowe, Jr. [EMAIL PROTECTED] wrote:
  Richard Quadling wrote:
   So isn't locking the solution for Windows?
 
  If this is single writer process, even with multithreads - a mutex
  is most efficient, otherwise with concurrent writer processes, file
  locking makes the most sense.
 
  Bill
 
 
 

 Index: ext/standard/config.w32
 ===
 RCS file: /repository/php-src/ext/standard/config.w32,v
 retrieving revision 1.4.2.2
 diff -u -r1.4.2.2 config.w32
 --- ext/standard/config.w32 4 Jan 2006 21:31:29 -   1.4.2.2
 +++ ext/standard/config.w32 17 Apr 2007 11:34:16 -
 @@ -16,5 +16,5 @@
 url_scanner_ex.c ftp_fopen_wrapper.c http_fopen_wrapper.c \
 php_fopen_wrapper.c credits.c css.c var_unserializer.c ftok.c sha1.c \
 user_filters.c uuencode.c filters.c proc_open.c \
 -   streamsfuncs.c http.c, false /* never shared */);
 +   streamsfuncs.c http.c flock_compat.c, false /* never shared */);

 Index: main/main.c
 ===
 RCS file: /repository/php-src/main/main.c,v
 retrieving revision 1.640.2.23.2.34
 diff -u -r1.640.2.23.2.34 main.c
 --- main/main.c 16 Apr 2007 08:09:56 -  1.640.2.23.2.34
 +++ main/main.c 17 Apr 2007 11:49:49 -
 @@ -63,6 +63,7 @@
  #ifdef PHP_WIN32
  #include io.h
  #include win32/php_registry.h
 +#include ext/standard/flock_compat.h
  #endif
  #include php_syslog.h
  #include Zend/zend_exceptions.h
 @@ -362,8 +363,11 @@
 time(error_time);
 strftime(error_time_str, sizeof(error_time_str), %d-%b-%Y 
%H:%M:%S, php_localtime_r(error_time, tmbuf));
 len = spprintf(tmp, 0, [%s] %s%s, error_time_str, 
log_message, PHP_EOL);
 +#ifdef PHP_WIN32
 +   php_flock(fd, 2);
 +#endif
 write(fd, tmp, len);
 -   efree(tmp);
 +   efree(tmp);
 close(fd);
 return;
 }
 Index: win32/build/config.w32
 ===
 RCS file: /repository/php-src/win32/build/config.w32,v
 retrieving revision 1.40.2.8.2.9
 diff -u -r1.40.2.8.2.9 config.w32
 --- win32/build/config.w32  16 Apr 2007 08:09:56 -  1.40.2.8.2.9
 +++ win32/build/config.w32  17 Apr 2007 11:39:05 -
 @@ -309,7 +309,7 @@
  ADD_SOURCES(main/streams, streams.c cast.c memory.c filter.c 
plain_wrapper.c \
 userspace.c transports.c xp_socket.c mmap.c);

 -ADD_SOURCES(win32, crypt_win32.c flock.c glob.c md5crypt.c readdir.c \
 +ADD_SOURCES(win32, crypt_win32.c glob.c md5crypt.c readdir.c \
 registry.c select.c sendmail.c time.c wfile.c winutil.c wsyslog.c 
globals.c);

  ADD_SOURCES(regex, regcomp.c regerror.c regexec.c regfree.c);




--
-
Richard Quadling
Zend Certified Engineer : http://zend.com/zce.php?c=ZEND002498r=213474731
Standing on the shoulders of some very clever giants!




--
-
Richard Quadling
Zend Certified Engineer : http://zend.com/zce.php?c=ZEND002498r=213474731
Standing on the shoulders of some very clever giants!

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



Re: [PHP-DEV] Build failure

2007-04-18 Thread Richard Quadling

This looks like it will be available in snaps.php.net in about 40 minutes.

Looking forward to it!

On 17/04/07, Rob Richards [EMAIL PROTECTED] wrote:

Unless anyone sees a way to do this without adding the lock, I'd like to
commit this patch.
It adds a php_flock call only for windows. In doing so I got rid of the
win32/flock files and now compile with  flock_compat from main.

Rob


Richard Quadling wrote:
 The testing I'm using is to launch multiple copies of the same PHP
 script simultaneously using php.exe (CLI mode). This could easily be
 multiple FastCGI scripts or multiple ISAPI threads.

 On 16/04/07, William A. Rowe, Jr. [EMAIL PROTECTED] wrote:
 Richard Quadling wrote:
  So isn't locking the solution for Windows?

 If this is single writer process, even with multithreads - a mutex
 is most efficient, otherwise with concurrent writer processes, file
 locking makes the most sense.

 Bill




Index: ext/standard/config.w32
===
RCS file: /repository/php-src/ext/standard/config.w32,v
retrieving revision 1.4.2.2
diff -u -r1.4.2.2 config.w32
--- ext/standard/config.w32 4 Jan 2006 21:31:29 -   1.4.2.2
+++ ext/standard/config.w32 17 Apr 2007 11:34:16 -
@@ -16,5 +16,5 @@
url_scanner_ex.c ftp_fopen_wrapper.c http_fopen_wrapper.c \
php_fopen_wrapper.c credits.c css.c var_unserializer.c ftok.c sha1.c \
user_filters.c uuencode.c filters.c proc_open.c \
-   streamsfuncs.c http.c, false /* never shared */);
+   streamsfuncs.c http.c flock_compat.c, false /* never shared */);

Index: main/main.c
===
RCS file: /repository/php-src/main/main.c,v
retrieving revision 1.640.2.23.2.34
diff -u -r1.640.2.23.2.34 main.c
--- main/main.c 16 Apr 2007 08:09:56 -  1.640.2.23.2.34
+++ main/main.c 17 Apr 2007 11:49:49 -
@@ -63,6 +63,7 @@
 #ifdef PHP_WIN32
 #include io.h
 #include win32/php_registry.h
+#include ext/standard/flock_compat.h
 #endif
 #include php_syslog.h
 #include Zend/zend_exceptions.h
@@ -362,8 +363,11 @@
time(error_time);
strftime(error_time_str, sizeof(error_time_str), %d-%b-%Y 
%H:%M:%S, php_localtime_r(error_time, tmbuf));
len = spprintf(tmp, 0, [%s] %s%s, error_time_str, 
log_message, PHP_EOL);
+#ifdef PHP_WIN32
+   php_flock(fd, 2);
+#endif
write(fd, tmp, len);
-   efree(tmp);
+   efree(tmp);
close(fd);
return;
}
Index: win32/build/config.w32
===
RCS file: /repository/php-src/win32/build/config.w32,v
retrieving revision 1.40.2.8.2.9
diff -u -r1.40.2.8.2.9 config.w32
--- win32/build/config.w32  16 Apr 2007 08:09:56 -  1.40.2.8.2.9
+++ win32/build/config.w32  17 Apr 2007 11:39:05 -
@@ -309,7 +309,7 @@
 ADD_SOURCES(main/streams, streams.c cast.c memory.c filter.c 
plain_wrapper.c \
userspace.c transports.c xp_socket.c mmap.c);

-ADD_SOURCES(win32, crypt_win32.c flock.c glob.c md5crypt.c readdir.c \
+ADD_SOURCES(win32, crypt_win32.c glob.c md5crypt.c readdir.c \
registry.c select.c sendmail.c time.c wfile.c winutil.c wsyslog.c 
globals.c);

 ADD_SOURCES(regex, regcomp.c regerror.c regexec.c regfree.c);





--
-
Richard Quadling
Zend Certified Engineer : http://zend.com/zce.php?c=ZEND002498r=213474731
Standing on the shoulders of some very clever giants!

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



Re: [PHP-DEV] PHP6 todo list (E_STRICT in E_ALL)

2007-04-17 Thread Richard Quadling

On 17/04/07, Hannes Magnusson [EMAIL PROTECTED] wrote:

On 4/17/07, Christian Schneider [EMAIL PROTECTED] wrote:
 Hannes Magnusson wrote:
  7. add E_STRICT to E_ALL DONE (dmitry)
 
  My dictionary says that all means *all*, not all except this and
  this and sometimes not that.

 E_ALL should have been called E_RECOMMENDED or E_DEFAULT to avoid this
 confusion but in reality changing E_ALL to include everything would
 unnecessarily break existing installations. I think we will have to live
 with this misnomer and not try to 'fix' it.

How exactly would any app break?
You don't display errors on your production server, do you?
It will only help you understand what is going on while you develop
the application.

I think what we need here is fix our php.ini files: php.ini-production
 php.ini-developing

-Hannes


In development mode I want to see every single
error/notice/warning/etc. How else am I supposed to know if I've done
something incorrect or the sand has shifted beneath my feet and I
didn't realise?

In production no errors should be displayed (i.e. all nice clean code)
but even if they are they should only be logged and not displayed.

So in both circumstances E_ALL should __still__ mean every single
error/notice/warning/etc.

I do like the idea of production and development ini files. That seems
to make more sense than recommended and dist. I'm sure dist means
distribution, but then what does recommended mean? Without knowing the
reason, seeing recommended and dist are confusing.

--
-
Richard Quadling
Zend Certified Engineer : http://zend.com/zce.php?c=ZEND002498r=213474731
Standing on the shoulders of some very clever giants!

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



Re: [PHP-DEV] Build failure

2007-04-16 Thread Richard Quadling

That's good news. Has a patch been submitted? Even if it is initially
only a win32 compiler directive wrapping the lock?

On 14/04/07, Rob Richards [EMAIL PROTECTED] wrote:

I can sometimes reproduce the missing entries though never get data
corruption anymore.
This might now be a Windows only issue with how it is caching writes. I
did a little debugging and no errors occurred.
The file was opened successfully every time, the data was written
(correct number of bytes as well) every single time, but depending upon
the load on my system at the time it was a crap shoot whether every
single write actually made it into the physical file or not. Adding a
lock here did resolve it so that it worked 100% of the time.

Rob

Richard Quadling wrote:
 So why are there missing entries?

 I can even get the corruption back again if I use a shorter line (100
 rather than 5000).


 On 13/04/07, Ilia Alshanetsky [EMAIL PROTECTED] wrote:
 The new implementation does not use any locks, instead it uses direct
 io, where locks are not necessary for append operations.


 On 13-Apr-07, at 6:33 AM, Richard Quadling wrote:

  On 05/04/07, Rob Richards [EMAIL PROTECTED] wrote:
  No difference using sprintf()/fwrite() instead of fprintf().
 
  I did come across a similar issue from apache:
  http://mail-archives.apache.org/mod_mbox/httpd-dev/199503.mbox/%
  [EMAIL PROTECTED]
 
  Changing to use VCWD_OPEN_MODE, write() and close() seems to work.
 
  Rob
 
 
  Using PHP 5.2.2RC2-dev (cli) (built: Apr 13 2007 04:03:02) on
  Windows with
 
  for %x in (A B C D E F G H I J K L M N O P Q R S T U V W X Y Z) do
  start php -r ini_set('error_log','/tmp/test.log');for($i=0;$i1000;
  $i++)error_log(str_repeat('%x',5000));`;
 
  And then doing some analysis of the log file I'm finding that not all
  the data has been written.
 
  Array
  (
 [A] = 4965993
 [B] = 4590918
 [C] = 4525905
 [D] = 4695939
 [E] = 4495899
 [F] = 4710942
 [G] = 4495899
 [H] = 4645929
 [I] = 4540908
 [J] = 4580916
 [K] = 4535907
 [L] = 4470894
 [M] = 4480896
 [N] = 4550910
 [O] = 4610922
 [P] = 4500900
 [Q] = 4630926
 [R] = 4480896
 [S] = 4500900
 [T] = 4535907
 [U] = 4630926
 [V] = 4470894
 [W] = 4645929
 [X] = 4825965
 [Y] = 4845969
 [Z] = 4920984
  )
  Lines (Should be 26 * 1000) : 23973
  Longest (Should be 5024) : 5024
  Shortest (Should be 5024) : 5024
 
  Out of the 26,000 lines expected we are missing 2027 lines.
 
  So no corruption of the lines, just missing ones.
 
  The only explanation I can think of is that the locking is working,
  but nothing is waiting for the lock to become available.
 
  Richard.
 
 
  --
  -
  Richard Quadling
  Zend Certified Engineer : http://zend.com/zce.php?
  c=ZEND002498r=213474731
  Standing on the shoulders of some very clever giants!

 Ilia Alshanetsky











--
-
Richard Quadling
Zend Certified Engineer : http://zend.com/zce.php?c=ZEND002498r=213474731
Standing on the shoulders of some very clever giants!

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



Re: [PHP-DEV] Build failure

2007-04-16 Thread Richard Quadling

So isn't locking the solution for Windows?

On 16/04/07, William A. Rowe, Jr. [EMAIL PROTECTED] wrote:

On Windows, there is no such thing as a true open-write-for-append.

Unlike Unix, write for append mode is not atomic, internally it is a
seek + write.  Mix that with multiple writers, and you have an inherent
race condition built it.


Richard Quadling wrote:
 That's good news. Has a patch been submitted? Even if it is initially
 only a win32 compiler directive wrapping the lock?

 On 14/04/07, Rob Richards [EMAIL PROTECTED] wrote:
 I can sometimes reproduce the missing entries though never get data
 corruption anymore.
 This might now be a Windows only issue with how it is caching writes. I
 did a little debugging and no errors occurred.
 The file was opened successfully every time, the data was written
 (correct number of bytes as well) every single time, but depending upon
 the load on my system at the time it was a crap shoot whether every
 single write actually made it into the physical file or not. Adding a
 lock here did resolve it so that it worked 100% of the time.

 Rob

 Richard Quadling wrote:
  So why are there missing entries?
 
  I can even get the corruption back again if I use a shorter line (100
  rather than 5000).
 
 
  On 13/04/07, Ilia Alshanetsky [EMAIL PROTECTED] wrote:
  The new implementation does not use any locks, instead it uses direct
  io, where locks are not necessary for append operations.
 
 
  On 13-Apr-07, at 6:33 AM, Richard Quadling wrote:
 
   On 05/04/07, Rob Richards [EMAIL PROTECTED] wrote:
   No difference using sprintf()/fwrite() instead of fprintf().
  
   I did come across a similar issue from apache:
   http://mail-archives.apache.org/mod_mbox/httpd-dev/199503.mbox/%
   [EMAIL PROTECTED]
  
   Changing to use VCWD_OPEN_MODE, write() and close() seems to work.
  
   Rob
  
  
   Using PHP 5.2.2RC2-dev (cli) (built: Apr 13 2007 04:03:02) on
   Windows with
  
   for %x in (A B C D E F G H I J K L M N O P Q R S T U V W X Y Z) do
   start php -r ini_set('error_log','/tmp/test.log');for($i=0;$i1000;
   $i++)error_log(str_repeat('%x',5000));`;
  
   And then doing some analysis of the log file I'm finding that not
 all
   the data has been written.
  
   Array
   (
  [A] = 4965993
  [B] = 4590918
  [C] = 4525905
  [D] = 4695939
  [E] = 4495899
  [F] = 4710942
  [G] = 4495899
  [H] = 4645929
  [I] = 4540908
  [J] = 4580916
  [K] = 4535907
  [L] = 4470894
  [M] = 4480896
  [N] = 4550910
  [O] = 4610922
  [P] = 4500900
  [Q] = 4630926
  [R] = 4480896
  [S] = 4500900
  [T] = 4535907
  [U] = 4630926
  [V] = 4470894
  [W] = 4645929
  [X] = 4825965
  [Y] = 4845969
  [Z] = 4920984
   )
   Lines (Should be 26 * 1000) : 23973
   Longest (Should be 5024) : 5024
   Shortest (Should be 5024) : 5024
  
   Out of the 26,000 lines expected we are missing 2027 lines.
  
   So no corruption of the lines, just missing ones.
  
   The only explanation I can think of is that the locking is working,
   but nothing is waiting for the lock to become available.
  
   Richard.
  
  
   --
   -
   Richard Quadling
   Zend Certified Engineer : http://zend.com/zce.php?
   c=ZEND002498r=213474731
   Standing on the shoulders of some very clever giants!
 
  Ilia Alshanetsky
 
 
 
 
 
 
 








--
-
Richard Quadling
Zend Certified Engineer : http://zend.com/zce.php?c=ZEND002498r=213474731
Standing on the shoulders of some very clever giants!

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



Re: [PHP-DEV] Build failure

2007-04-16 Thread Richard Quadling

The testing I'm using is to launch multiple copies of the same PHP
script simultaneously using php.exe (CLI mode). This could easily be
multiple FastCGI scripts or multiple ISAPI threads.

On 16/04/07, William A. Rowe, Jr. [EMAIL PROTECTED] wrote:

Richard Quadling wrote:
 So isn't locking the solution for Windows?

If this is single writer process, even with multithreads - a mutex
is most efficient, otherwise with concurrent writer processes, file
locking makes the most sense.

Bill




--
-
Richard Quadling
Zend Certified Engineer : http://zend.com/zce.php?c=ZEND002498r=213474731
Standing on the shoulders of some very clever giants!

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



Re: [PHP-DEV] Build failure

2007-04-13 Thread Richard Quadling

On 05/04/07, Rob Richards [EMAIL PROTECTED] wrote:

No difference using sprintf()/fwrite() instead of fprintf().

I did come across a similar issue from apache:
http://mail-archives.apache.org/mod_mbox/httpd-dev/199503.mbox/[EMAIL PROTECTED]

Changing to use VCWD_OPEN_MODE, write() and close() seems to work.

Rob



Using PHP 5.2.2RC2-dev (cli) (built: Apr 13 2007 04:03:02) on Windows with

for %x in (A B C D E F G H I J K L M N O P Q R S T U V W X Y Z) do
start php -r 
ini_set('error_log','/tmp/test.log');for($i=0;$i1000;$i++)error_log(str_repeat('%x',5000));`;

And then doing some analysis of the log file I'm finding that not all
the data has been written.

Array
(
   [A] = 4965993
   [B] = 4590918
   [C] = 4525905
   [D] = 4695939
   [E] = 4495899
   [F] = 4710942
   [G] = 4495899
   [H] = 4645929
   [I] = 4540908
   [J] = 4580916
   [K] = 4535907
   [L] = 4470894
   [M] = 4480896
   [N] = 4550910
   [O] = 4610922
   [P] = 4500900
   [Q] = 4630926
   [R] = 4480896
   [S] = 4500900
   [T] = 4535907
   [U] = 4630926
   [V] = 4470894
   [W] = 4645929
   [X] = 4825965
   [Y] = 4845969
   [Z] = 4920984
)
Lines (Should be 26 * 1000) : 23973
Longest (Should be 5024) : 5024
Shortest (Should be 5024) : 5024

Out of the 26,000 lines expected we are missing 2027 lines.

So no corruption of the lines, just missing ones.

The only explanation I can think of is that the locking is working,
but nothing is waiting for the lock to become available.

Richard.


--
-
Richard Quadling
Zend Certified Engineer : http://zend.com/zce.php?c=ZEND002498r=213474731
Standing on the shoulders of some very clever giants!

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



Re: [PHP-DEV] Build failure

2007-04-13 Thread Richard Quadling

So why are there missing entries?

I can even get the corruption back again if I use a shorter line (100
rather than 5000).


On 13/04/07, Ilia Alshanetsky [EMAIL PROTECTED] wrote:

The new implementation does not use any locks, instead it uses direct
io, where locks are not necessary for append operations.


On 13-Apr-07, at 6:33 AM, Richard Quadling wrote:

 On 05/04/07, Rob Richards [EMAIL PROTECTED] wrote:
 No difference using sprintf()/fwrite() instead of fprintf().

 I did come across a similar issue from apache:
 http://mail-archives.apache.org/mod_mbox/httpd-dev/199503.mbox/%
 [EMAIL PROTECTED]

 Changing to use VCWD_OPEN_MODE, write() and close() seems to work.

 Rob


 Using PHP 5.2.2RC2-dev (cli) (built: Apr 13 2007 04:03:02) on
 Windows with

 for %x in (A B C D E F G H I J K L M N O P Q R S T U V W X Y Z) do
 start php -r ini_set('error_log','/tmp/test.log');for($i=0;$i1000;
 $i++)error_log(str_repeat('%x',5000));`;

 And then doing some analysis of the log file I'm finding that not all
 the data has been written.

 Array
 (
[A] = 4965993
[B] = 4590918
[C] = 4525905
[D] = 4695939
[E] = 4495899
[F] = 4710942
[G] = 4495899
[H] = 4645929
[I] = 4540908
[J] = 4580916
[K] = 4535907
[L] = 4470894
[M] = 4480896
[N] = 4550910
[O] = 4610922
[P] = 4500900
[Q] = 4630926
[R] = 4480896
[S] = 4500900
[T] = 4535907
[U] = 4630926
[V] = 4470894
[W] = 4645929
[X] = 4825965
[Y] = 4845969
[Z] = 4920984
 )
 Lines (Should be 26 * 1000) : 23973
 Longest (Should be 5024) : 5024
 Shortest (Should be 5024) : 5024

 Out of the 26,000 lines expected we are missing 2027 lines.

 So no corruption of the lines, just missing ones.

 The only explanation I can think of is that the locking is working,
 but nothing is waiting for the lock to become available.

 Richard.


 --
 -
 Richard Quadling
 Zend Certified Engineer : http://zend.com/zce.php?
 c=ZEND002498r=213474731
 Standing on the shoulders of some very clever giants!

Ilia Alshanetsky








--
-
Richard Quadling
Zend Certified Engineer : http://zend.com/zce.php?c=ZEND002498r=213474731
Standing on the shoulders of some very clever giants!

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



Re: [PHP-DEV] Build failed on Windows

2007-04-07 Thread Richard Quadling

Also a clear understanding of exactly what MS compiler must be used.
Will the free MS VC++ 2005 Express Edition be suitable? If so, this
could actually allow more building and testing by those like me who
have no access to a *ix box and quite frankly don't know what the fuss
is all about with *ix as Windows does EVERYTHING you could possibly
want!

Hmmm..

(Wait for gasp of breath and sudden adrenaline boost ...)

Ok. Just joking there, *ix is great (or so I've been told - really NOT
sure you know!), but I spend too long talking to users who have a
locked down system and bosses who can get a 2 hour turnaround on
anything they have (from a PDA to a server) if it all goes wrong and
won't pay for anything else!


What I'm basically saying is that you lot already understand the build
process and for those like me and Igor, some support would be great if
for nothing else we could maybe help fix some of the window specific
problems and missing functionality from windows and if we don't
succeed first time, we will learn, PHP grows, we all create world
peace, yada, yada, yada. Save us from repeating previous mistakes,
etc., etc.


On 07/04/07, Igor Golubev [EMAIL PROTECTED] wrote:

Hello,

I spent the whole day trying to build PHP 4.4.x on Windows from
source. I have read through the documentation
(http://www.php.net/manual/ru/install.windows.building.php) and did
everything in accordance to it. I tried to build PHP 4.4.6, 4.4.0 and
the latest snapshot with MSVS6 SP6 and MSVS2005 SP1, all with no
success. The problem is that the  projects in the win32 subfolder
don't match the actual code. For example, both php4dll.dsp and
php4dllts.dsp in the latest releases refer to absent files in
ext\pcre. Moreover, all these VS-projects weren't updated for ages. I
managed to fix the projects, but then I received some other errors
during compilation, which aren't related to my fixes. The more I fixed
them, the more I got in return. I've given up. After all the
headaches, I've decided to ask here. Could someone here give me some
advice on how to build PHP 4 on Windows from the source?

PS. I wonder how all these windows releases had been built, as it
seems impossible to achieve this with the prepackaged project files?

With regards,
Igor

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





--
-
Richard Quadling
Zend Certified Engineer : http://zend.com/zce.php?c=ZEND002498r=213474731
Standing on the shoulders of some very clever giants!

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



Re: [PHP-DEV] Build failure

2007-04-05 Thread Richard Quadling

http://rquadling.php1h.com/main.c.diff.txt for HEAD. I don't know how
to patch a specific version.


On 05/04/07, Rasmus Lerdorf [EMAIL PROTECTED] wrote:

Matt Wilmas wrote:
 Hi,

 Maybe just a Windows problem if it wasn't noticed yet, but I was compiling
 the latest 5.2 snapshot and got:

 main.obj : error LNK2019: unresolved external symbol _php_flock referenced
 in function _php_log_err
 Release_TS\php5ts.dll : fatal error LNK1120: 1 unresolved externals

 Caused by this recent commit, http://news.php.net/php.cvs/43683, and I
 commented the php_flock line as a workaround.  The Windows 5.2 snapshots
 haven't been updated because of this either, of course.

I see no reason for that lock at all as I commented when this was
committed, but Ilia never replied.  This is a single write operation now
since those fprintf's are now one, so that part of the fix is good, but
the lock call is not needed since single writes in append mode are
atomic, even on Windows.

So, your work around is fine and should actually be committed.

-Rasmus

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





--
-
Richard Quadling
Zend Certified Engineer : http://zend.com/zce.php?c=ZEND002498r=213474731
Standing on the shoulders of some very clever giants!

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



Re: [PHP-DEV] Build failure

2007-04-05 Thread Richard Quadling

Using PHP 5.2.2-dev (cli) (built: Mar 23 2007 07:02:57) I can
replicate the problem on Windows.

Using this single line command at the CMD prompt:

for %x in (A B C D E F G H I J K L M N O P Q R S T U V W X Y Z) do
start php -r 
ini_set('error_log','/tmp/test.log');for($i=0;$i100;$i++)error_log(str_repeat('%x',5000));

The log file has many broken lines.

On 05/04/07, Ilia Alshanetsky [EMAIL PROTECTED] wrote:

Rasmus,

Sorry for the delay in the reply. According to my tests on linux
using the sample script provided by the original bug reporter having
no lock causes a problem when the error message is 4k in length. In
this case multiple buffers are used and corruption can happen (it did
on a dual cpu machine with 10 error log writing threads running),
which is why I feel the lock is needed.


On 5-Apr-07, at 1:29 AM, Rasmus Lerdorf wrote:

 Matt Wilmas wrote:
 Hi,

 Maybe just a Windows problem if it wasn't noticed yet, but I was
 compiling
 the latest 5.2 snapshot and got:

 main.obj : error LNK2019: unresolved external symbol _php_flock
 referenced
 in function _php_log_err
 Release_TS\php5ts.dll : fatal error LNK1120: 1 unresolved externals

 Caused by this recent commit, http://news.php.net/php.cvs/43683,
 and I
 commented the php_flock line as a workaround.  The Windows 5.2
 snapshots
 haven't been updated because of this either, of course.

 I see no reason for that lock at all as I commented when this was
 committed, but Ilia never replied.  This is a single write
 operation now
 since those fprintf's are now one, so that part of the fix is good,
 but
 the lock call is not needed since single writes in append mode are
 atomic, even on Windows.

 So, your work around is fine and should actually be committed.

 -Rasmus

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


Ilia Alshanetsky

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





--
-
Richard Quadling
Zend Certified Engineer : http://zend.com/zce.php?c=ZEND002498r=213474731
Standing on the shoulders of some very clever giants!

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



Re: [PHP-DEV] Build failure

2007-04-05 Thread Richard Quadling

Using ProcMon on WinXP, you can see that the different processes
interleave the writes but in blocks of 4096 bytes. The remaining 929
bytes will sometimes be written after another processes 4096/929
bytes.

Locking IS required here.

On 05/04/07, Richard Quadling [EMAIL PROTECTED] wrote:

Using PHP 5.2.2-dev (cli) (built: Mar 23 2007 07:02:57) I can
replicate the problem on Windows.

Using this single line command at the CMD prompt:

for %x in (A B C D E F G H I J K L M N O P Q R S T U V W X Y Z) do
start php -r 
ini_set('error_log','/tmp/test.log');for($i=0;$i100;$i++)error_log(str_repeat('%x',5000));

The log file has many broken lines.

On 05/04/07, Ilia Alshanetsky [EMAIL PROTECTED] wrote:
 Rasmus,

 Sorry for the delay in the reply. According to my tests on linux
 using the sample script provided by the original bug reporter having
 no lock causes a problem when the error message is 4k in length. In
 this case multiple buffers are used and corruption can happen (it did
 on a dual cpu machine with 10 error log writing threads running),
 which is why I feel the lock is needed.


 On 5-Apr-07, at 1:29 AM, Rasmus Lerdorf wrote:

  Matt Wilmas wrote:
  Hi,
 
  Maybe just a Windows problem if it wasn't noticed yet, but I was
  compiling
  the latest 5.2 snapshot and got:
 
  main.obj : error LNK2019: unresolved external symbol _php_flock
  referenced
  in function _php_log_err
  Release_TS\php5ts.dll : fatal error LNK1120: 1 unresolved externals
 
  Caused by this recent commit, http://news.php.net/php.cvs/43683,
  and I
  commented the php_flock line as a workaround.  The Windows 5.2
  snapshots
  haven't been updated because of this either, of course.
 
  I see no reason for that lock at all as I commented when this was
  committed, but Ilia never replied.  This is a single write
  operation now
  since those fprintf's are now one, so that part of the fix is good,
  but
  the lock call is not needed since single writes in append mode are
  atomic, even on Windows.
 
  So, your work around is fine and should actually be committed.
 
  -Rasmus
 
  --
  PHP Internals - PHP Runtime Development Mailing List
  To unsubscribe, visit: http://www.php.net/unsub.php
 

 Ilia Alshanetsky

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




--
-
Richard Quadling
Zend Certified Engineer : http://zend.com/zce.php?c=ZEND002498r=213474731
Standing on the shoulders of some very clever giants!




--
-
Richard Quadling
Zend Certified Engineer : http://zend.com/zce.php?c=ZEND002498r=213474731
Standing on the shoulders of some very clever giants!

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



Re: [PHP-DEV] Build failure

2007-04-05 Thread Richard Quadling

Is it possible that at the lowest layer within the C library that 4K
blocking is performed?

On 05/04/07, Rasmus Lerdorf [EMAIL PROTECTED] wrote:

Ilia Alshanetsky wrote:
 Rasmus,

 Sorry for the delay in the reply. According to my tests on linux using
 the sample script provided by the original bug reporter having no lock
 causes a problem when the error message is 4k in length. In this case
 multiple buffers are used and corruption can happen (it did on a dual
 cpu machine with 10 error log writing threads running), which is why I
 feel the lock is needed.

Did you do this test before or after you condensed the fprintf calls
into a single call?  With multiple fprintf calls there would be a
problem, but with a single one I don't see how it could possibly screw
it up.

-Rasmus

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





--
-
Richard Quadling
Zend Certified Engineer : http://zend.com/zce.php?c=ZEND002498r=213474731
Standing on the shoulders of some very clever giants!

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



Re: [PHP-DEV] Build failure

2007-04-05 Thread Richard Quadling

This test is with the multiline fprintf and no lock.

Adding the php_flock() has stalled the build process for Win32 (I
can't build on Win32 as I don't know how!).



On 05/04/07, Rasmus Lerdorf [EMAIL PROTECTED] wrote:

Yes, but again, is this test with the single fprintf call?  That's the
real fix for this problem, not the lock.

-Rasmus

Richard Quadling wrote:
 Using PHP 5.2.2-dev (cli) (built: Mar 23 2007 07:02:57) I can
 replicate the problem on Windows.

 Using this single line command at the CMD prompt:

 for %x in (A B C D E F G H I J K L M N O P Q R S T U V W X Y Z) do
 start php -r
 
ini_set('error_log','/tmp/test.log');for($i=0;$i100;$i++)error_log(str_repeat('%x',5000));


 The log file has many broken lines.

 On 05/04/07, Ilia Alshanetsky [EMAIL PROTECTED] wrote:
 Rasmus,

 Sorry for the delay in the reply. According to my tests on linux
 using the sample script provided by the original bug reporter having
 no lock causes a problem when the error message is 4k in length. In
 this case multiple buffers are used and corruption can happen (it did
 on a dual cpu machine with 10 error log writing threads running),
 which is why I feel the lock is needed.


 On 5-Apr-07, at 1:29 AM, Rasmus Lerdorf wrote:

  Matt Wilmas wrote:
  Hi,
 
  Maybe just a Windows problem if it wasn't noticed yet, but I was
  compiling
  the latest 5.2 snapshot and got:
 
  main.obj : error LNK2019: unresolved external symbol _php_flock
  referenced
  in function _php_log_err
  Release_TS\php5ts.dll : fatal error LNK1120: 1 unresolved externals
 
  Caused by this recent commit, http://news.php.net/php.cvs/43683,
  and I
  commented the php_flock line as a workaround.  The Windows 5.2
  snapshots
  haven't been updated because of this either, of course.
 
  I see no reason for that lock at all as I commented when this was
  committed, but Ilia never replied.  This is a single write
  operation now
  since those fprintf's are now one, so that part of the fix is good,
  but
  the lock call is not needed since single writes in append mode are
  atomic, even on Windows.
 
  So, your work around is fine and should actually be committed.
 
  -Rasmus
 
  --
  PHP Internals - PHP Runtime Development Mailing List
  To unsubscribe, visit: http://www.php.net/unsub.php
 

 Ilia Alshanetsky

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









--
-
Richard Quadling
Zend Certified Engineer : http://zend.com/zce.php?c=ZEND002498r=213474731
Standing on the shoulders of some very clever giants!

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



[PHP-DEV] Re: Patches for bug#33664

2007-04-02 Thread Richard Quadling

On 22/03/07, Richard Quadling [EMAIL PROTECTED] wrote:

As subject.


Does anyone care about this? For those on Windows, the black box is
REALLY annoying when you develop scheduled CLI scripts which call
external apps. It takes focus away from what ever you are doing and
there is no need for the window.

I'm not saying that the shell shouldn't be launched, that is a
separate issue, just that the console window shouldn't/needn't be
shown.

Regards,

Richard Quadling.


--
-
Richard Quadling
Zend Certified Engineer : http://zend.com/zce.php?c=ZEND002498r=213474731
Standing on the shoulders of some very clever giants!

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



[PHP-DEV] Re: Patches for bug#33664

2007-04-02 Thread Richard Quadling

On 02/04/07, Richard Quadling [EMAIL PROTECTED] wrote:

On 22/03/07, Richard Quadling [EMAIL PROTECTED] wrote:
 As subject.

Does anyone care about this? For those on Windows, the black box is
REALLY annoying when you develop scheduled CLI scripts which call
external apps. It takes focus away from what ever you are doing and
there is no need for the window.

I'm not saying that the shell shouldn't be launched, that is a
separate issue, just that the console window shouldn't/needn't be
shown.

Regards,

Richard Quadling.


--
-
Richard Quadling
Zend Certified Engineer : http://zend.com/zce.php?c=ZEND002498r=213474731
Standing on the shoulders of some very clever giants!


Just in case you can't see the patches ...

Index: tsrm_win32.c
===
RCS file: /repository/TSRM/tsrm_win32.c,v
retrieving revision 1.31
diff -u -r1.31 tsrm_win32.c
--- tsrm_win32.c20 Mar 2007 17:57:44 -  1.31
+++ tsrm_win32.c22 Mar 2007 15:39:50 -
@@ -219,7 +219,7 @@

cmd = (char*)malloc(strlen(command)+strlen(TWG(comspec))+sizeof( /c 
));
sprintf(cmd, %s /c %s, TWG(comspec), command);
-   if (!CreateProcess(NULL, cmd, security, security,
security.bInheritHandle, NORMAL_PRIORITY_CLASS, env, cwd, startup,
process)) {
+   if (!CreateProcess(NULL, cmd, security, security,
security.bInheritHandle, NORMAL_PRIORITY_CLASS | CREATE_NO_WINDOW,
env, cwd, startup, process)) {
return NULL;
}
free(cmd);

Index: proc_open.c
===
RCS file: /repository/php-src/ext/standard/proc_open.c,v
retrieving revision 1.54
diff -u -r1.54 proc_open.c
--- proc_open.c 24 Feb 2007 16:25:55 -  1.54
+++ proc_open.c 22 Mar 2007 15:39:17 -
@@ -738,11 +738,11 @@
}

if (bypass_shell) {
-   newprocok = CreateProcess(NULL, command, security, security,
TRUE, NORMAL_PRIORITY_CLASS, env.envp, cwd, si, pi);
+   newprocok = CreateProcess(NULL, command, security, security,
TRUE, NORMAL_PRIORITY_CLASS | CREATE_NO_WINDOW, env.envp, cwd, si,
pi);
} else {
spprintf(command_with_cmd, 0, %s /c %s, GetVersion() 
0x8000 ? COMSPEC_NT : COMSPEC_9X, command);

-   newprocok = CreateProcess(NULL, command_with_cmd, security,
security, TRUE, NORMAL_PRIORITY_CLASS, env.envp, cwd, si, pi);
+   newprocok = CreateProcess(NULL, command_with_cmd, security,
security, TRUE, NORMAL_PRIORITY_CLASS | CREATE_NO_WINDOW, env.envp,
cwd, si, pi);

efree(command_with_cmd);
}

http://rquadling.php1h.com/proc_open.diff.txt
and
http://rquadling.php1h.com/tsrm_win32.diff.txt



--
-
Richard Quadling
Zend Certified Engineer : http://zend.com/zce.php?c=ZEND002498r=213474731
Standing on the shoulders of some very clever giants!

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



[PHP-DEV] snaps.php.net is not responding to http requests.

2007-03-23 Thread Richard Quadling

It seems.



--
-
Richard Quadling
Zend Certified Engineer : http://zend.com/zce.php?c=ZEND002498r=213474731
Standing on the shoulders of some very clever giants!

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



[PHP-DEV] Patches for bug#33664

2007-03-22 Thread Richard Quadling

As subject.

--
-
Richard Quadling
Zend Certified Engineer : http://zend.com/zce.php?c=ZEND002498r=213474731
Standing on the shoulders of some very clever giants!
Index: proc_open.c
===
RCS file: /repository/php-src/ext/standard/proc_open.c,v
retrieving revision 1.54
diff -u -r1.54 proc_open.c
--- proc_open.c 24 Feb 2007 16:25:55 -  1.54
+++ proc_open.c 22 Mar 2007 15:39:17 -
@@ -738,11 +738,11 @@
}

if (bypass_shell) {
-   newprocok = CreateProcess(NULL, command, security, security, 
TRUE, NORMAL_PRIORITY_CLASS, env.envp, cwd, si, pi);
+   newprocok = CreateProcess(NULL, command, security, security, 
TRUE, NORMAL_PRIORITY_CLASS | CREATE_NO_WINDOW, env.envp, cwd, si, pi);
} else {
spprintf(command_with_cmd, 0, %s /c %s, GetVersion()  
0x8000 ? COMSPEC_NT : COMSPEC_9X, command);
 
-   newprocok = CreateProcess(NULL, command_with_cmd, security, 
security, TRUE, NORMAL_PRIORITY_CLASS, env.envp, cwd, si, pi);
+   newprocok = CreateProcess(NULL, command_with_cmd, security, 
security, TRUE, NORMAL_PRIORITY_CLASS | CREATE_NO_WINDOW, env.envp, cwd, si, 
pi);
 
efree(command_with_cmd);
}
Index: tsrm_win32.c
===
RCS file: /repository/TSRM/tsrm_win32.c,v
retrieving revision 1.31
diff -u -r1.31 tsrm_win32.c
--- tsrm_win32.c20 Mar 2007 17:57:44 -  1.31
+++ tsrm_win32.c22 Mar 2007 15:39:50 -
@@ -219,7 +219,7 @@
 
cmd = (char*)malloc(strlen(command)+strlen(TWG(comspec))+sizeof( /c 
));
sprintf(cmd, %s /c %s, TWG(comspec), command);
-   if (!CreateProcess(NULL, cmd, security, security, 
security.bInheritHandle, NORMAL_PRIORITY_CLASS, env, cwd, startup, process)) {
+   if (!CreateProcess(NULL, cmd, security, security, 
security.bInheritHandle, NORMAL_PRIORITY_CLASS | CREATE_NO_WINDOW, env, cwd, 
startup, process)) {
return NULL;
}
free(cmd);
-- 
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Re: [PHP-DEV] GSoC

2007-03-21 Thread Richard Quadling

I agree. Because I can use 1 language to deal with web/cli/gui, I can
create classes which can be used in all 3 environments (though I'm not
GUI-ing at the moment). And from that single code base I can fix
multiple applications instantly without the need to recompile hundreds
of programs and libraries. I can potentially enhance all the
applications by adding new functionality. All sorts of good things.

Being interpreted and having multiple modes of operation is a
fantastic thing. I no longer write C/Delphi/BAT/sh scripts. I write
PHP classes and use them wherever I want/need. Testing via a CLI is a
lot easier sometimes than via a browser.

Though, I probably WOULDN'T to video encoding using userland PHP,
being able to do some things in userland PHP via an extension to a
library would be excellent.

The JEDI project for Delphi comes to mind
(http://www.delphi-jedi.org/). In its simplest form, the results of
the JEDI project is to allow Delphi to interact with any library.
Normally libraries have .h header files. But Delphi doesn't so the
JEDI project is a massive repository of code to allow you to interact
with these libraries.

JEDI extends the capabilities of Delphi considerably. And I doubt
everyone uses every new piece of functionality.

As a GSoC project idea, how about a mechanism to allow OS interaction
OUTSIDE of a PHP extension? I'm on windows, so that's what I know, but
not all things can be accessed from within PHP. But if there was a way
to bind to a particular library (like you would do in compilable
languages), then this could open PHP to a LOT more libraries a LOT
quicker and without the need to understand ALL the intricacies of
PHP's internals. Maybe.


On 21/03/07, Robert Cummings [EMAIL PROTECTED] wrote:

On Wed, 2007-03-21 at 11:57 +0300, Antony Dovgal wrote:

 I don't think anybody sane is doing audio encoding and video resizing in PHP.
 PHP is about interface, clients are not going to wait an hour or two for a 
page to load.

I think this is a limitation in your grasp of where and why PHP is being
used. I (and many others I've seen pass through php-general -- and
countless others I'm sure) use PHP as a general purpose scripting engine
for not just the web, but for shell scripts, and anything else that
comes to mind. I'm sure the PHP-GTK and other GUI binding extensions
would argue with you also.

Cheers,
Rob.
--
..
| InterJinn Application Framework - http://www.interjinn.com |
::
| An application and templating framework for PHP. Boasting  |
| a powerful, scalable system for accessing system services  |
| such as forms, properties, sessions, and caches. InterJinn |
| also provides an extremely flexible architecture for   |
| creating re-usable components quickly and easily.  |
`'


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





--
-
Richard Quadling
Zend Certified Engineer : http://zend.com/zce.php?c=ZEND002498r=213474731
Standing on the shoulders of some very clever giants!

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



Re: [PHP-DEV] A request for code change : Repeated opening and closing the session leads to a LOT of Set-Cookie headers.

2007-03-16 Thread Richard Quadling

On 15/03/07, Richard Lynch [EMAIL PROTECTED] wrote:

I think you still need locking in PHP Userland for concurrent access
to be meaningful to most developers...

Otherwise you end up with a race condition in the session save handler.


As only 1 process can hold the session at a time and the main process
is constantly letting go by session_write_close(), other processes
are able to open/read/close (to get the current status) or
open/write/close (to tell the main process to abort).

Without the session_write_close() in the main process, the secondary
processes will wait either for the appropriate set_time_limit() or
until the main process script ends. Which is correct.

This is working very well for me now.

It was the extra Set-Cookie headers which screwed things up for IE. By
using ini_set('sessions.use_cookies', 0); immediately after the
session_start() in the main process, the problem has been solved. The
main process doesn't output any urls/forms/etc, so the session id is
not appended to any urls.

If the session cookie could be cached then that would be great, but I
need someone else to look at the supplied patch (I'm not that good
with PHP internals).

Richard.

--
-
Richard Quadling
Zend Certified Engineer : http://zend.com/zce.php?c=ZEND002498r=213474731
Standing on the shoulders of some very clever giants!

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



Re: [PHP-DEV] A request for code change : Repeated opening and closing the session leads to a LOT of Set-Cookie headers.

2007-03-15 Thread Richard Quadling

Hello Markus and thank you for your comments.

I feel there are 2 things to be considered with your suggestion.

1 - It doesn't matter what the server side handler is
(files/user/sqlite/mm/etc), session data is not stored until you do a
session_write_close(). So for a separate process to have access to the
data, the session must be closed.

2 - For the main process to update the session, a session_start() is
required which generates the Set-Cookie header.

Sessions DO work nearly perfectly with the main process updating by
opening/closing and with the helper processes reading the status and
maybe updating the abort flag. It is just the superfluous Set-Cookie
headers and IE being crap.

Fixing php_session_send_cookie() to compare a previously saved header
with the one about to be sent shouldn't have a huge impact on the
majority of code and would seem to fix the problem.

I've attached a patch which I hope is more or less there.

I see this as an easy fix with possible a miniscule performance
increase as the header won't need to be sent when it is not needed.
OOI. It may be a better solution to detect duplicate headers in the
sapi_add_header_ex() function. Maybe.

I suspect though that the entire cookie needs to be compared (PS
should contain a smart_str prev_cookie rather than char *prev_id sort
of thing), but I'm not that good at the PHP's macros and without a
compiler I'm guessing.

I see that the v1.360 of session.c (Line 982) introduced this issue
by not replacing the cookie. So this has been around for a while.

Please add this little patch as it will mean AJAX with IE and PHP
sessions will all play nicely with each other and there is no need to
add additional userland code to deal with locking as PHP sessions do
EXACTLY what is required.

Regards,

Richard Quadling.



On 14/03/07, Markus Fischer [EMAIL PROTECTED] wrote:

-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Hello Richard,

before starting hacking the source, what do you think about using
session_set_save_handler() to specify your own custom session handlers
which write your session into a database and not on the file system?

I think this way, once you know the session id (which you do after the
first time you call session_start), you can simply update the
information in the database directly on your own without calling
session_start()/sesion_write_close() numerous times. Probably you need
to take care about locking on your own, but with a database that
shouldn't be too hard.

HTH,
- - Markus

Richard Quadling wrote:
 Hi.

 I have a webapp which uses Ajax to initiate a process on the server
 which could take several minutes to complete and will go through many
 steps to before the task is finished.

 In that script, I update the session to indicate the current position
 of the process.

 When the user initiates the main process, another AJAX request is made
 which examines the state of the main process (via the session) and
 reports back to the client - keeps them interested. The user can also
 abort the process and closing the browser also triggers an abort.

 All works FINE in FF. In IE, I'm getting a Page cannot be displayed
 sort of errror (having to debug the response to see this). This SEEMS
 to relate to the fact that I am closing and opening the session in the
 first script as I want to keep the session file uptodate. The process
 script only has 1 output and that is the final result at the end of
 the script.

 I also tested this using a telnet connection to the webserver and sent
 the same headers that FireFox generated (captured via FireBub) and it
 bombed just before the data arrived (Lost connection).

 e.g.

 ?php
 function UpdateSession($s_Progress) {
 session_start();
 $_SESSION['Progress'] = $s_Progress;
 session_write_close();
 }

 //Stage 1
 UpdateSession('Loading preferences');
 ...
 //Stage 10
 UpdateSession('Report generated and is now available at a href=' .
 MakeWebPath(realpath($s_PDFReport)) . 'here/a.');
 echo rawurlencode(json_encode(array('SUCCESS' =
 MakeWebPath(realpath($s_PDFReport);
 ?


 As a consequence, I get ...

 Set-Cookie: PHPSESSID=uWPNRja2oT0PHPDCLqUiMzXiz1b; path=/
 Set-Cookie: PHPSESSID=uWPNRja2oT0PHPDCLqUiMzXiz1b; path=/
 Set-Cookie: PHPSESSID=uWPNRja2oT0PHPDCLqUiMzXiz1b; path=/
 ...

 LOTS of times followed by a Page cannot be displayed. If I use
 Ethereal to examine the data, it is all there and is the same via IE
 and FF, it is just the IE doesn't like the REALLY long header.

 I accept this is normal behaviour and IE should deal with it, but ...

 Is there any mileage in stopping session_start from sending the same
 header if it has already been sent? If the PHPSESSID is different,
 then fine, send it.

 From looking at session.c and php_session.h, I think the following
 changes would suffice.

 1 - The typedef struct _php_ps_globals {} needs to include ...

 char *prev_id;


 2 - In PHP_GINIT_FUNCTION(ps) ...

 ps_globals-prev_id = NULL;


 3 - In php_session_send_cookie(TSRMLS_D), do

Re: [PHP-DEV] A request for code change : Repeated opening and closing the session leads to a LOT of Set-Cookie headers.

2007-03-15 Thread Richard Quadling

Hmm. Good idea! I think I also have to turn off session.use_only_cookies.

I just tried this, but within the framework the ini_set return false
(when the value is currently 1) and the setting was not altered and
I've yet to work out why.

In a simple test this works fine.

?php
for($i = 0 ; $i  246; ++$i) // 245 counts are OK, 246 are not.
{
session_start();
$_SESSION['Count'] = $i;
session_write_close();
//  ini_set(session.use_cookies, 0); // Removing the comment here and
upping the count above worked fine.
}
var_dump($_SESSION);
?

On 15/03/07, Stefan Esser [EMAIL PROTECTED] wrote:

Hello Richard,

your problem is a bug in the session extension.

My suggested but not tested workaround is that you simply call

ini_set(session.use_cookies, 0);

after the first time you call session_write_close(). This will stop the
session extension from sending further cookies during a single request.

Stefan Esser

Richard Quadling schrieb:
 Hi.

 I have a webapp which uses Ajax to initiate a process on the server
 which could take several minutes to complete and will go through many
 steps to before the task is finished.

 In that script, I update the session to indicate the current position
 of the process.

 When the user initiates the main process, another AJAX request is made
 which examines the state of the main process (via the session) and
 reports back to the client - keeps them interested. The user can also
 abort the process and closing the browser also triggers an abort.

 All works FINE in FF. In IE, I'm getting a Page cannot be displayed
 sort of errror (having to debug the response to see this). This SEEMS
 to relate to the fact that I am closing and opening the session in the
 first script as I want to keep the session file uptodate. The process
 script only has 1 output and that is the final result at the end of
 the script.

 I also tested this using a telnet connection to the webserver and sent
 the same headers that FireFox generated (captured via FireBub) and it
 bombed just before the data arrived (Lost connection).

 e.g.

 ?php
 function UpdateSession($s_Progress) {
 session_start();
 $_SESSION['Progress'] = $s_Progress;
 session_write_close();
 }

 //Stage 1
 UpdateSession('Loading preferences');
 ...
 //Stage 10
 UpdateSession('Report generated and is now available at a href=' .
 MakeWebPath(realpath($s_PDFReport)) . 'here/a.');
 echo rawurlencode(json_encode(array('SUCCESS' =
 MakeWebPath(realpath($s_PDFReport);
 ?


 As a consequence, I get ...

 Set-Cookie: PHPSESSID=uWPNRja2oT0PHPDCLqUiMzXiz1b; path=/
 Set-Cookie: PHPSESSID=uWPNRja2oT0PHPDCLqUiMzXiz1b; path=/
 Set-Cookie: PHPSESSID=uWPNRja2oT0PHPDCLqUiMzXiz1b; path=/
 ...

 LOTS of times followed by a Page cannot be displayed. If I use
 Ethereal to examine the data, it is all there and is the same via IE
 and FF, it is just the IE doesn't like the REALLY long header.

 I accept this is normal behaviour and IE should deal with it, but ...

 Is there any mileage in stopping session_start from sending the same
 header if it has already been sent? If the PHPSESSID is different,
 then fine, send it.

 From looking at session.c and php_session.h, I think the following
 changes would suffice.

 1 - The typedef struct _php_ps_globals {} needs to include ...

 char *prev_id;


 2 - In PHP_GINIT_FUNCTION(ps) ...

 ps_globals-prev_id = NULL;


 3 - In php_session_send_cookie(TSRMLS_D), do a comparison of prev_id
 and id (taking into account prev_id could be NULL) and if different,
 then allow the cookie to be set and to update prev_id with the id
 sent.


 Some other issues, if other parts of the cookie are altered, then
 maybe rather than just examining the ID, the entire cookie should be
 remembered.


 Assuming that the cookie would be identical, repeatedly sending it to
 the client when the session is repeatedly opened is a pain and I think
 can easily be fixed.


 Thank you for your time.

 Richard Quadling.








--
-
Richard Quadling
Zend Certified Engineer : http://zend.com/zce.php?c=ZEND002498r=213474731
Standing on the shoulders of some very clever giants!

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



Re: [PHP-DEV] A request for code change : Repeated opening and closing the session leads to a LOT of Set-Cookie headers.

2007-03-15 Thread Richard Quadling

Ha!

Stupido! I had cut'n'pasted and somehow had a trailing space on the
ini entry name!

But, it works a treat.

Is this worth mentioning in the dox? I have karma there, but I don't
want to add just because I can.



On 15/03/07, Richard Quadling [EMAIL PROTECTED] wrote:

Hmm. Good idea! I think I also have to turn off session.use_only_cookies.

I just tried this, but within the framework the ini_set return false
(when the value is currently 1) and the setting was not altered and
I've yet to work out why.

In a simple test this works fine.

?php
for($i = 0 ; $i  246; ++$i) // 245 counts are OK, 246 are not.
{
session_start();
$_SESSION['Count'] = $i;
session_write_close();
//  ini_set(session.use_cookies, 0); // Removing the comment here and
upping the count above worked fine.
}
var_dump($_SESSION);
?

On 15/03/07, Stefan Esser [EMAIL PROTECTED] wrote:
 Hello Richard,

 your problem is a bug in the session extension.

 My suggested but not tested workaround is that you simply call

 ini_set(session.use_cookies, 0);

 after the first time you call session_write_close(). This will stop the
 session extension from sending further cookies during a single request.

 Stefan Esser

 Richard Quadling schrieb:
  Hi.
 
  I have a webapp which uses Ajax to initiate a process on the server
  which could take several minutes to complete and will go through many
  steps to before the task is finished.
 
  In that script, I update the session to indicate the current position
  of the process.
 
  When the user initiates the main process, another AJAX request is made
  which examines the state of the main process (via the session) and
  reports back to the client - keeps them interested. The user can also
  abort the process and closing the browser also triggers an abort.
 
  All works FINE in FF. In IE, I'm getting a Page cannot be displayed
  sort of errror (having to debug the response to see this). This SEEMS
  to relate to the fact that I am closing and opening the session in the
  first script as I want to keep the session file uptodate. The process
  script only has 1 output and that is the final result at the end of
  the script.
 
  I also tested this using a telnet connection to the webserver and sent
  the same headers that FireFox generated (captured via FireBub) and it
  bombed just before the data arrived (Lost connection).
 
  e.g.
 
  ?php
  function UpdateSession($s_Progress) {
  session_start();
  $_SESSION['Progress'] = $s_Progress;
  session_write_close();
  }
 
  //Stage 1
  UpdateSession('Loading preferences');
  ...
  //Stage 10
  UpdateSession('Report generated and is now available at a href=' .
  MakeWebPath(realpath($s_PDFReport)) . 'here/a.');
  echo rawurlencode(json_encode(array('SUCCESS' =
  MakeWebPath(realpath($s_PDFReport);
  ?
 
 
  As a consequence, I get ...
 
  Set-Cookie: PHPSESSID=uWPNRja2oT0PHPDCLqUiMzXiz1b; path=/
  Set-Cookie: PHPSESSID=uWPNRja2oT0PHPDCLqUiMzXiz1b; path=/
  Set-Cookie: PHPSESSID=uWPNRja2oT0PHPDCLqUiMzXiz1b; path=/
  ...
 
  LOTS of times followed by a Page cannot be displayed. If I use
  Ethereal to examine the data, it is all there and is the same via IE
  and FF, it is just the IE doesn't like the REALLY long header.
 
  I accept this is normal behaviour and IE should deal with it, but ...
 
  Is there any mileage in stopping session_start from sending the same
  header if it has already been sent? If the PHPSESSID is different,
  then fine, send it.
 
  From looking at session.c and php_session.h, I think the following
  changes would suffice.
 
  1 - The typedef struct _php_ps_globals {} needs to include ...
 
  char *prev_id;
 
 
  2 - In PHP_GINIT_FUNCTION(ps) ...
 
  ps_globals-prev_id = NULL;
 
 
  3 - In php_session_send_cookie(TSRMLS_D), do a comparison of prev_id
  and id (taking into account prev_id could be NULL) and if different,
  then allow the cookie to be set and to update prev_id with the id
  sent.
 
 
  Some other issues, if other parts of the cookie are altered, then
  maybe rather than just examining the ID, the entire cookie should be
  remembered.
 
 
  Assuming that the cookie would be identical, repeatedly sending it to
  the client when the session is repeatedly opened is a pain and I think
  can easily be fixed.
 
 
  Thank you for your time.
 
  Richard Quadling.
 
 
 




--
-
Richard Quadling
Zend Certified Engineer : http://zend.com/zce.php?c=ZEND002498r=213474731
Standing on the shoulders of some very clever giants!




--
-
Richard Quadling
Zend Certified Engineer : http://zend.com/zce.php?c=ZEND002498r=213474731
Standing on the shoulders of some very clever giants!

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



[PHP-DEV] A request for code change : Repeated opening and closing the session leads to a LOT of Set-Cookie headers.

2007-03-14 Thread Richard Quadling

Hi.

I have a webapp which uses Ajax to initiate a process on the server
which could take several minutes to complete and will go through many
steps to before the task is finished.

In that script, I update the session to indicate the current position
of the process.

When the user initiates the main process, another AJAX request is made
which examines the state of the main process (via the session) and
reports back to the client - keeps them interested. The user can also
abort the process and closing the browser also triggers an abort.

All works FINE in FF. In IE, I'm getting a Page cannot be displayed
sort of errror (having to debug the response to see this). This SEEMS
to relate to the fact that I am closing and opening the session in the
first script as I want to keep the session file uptodate. The process
script only has 1 output and that is the final result at the end of
the script.

I also tested this using a telnet connection to the webserver and sent
the same headers that FireFox generated (captured via FireBub) and it
bombed just before the data arrived (Lost connection).

e.g.

?php
function UpdateSession($s_Progress) {
session_start();
$_SESSION['Progress'] = $s_Progress;
session_write_close();
}

//Stage 1
UpdateSession('Loading preferences');
...
//Stage 10
UpdateSession('Report generated and is now available at a href=' .
MakeWebPath(realpath($s_PDFReport)) . 'here/a.');
echo rawurlencode(json_encode(array('SUCCESS' =
MakeWebPath(realpath($s_PDFReport);
?


As a consequence, I get ...

Set-Cookie: PHPSESSID=uWPNRja2oT0PHPDCLqUiMzXiz1b; path=/
Set-Cookie: PHPSESSID=uWPNRja2oT0PHPDCLqUiMzXiz1b; path=/
Set-Cookie: PHPSESSID=uWPNRja2oT0PHPDCLqUiMzXiz1b; path=/
...

LOTS of times followed by a Page cannot be displayed. If I use
Ethereal to examine the data, it is all there and is the same via IE
and FF, it is just the IE doesn't like the REALLY long header.

I accept this is normal behaviour and IE should deal with it, but ...

Is there any mileage in stopping session_start from sending the same
header if it has already been sent? If the PHPSESSID is different,
then fine, send it.


From looking at session.c and php_session.h, I think the following

changes would suffice.

1 - The typedef struct _php_ps_globals {} needs to include ...

char *prev_id;


2 - In PHP_GINIT_FUNCTION(ps) ...

ps_globals-prev_id = NULL;


3 - In php_session_send_cookie(TSRMLS_D), do a comparison of prev_id
and id (taking into account prev_id could be NULL) and if different,
then allow the cookie to be set and to update prev_id with the id
sent.


Some other issues, if other parts of the cookie are altered, then
maybe rather than just examining the ID, the entire cookie should be
remembered.


Assuming that the cookie would be identical, repeatedly sending it to
the client when the session is repeatedly opened is a pain and I think
can easily be fixed.


Thank you for your time.

Richard Quadling.



--
-
Richard Quadling
Zend Certified Engineer : http://zend.com/zce.php?c=ZEND002498r=213474731
Standing on the shoulders of some very clever giants!

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



Re: [PHP-DEV] Native Singleton Implementation

2007-03-07 Thread Richard Quadling

On 07/03/07, Peter Hodge [EMAIL PROTECTED] wrote:


There's plenty of room to improve PHP's OO capabilities for PHP6, and
singletons are a good start.

regards,
Peter


Like discrete setters and getters to allow for read/write, readonly
and writeonly properties.

I know this has been discussed endlessly here, but I sort of miss them
from Delphi, which is a fine GUI development environment, but not
really suitable for web development like the superb PHP is ;-).


--
-
Richard Quadling
Zend Certified Engineer : http://zend.com/zce.php?c=ZEND002498r=213474731
Standing on the shoulders of some very clever giants!

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



Re: [PHP-DEV] DateTime object equality

2007-03-05 Thread Richard Quadling

It would be interesting to know what other internal classes falsely
pass this non-identity comparison.

Then two new documentation entities could be used to say that
non-identity comparison is or is not possible with this class.

In my installation, I have 95 built in classes (with no extensions
added), or 106 with the extensions I use normally. I managed to get
upto 198 built in classes (by adding ALL the extensions I could get
working).

I suppose the step after this would be to make the built in classes
operate so that non-identity comparison operated based upon the USER's
perception of what should happen.



On 04/03/07, Hans Lellelid [EMAIL PROTECTED] wrote:

Hi all,

DateTime equality (not identity) appears to be broken.  I've created a
ticket for this issue (http://bugs.php.net/bug.php?id=40691), which
keeps getting marked as bogus by Ilia.  This may be a more appropriate
issue to raise on list, as I seem to be having both a very hard time
making my point about the inconsistency of the behavior and a very hard
time being convinced that this is not a bug (at *least* a documentation
problem, if nothing else) :)

The basic problem is that a [non-identity] comparison (==) of *any*
DateTime object with any other DateTime object will return TRUE.  Now, I
admit that I know little about the underlying layer, but as a developer
the DateTime object has a very clear set of properties (namely
date/time, maybe time zone) that I would expect would be compared by a
== equality check.

$d1 = new DateTime(2001-01-01);
$d2 = new DateTime(2007-02-28);
var_export($d1 == $d2); // Ouputs: TRUE


This always-return-TRUE behavior is extremely counter-intuitive.  It
also appears to be very exceptional in the PHP core classes.
Admittedly, I haven't looked through SPL, but the Exception object
provides a perfect example for what I would expect (based on the text in
the PHP manual about object comparison):

$a = new Exception(foo);
$b = new Exception(bar);
$c = new Exception(foo);

var_export($a == $b); // Outputs: FALSE
var_export($a == $c); // Outputs: TRUE

Obviously stdClass and user-defined classes exhibit this same behavior
of testing the object properties -- just as I'd expect from the
description in the manual.

Is this DateTime comparison behavior actually intended to be different
from everything else?  If there's some reason that DateTime object
properties cannot be compared to each other, wouldn't it be more
appropriate for them to always return FALSE ?

Thanks,
Hans

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





--
-
Richard Quadling
Zend Certified Engineer : http://zend.com/zce.php?c=ZEND002498r=213474731
Standing on the shoulders of some very clever giants!

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



[PHP-DEV] Probably old news, but new news if you didn't know about it.

2007-02-07 Thread Richard Quadling

http://www.theregister.co.uk/2007/02/07/stefan_esser_interview/


--
-
Richard Quadling
Zend Certified Engineer : http://zend.com/zce.php?c=ZEND002498r=213474731
Standing on the shoulders of some very clever giants!

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



Re: [PHP-DEV] Re: Syntactic improvement to array

2007-02-05 Thread Richard Quadling

On 05/02/07, LAUPRETRE François (P) [EMAIL PROTECTED] wrote:

 From: Christian Schneider [mailto:[EMAIL PROTECTED]
  - func('foo' = $foo, 'bar' = $bar, ...)   equivalent to
  func(array('foo' = $foo, 'bar' = $bar, ...)

Argh! Reading such a line, I think of named parameters, not an array. Ugly, 
confusing. -1 for
me. Definitely.


I agree with Francois here. Other than looking STRONLY like named
parameters, surely there is a flaw if a declaration is ...

function convert(array $from, array $to)

If the calling code is ...

convert('foo' = $foo, 'bar' = $bar, ...)

where is the boundaries for the 2 arrays?

There would need to be SOMETHING.



convert('foo'


--
-
Richard Quadling
Zend Certified Engineer : http://zend.com/zce.php?c=ZEND002498r=213474731
Standing on the shoulders of some very clever giants!


<    1   2   3   4   5   6   >