[PHP-DEV] Re: reproduce script (Re: [PHP-DEV] No static method callbacks anmore?)

2004-03-15 Thread Andi Gutmans
No need to post it as a bug. I'll look into it.
Thanks.
At 11:51 AM 3/15/2004 -0500, Hans Lellelid wrote:
Here's a script to reproduce the problem w/ static callbacks.

The problem only seems to happen when the function calling the static 
function using preg_replace_callback() is not declared 'static' itself, 
but is accessed as a static function. Also, this only happens when being 
called from another non-static method.  (let me know if you'd rather I 
post this as a bug)



class RegexpCallback {

private static $vars = array('one' => 1, 'two' => 2);

function replace($value) {
$sb = preg_replace_callback('/\$\{([^}]+)\}/', 
array('RegexpCallback', 'callback'), $value);
return $sb;
}

private static function callback($matches) {
$propertyName = $matches[1];
return self::$vars[$propertyName];
}
}

class Test {

function __construct() {
$value = 'one = ${one}, two=${two}';
$return1 = RegexpCallback::replace($value);
echo $return1 . "\n";
}
}
$t = new Test();

?>

--- Expected ---
one = 1, two = 2
--- Actual Results --

Warning - preg_replace_callback(): Unable to call custom replacement function
one = ${one}, two = ${two}
It works when  (1) called directly instead of in Test constructor, (2) 
the replace() method is declared 'static', (3) instantiate RegexpCallback 
and call ->replace() method on the instance rather than as a static method.

I actually have an interest in having the replace() method in my example 
be either static or not... which is why I'm not entirely satisfied with 
the fact that making it static fixes the problem.

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


[PHP-DEV] reproduce script (Re: [PHP-DEV] No static method callbacks anmore?)

2004-03-15 Thread Hans Lellelid
Here's a script to reproduce the problem w/ static callbacks.

The problem only seems to happen when the function calling the static 
function using preg_replace_callback() is not declared 'static' itself, 
but is accessed as a static function. Also, this only happens when being 
called from another non-static method.  (let me know if you'd rather I 
post this as a bug)



class RegexpCallback {

private static $vars = array('one' => 1, 'two' => 2);
	function replace($value) {
		$sb = preg_replace_callback('/\$\{([^}]+)\}/', array('RegexpCallback', 
'callback'), $value);
	return $sb;
	}

private static function callback($matches) {
$propertyName = $matches[1];
return self::$vars[$propertyName];
}
}

class Test {

function __construct() {
$value = 'one = ${one}, two=${two}';
$return1 = RegexpCallback::replace($value);
echo $return1 . "\n"; 
}
}
$t = new Test();

?>

--- Expected ---
one = 1, two = 2
--- Actual Results --

Warning - preg_replace_callback(): Unable to call custom replacement 
function
one = ${one}, two = ${two}

It works when  (1) called directly instead of in Test constructor, 
(2) the replace() method is declared 'static', (3) instantiate 
RegexpCallback and call ->replace() method on the instance rather than 
as a static method.

I actually have an interest in having the replace() method in my example 
be either static or not... which is why I'm not entirely satisfied with 
the fact that making it static fixes the problem.

Hans

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


Re: [PHP-DEV] obj == null check generates E_NOTICE

2004-03-15 Thread Andi Gutmans
At 11:21 AM 3/15/2004 -0500, Hans Lellelid wrote:
obj == null checks now trigger E_NOTICE

class Foo {
}
$t = new Foo();

if ($t == null) {
}
Notice - Object of class Foo could not be converted to boolean

Changing the comparison to $t === null makes the notice go away.  Is this 
intended?  If not I can post it as a bug report.
I already fixed this. We added a bit too aggressive notice :) Now it's not 
quite as aggressive as I would like it to be but it behaves like in PHP 4.

Andi

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


Re: [PHP-DEV] No static method callbacks anmore?

2004-03-15 Thread Jan Schneider
Zitat von Andi Gutmans <[EMAIL PROTECTED]>:

Can you do a reverse apply of the following diff and let me know if it
fixes the problem?
http://cvs.php.net/diff.php/ZendEngine2/zend_execute_API.c?r1=1.274&r2=1.275&ty=u
No, it doesn't.

At 05:04 PM 3/15/2004 +0100, Jan Schneider wrote:
Hi,

before reporting a bug, I want to make sure that this is no intentional
change. Are static methods no longer supported as callbacks?
preg_replace_callback('/some pattern/', array('MyClass', 'Method'),
$subject)
raises a warning atm:
Unable to call custom replacement function in ...
Jan.

--
http://www.horde.org - The Horde Project
http://www.ammma.de - Neue Wege des Lernens
http://www.tip4all.de - Deine private Tippgemeinschaft
--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP-DEV] obj == null check generates E_NOTICE

2004-03-15 Thread Hans Lellelid
obj == null checks now trigger E_NOTICE

class Foo {
}
$t = new Foo();

if ($t == null) {
}
Notice - Object of class Foo could not be converted to boolean

Changing the comparison to $t === null makes the notice go away.  Is 
this intended?  If not I can post it as a bug report.

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


Re: [PHP-DEV] No static method callbacks anmore?

2004-03-15 Thread Andi Gutmans
Can you do a reverse apply of the following diff and let me know if it 
fixes the problem?
http://cvs.php.net/diff.php/ZendEngine2/zend_execute_API.c?r1=1.274&r2=1.275&ty=u

Thanks,

Andi

At 05:04 PM 3/15/2004 +0100, Jan Schneider wrote:
Hi,

before reporting a bug, I want to make sure that this is no intentional
change. Are static methods no longer supported as callbacks?
preg_replace_callback('/some pattern/', array('MyClass', 'Method'),
$subject)
raises a warning atm:
Unable to call custom replacement function in ...
Jan.

--
http://www.horde.org - The Horde Project
http://www.ammma.de - Neue Wege des Lernens
http://www.tip4all.de - Deine private Tippgemeinschaft
--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php
--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP-DEV] Re: No static method callbacks anmore?

2004-03-15 Thread Hans Lellelid
I was just about to post the same bug ...

Except that I couldn't quite build a reproducing testcase.  I get 
exactly the same message in my code, but when I created a small static 
class to reproduce the problem it seems to work fine ... (static or 
non-static or mixture)

Hans

Jan Schneider wrote:
Hi,

before reporting a bug, I want to make sure that this is no intentional
change. Are static methods no longer supported as callbacks?
preg_replace_callback('/some pattern/', array('MyClass', 'Method'),
$subject)
raises a warning atm:
Unable to call custom replacement function in ...
Jan.

--
http://www.horde.org - The Horde Project
http://www.ammma.de - Neue Wege des Lernens
http://www.tip4all.de - Deine private Tippgemeinschaft
--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP-DEV] No static method callbacks anmore?

2004-03-15 Thread Jan Schneider
Hi,

before reporting a bug, I want to make sure that this is no intentional
change. Are static methods no longer supported as callbacks?

preg_replace_callback('/some pattern/', array('MyClass', 'Method'),
$subject)

raises a warning atm:
Unable to call custom replacement function in ...

Jan.

--
http://www.horde.org - The Horde Project
http://www.ammma.de - Neue Wege des Lernens
http://www.tip4all.de - Deine private Tippgemeinschaft

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



[PHP-DEV] Re: class constants in RC1

2004-03-15 Thread Andi Gutmans
At 10:07 AM 3/15/2004 -0500, Hans Lellelid wrote:
I notice that in the new RC1, the following reference to class constants 
is no longer possible:

class MyClass {
const MY_CONST = 1;
function __construct() {
echo MY_CONST;
}
}
You must now use self::MY_CONST to reference the class constant.  While I 
can see that the pre-RC1 behavior would not provide a way to access global 
constant if class had const of same name ... I figured I'd ask anyway 
whether this change is intended or a side-effect of some other fix.  I 
fall into the category of people who were really enjoying not having to 
specify self:: before (so now I have a lot of code to fix, apparently).
Hey,

I fixed it intentionally. That piece of code was left over from the days of 
our broken namespaces implementation where we would do two lookups. Methods 
were fixed a long time ago but we forgot to remove the old code from constants.

Andi

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


[PHP-DEV] class constants in RC1

2004-03-15 Thread Hans Lellelid
I notice that in the new RC1, the following reference to class constants 
is no longer possible:

class MyClass {
const MY_CONST = 1; 
function __construct() {
echo MY_CONST;
}
}
You must now use self::MY_CONST to reference the class constant.  While 
I can see that the pre-RC1 behavior would not provide a way to access 
global constant if class had const of same name ... I figured I'd ask 
anyway whether this change is intended or a side-effect of some other 
fix.  I fall into the category of people who were really enjoying not 
having to specify self:: before (so now I have a lot of code to fix, 
apparently).

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


Re: [PHP-DEV] RC1 of RC1

2004-03-15 Thread Jan Schneider
Zitat von Andi Gutmans <[EMAIL PROTECTED]>:

I fixed get_object_vars() a couple of days ago. Can you check if this still
occurs?
No, that seems to have fixed it, thanks!

At 01:52 PM 3/15/2004 +0100, Jan Schneider wrote:
Zitat von Andi Gutmans <[EMAIL PROTECTED]>:

I will roll RC1 on the 17th so if there are "serious" show stoppers 
speak up.
Dunno what you consider "serious", but bug 2
http://bugs.php.net/bug.php?id=2 is on the ze2 level.
Jan.

--
http://www.horde.org - The Horde Project
http://www.ammma.de - Neue Wege des Lernens
http://www.tip4all.de - Deine private Tippgemeinschaft
--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP-DEV] RC1 of RC1

2004-03-15 Thread Andi Gutmans
I fixed get_object_vars() a couple of days ago. Can you check if this still 
occurs?

Andi

At 01:52 PM 3/15/2004 +0100, Jan Schneider wrote:
Zitat von Andi Gutmans <[EMAIL PROTECTED]>:

I will roll RC1 on the 17th so if there are "serious" show stoppers speak up.
Dunno what you consider "serious", but bug 2
http://bugs.php.net/bug.php?id=2 is on the ze2 level.
Jan.

--
http://www.horde.org - The Horde Project
http://www.ammma.de - Neue Wege des Lernens
http://www.tip4all.de - Deine private Tippgemeinschaft
--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php
--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP-DEV] RC1 of RC1

2004-03-15 Thread Jan Schneider
Zitat von Andi Gutmans <[EMAIL PROTECTED]>:

I will roll RC1 on the 17th so if there are "serious" show stoppers speak up.
Dunno what you consider "serious", but bug 2
http://bugs.php.net/bug.php?id=2 is on the ze2 level.
Jan.

--
http://www.horde.org - The Horde Project
http://www.ammma.de - Neue Wege des Lernens
http://www.tip4all.de - Deine private Tippgemeinschaft
--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP-DEV] Re: Bugs DB down?

2004-03-15 Thread Antony Dovgal
On Thu, 11 Mar 2004 16:41:38 +0100 (CET)
Derick Rethans <[EMAIL PROTECTED]> wrote:

> On Thu, 11 Mar 2004, Jay Smith wrote:
> 
> > Andi Gutmans wrote:
> >
> > > Any idea why the bugs database isn't responding?
> >
> > I've had a similar problem over the past couple of weeks. For whatever
> > reason, I can't access bugs.php.net or master.php.net at all from work. I
> > can't even ping the server, and traceroute shows that I'm dying after
> > br1.cr0.rdu.redundant.com. (There was a bug report that mentioned the same
> > thing, although in an off-topic way in #27011.)
> >
> > The only thing I can figure is that redundant.com is blocking out ranges of
> > IPs or subnets or something. I can get to the site fine from remote
> > servers, including one across town at York University, just not from work
> > directly. Weird.
> 
> Yeah, we're moving services from the two redundant servers though to
> new machines.

Derick, when do you plan to finish this process ?
bugs.php.net is still not reachable for me (have to use some proxy, provided by friend 
of mine, which obviusly uses different route).

---
WBR,
Antony Dovgal aka tony2001
[EMAIL PROTECTED] || [EMAIL PROTECTED]

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



[PHP-DEV] Re: [PHP-QA] RC1 of RC1

2004-03-15 Thread Andi Gutmans
At 08:40 AM 3/15/2004 +0100, Jan Lehnardt wrote:
Hi,
On 15 Mar 2004, at 7:10, Andi Gutmans wrote:
The .tar.gz/.tar.bz2 are available at http://snaps.php.net/~andi
if I understood correctly, we'll be providing two packages, once
5.0.0 is released. One with libxml2 bundled and one without;
shouldn't we begin with that at RC stage?
Yeah, I think that would be a nice idea. However, it does require tweaking 
of makedist and the build, the latter I am not sure I would want to do so 
close to the RC. If someone has a nice way of doing it which we can easily 
check over the next couple of days then speak up :)

Andi

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