Req #63359 [Com]: Defining a interface const with value of another constant triggers fatal error

2013-10-01 Thread dagguh at gmail dot com
Edit report at https://bugs.php.net/bug.php?id=63359&edit=1

 ID: 63359
 Comment by: dagguh at gmail dot com
 Reported by:maciej dot sz at gmail dot com
 Summary:Defining a interface const with value of another
 constant triggers fatal error
 Status: Open
 Type:   Feature/Change Request
 Package:Scripting Engine problem
 Operating System:   Linux
 PHP Version:5.4.8
 Block user comment: N
 Private report: N

 New Comment:

This is a bug. No questions about it.

This bug is caused by: https://bugs.php.net/bug.php?id=49472
The fix is all wrong. PHP developers do not seem to understand basic concepts 
in OOP. Const is a static member. Being static means NO 
POLYMORPHISM. They should NEVER BE INHERITED. Each class/interface should be 
able to define their own static members DISREGARDING any 
possible class hierarchy.


Previous Comments:

[2013-05-22 08:36:01] jan dot kahoun at heureka dot cz

Same problem with PHP 5.4.13 on CentOS release 6.4 (Final)


[2013-01-14 11:07:21] edmond at inbox dot ru

Some problem: OS Windows 7 64-bits


[2012-11-19 11:59:16] ahar...@php.net

Automatic comment from SVN on behalf of aharvey
Revision: http://svn.php.net/viewvc/?view=revision&revision=328423
Log: Warn about configure options that were deprecated in 5.3 and removed in 
5.4.

Fixes doc bug #63359 (configure: WARNING: unrecognized options:
--enable-zend-multibyte).


[2012-11-14 16:37:32] maciej dot sz at gmail dot com

How come a feature request? This is an obvious bug.


[2012-11-14 15:21:33] larue...@php.net

change to feature request.




The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at

https://bugs.php.net/bug.php?id=63359


-- 
Edit this bug report at https://bugs.php.net/bug.php?id=63359&edit=1


[PHP-BUG] Req #62922 [NEW]: Truncating entire string should result in string

2012-08-24 Thread dagguh at gmail dot com
From: dagguh at gmail dot com
Operating system: 
PHP version:  5.3.16
Package:  Strings related
Bug Type: Feature/Change Request
Bug description:Truncating entire string should result in string

Description:

---
>From manual page:
http://www.php.net/function.substr#refsect1-function.substr-
description
---
Truncating an entire string should result in a string.

When $start is equal to strlen($string), an empty string should be returned

instead of FALSE.

Test script:
---
var_dump(substr("", 0));
var_dump(substr("a", 1));
var_dump(substr("ab", 2));



Expected result:

string(0) ""
string(0) ""
string(0) ""

Actual result:
--
bool(false)
bool(false)
bool(false)

-- 
Edit bug report at https://bugs.php.net/bug.php?id=62922&edit=1
-- 
Try a snapshot (PHP 5.4):
https://bugs.php.net/fix.php?id=62922&r=trysnapshot54
Try a snapshot (PHP 5.3):
https://bugs.php.net/fix.php?id=62922&r=trysnapshot53
Try a snapshot (trunk):  
https://bugs.php.net/fix.php?id=62922&r=trysnapshottrunk
Fixed in SVN:
https://bugs.php.net/fix.php?id=62922&r=fixed
Fixed in SVN and need be documented: 
https://bugs.php.net/fix.php?id=62922&r=needdocs
Fixed in release:
https://bugs.php.net/fix.php?id=62922&r=alreadyfixed
Need backtrace:  
https://bugs.php.net/fix.php?id=62922&r=needtrace
Need Reproduce Script:   
https://bugs.php.net/fix.php?id=62922&r=needscript
Try newer version:   
https://bugs.php.net/fix.php?id=62922&r=oldversion
Not developer issue: 
https://bugs.php.net/fix.php?id=62922&r=support
Expected behavior:   
https://bugs.php.net/fix.php?id=62922&r=notwrong
Not enough info: 
https://bugs.php.net/fix.php?id=62922&r=notenoughinfo
Submitted twice: 
https://bugs.php.net/fix.php?id=62922&r=submittedtwice
register_globals:
https://bugs.php.net/fix.php?id=62922&r=globals
PHP 4 support discontinued:  
https://bugs.php.net/fix.php?id=62922&r=php4
Daylight Savings:https://bugs.php.net/fix.php?id=62922&r=dst
IIS Stability:   
https://bugs.php.net/fix.php?id=62922&r=isapi
Install GNU Sed: 
https://bugs.php.net/fix.php?id=62922&r=gnused
Floating point limitations:  
https://bugs.php.net/fix.php?id=62922&r=float
No Zend Extensions:  
https://bugs.php.net/fix.php?id=62922&r=nozend
MySQL Configuration Error:   
https://bugs.php.net/fix.php?id=62922&r=mysqlcfg



Req #62922 [Com]: Truncating entire string should result in string

2012-08-24 Thread dagguh at gmail dot com
Edit report at https://bugs.php.net/bug.php?id=62922&edit=1

 ID: 62922
 Comment by: dagguh at gmail dot com
 Reported by:dagguh at gmail dot com
 Summary:Truncating entire string should result in string
 Status: Open
 Type:   Feature/Change Request
 Package:Strings related
 PHP Version:5.3.16
 Block user comment: N
 Private report: N

 New Comment:

Sheer logic.
What remains from a 4-character string after cutting 4 characters? An empty 
string.

In practice it would allow for a cleaner code, like:
-
public static function endsWith($string, $suffix) {
$suffixLength = strlen($suffix);
return $suffix === substr($string, -$suffixLength);
}

Method endsWith returns true for:
endsWith("kebab", "ebab");
endsWith("kebab", "bab");
endsWith("kebab", "ab");
endsWith("kebab", "b");

but it returns false for
endsWith("kebab", "kebab");


Previous Comments:

[2012-08-24 12:28:43] larue...@php.net

what can we gain from changing this? except the bc break?

------------
[2012-08-24 10:16:57] dagguh at gmail dot com

Description:

---
>From manual page: http://www.php.net/function.substr#refsect1-function.substr-
description
---
Truncating an entire string should result in a string.

When $start is equal to strlen($string), an empty string should be returned 
instead of FALSE.

Test script:
---
var_dump(substr("", 0));
var_dump(substr("a", 1));
var_dump(substr("ab", 2));



Expected result:

string(0) ""
string(0) ""
string(0) ""

Actual result:
--
bool(false)
bool(false)
bool(false)






-- 
Edit this bug report at https://bugs.php.net/bug.php?id=62922&edit=1


Req #62922 [Com]: Truncating entire string should result in string

2012-08-24 Thread dagguh at gmail dot com
Edit report at https://bugs.php.net/bug.php?id=62922&edit=1

 ID: 62922
 Comment by: dagguh at gmail dot com
 Reported by:dagguh at gmail dot com
 Summary:Truncating entire string should result in string
 Status: Open
 Type:   Feature/Change Request
 Package:Strings related
 PHP Version:5.3.16
 Block user comment: N
 Private report: N

 New Comment:

From http://tr.php.net/manual/en/function.substr.php: 
If string is less than or equal to start characters long, FALSE will be 
returned.
would become:
If string is less than start characters long, FALSE will be returned.


Previous Comments:

[2012-08-24 14:24:31] riptide dot tempora at opinehub dot com



No need to rewrite the language :)


[2012-08-24 14:21:21] dagguh at gmail dot com

Sheer logic.
What remains from a 4-character string after cutting 4 characters? An empty 
string.

In practice it would allow for a cleaner code, like:
-
public static function endsWith($string, $suffix) {
$suffixLength = strlen($suffix);
return $suffix === substr($string, -$suffixLength);
}

Method endsWith returns true for:
endsWith("kebab", "ebab");
endsWith("kebab", "bab");
endsWith("kebab", "ab");
endsWith("kebab", "b");

but it returns false for
endsWith("kebab", "kebab");


[2012-08-24 12:28:43] larue...@php.net

what can we gain from changing this? except the bc break?

------------
[2012-08-24 10:16:57] dagguh at gmail dot com

Description:

---
>From manual page: http://www.php.net/function.substr#refsect1-function.substr-
description
---
Truncating an entire string should result in a string.

When $start is equal to strlen($string), an empty string should be returned 
instead of FALSE.

Test script:
---
var_dump(substr("", 0));
var_dump(substr("a", 1));
var_dump(substr("ab", 2));



Expected result:

string(0) ""
string(0) ""
string(0) ""

Actual result:
--
bool(false)
bool(false)
bool(false)






-- 
Edit this bug report at https://bugs.php.net/bug.php?id=62922&edit=1


[PHP-BUG] Bug #55864 [NEW]: Explicit call to default constructor

2011-10-07 Thread dagguh at gmail dot com
From: 
Operating system: Irrelevant
PHP version:  5.3SVN-2011-10-07 (SVN)
Package:  Class/Object related
Bug Type: Bug
Bug description:Explicit call to default constructor

Description:

You cannot call default constructor from derived class.

Test script:
---
https://bugs.php.net/bug.php?id=55864&edit=1
-- 
Try a snapshot (PHP 5.4):
https://bugs.php.net/fix.php?id=55864&r=trysnapshot54
Try a snapshot (PHP 5.3):
https://bugs.php.net/fix.php?id=55864&r=trysnapshot53
Try a snapshot (trunk):  
https://bugs.php.net/fix.php?id=55864&r=trysnapshottrunk
Fixed in SVN:
https://bugs.php.net/fix.php?id=55864&r=fixed
Fixed in SVN and need be documented: 
https://bugs.php.net/fix.php?id=55864&r=needdocs
Fixed in release:
https://bugs.php.net/fix.php?id=55864&r=alreadyfixed
Need backtrace:  
https://bugs.php.net/fix.php?id=55864&r=needtrace
Need Reproduce Script:   
https://bugs.php.net/fix.php?id=55864&r=needscript
Try newer version:   
https://bugs.php.net/fix.php?id=55864&r=oldversion
Not developer issue: 
https://bugs.php.net/fix.php?id=55864&r=support
Expected behavior:   
https://bugs.php.net/fix.php?id=55864&r=notwrong
Not enough info: 
https://bugs.php.net/fix.php?id=55864&r=notenoughinfo
Submitted twice: 
https://bugs.php.net/fix.php?id=55864&r=submittedtwice
register_globals:
https://bugs.php.net/fix.php?id=55864&r=globals
PHP 4 support discontinued:  
https://bugs.php.net/fix.php?id=55864&r=php4
Daylight Savings:https://bugs.php.net/fix.php?id=55864&r=dst
IIS Stability:   
https://bugs.php.net/fix.php?id=55864&r=isapi
Install GNU Sed: 
https://bugs.php.net/fix.php?id=55864&r=gnused
Floating point limitations:  
https://bugs.php.net/fix.php?id=55864&r=float
No Zend Extensions:  
https://bugs.php.net/fix.php?id=55864&r=nozend
MySQL Configuration Error:   
https://bugs.php.net/fix.php?id=55864&r=mysqlcfg



Bug #55864 [Com]: Explicit call to default constructor

2011-10-07 Thread dagguh at gmail dot com
Edit report at https://bugs.php.net/bug.php?id=55864&edit=1

 ID: 55864
 Comment by: dagguh at gmail dot com
 Reported by:dagguh at gmail dot com
 Summary:Explicit call to default constructor
 Status: Open
 Type:   Bug
 Package:Class/Object related
 Operating System:   Irrelevant
 PHP Version:5.3SVN-2011-10-07 (SVN)
 Block user comment: N
 Private report: N

 New Comment:

PS. Actually my PHP version is 5.3.5


Previous Comments:

[2011-10-07 09:20:34] dagguh at gmail dot com

Description:

You cannot call default constructor from derived class.

Test script:
---
https://bugs.php.net/bug.php?id=55864&edit=1


Bug #55864 [Opn]: Explicit call to default constructor

2011-10-07 Thread dagguh at gmail dot com
Edit report at https://bugs.php.net/bug.php?id=55864&edit=1

 ID: 55864
 User updated by:dagguh at gmail dot com
 Reported by:dagguh at gmail dot com
 Summary:Explicit call to default constructor
 Status: Open
 Type:   Bug
 Package:Class/Object related
-Operating System:   Irrelevant
+Operating System:   Ubuntu 10.04.3 LTS
-PHP Version:5.3SVN-2011-10-07 (SVN)
+PHP Version:5.3.5
 Block user comment: N
 Private report: N

 New Comment:

Fixed version and OS


Previous Comments:

[2011-10-07 09:24:50] dagguh at gmail dot com

PS. Actually my PHP version is 5.3.5


[2011-10-07 09:20:34] dagguh at gmail dot com

Description:

You cannot call default constructor from derived class.

Test script:
---
https://bugs.php.net/bug.php?id=55864&edit=1


Req #55864 [Opn]: Explicit call to default constructor

2011-10-07 Thread dagguh at gmail dot com
Edit report at https://bugs.php.net/bug.php?id=55864&edit=1

 ID: 55864
 User updated by:dagguh at gmail dot com
 Reported by:dagguh at gmail dot com
 Summary:Explicit call to default constructor
 Status: Open
 Type:   Feature/Change Request
 Package:Class/Object related
 Operating System:   Ubuntu 10.04.3 LTS
 PHP Version:5.3.5
 Block user comment: N
 Private report: N

 New Comment:

Well you can call:

$base = new Base();

which works, because php uses default, empty constructor.
If new operator can call it, why derived classes can't?


Previous Comments:

[2011-10-07 09:41:18] larue...@php.net

Actually, there is no `default constructor` in PHP, you should decalare one be 
fore you call to it. 
I think this should be mark as a feature request.


[2011-10-07 09:25:40] dagguh at gmail dot com

Fixed version and OS


[2011-10-07 09:24:50] dagguh at gmail dot com

PS. Actually my PHP version is 5.3.5


[2011-10-07 09:20:34] dagguh at gmail dot com

Description:

You cannot call default constructor from derived class.

Test script:
---
https://bugs.php.net/bug.php?id=55864&edit=1


Req #55864 [Com]: Explicit call to default constructor

2011-10-07 Thread dagguh at gmail dot com
Edit report at https://bugs.php.net/bug.php?id=55864&edit=1

 ID: 55864
 Comment by: dagguh at gmail dot com
 Reported by:dagguh at gmail dot com
 Summary:Explicit call to default constructor
 Status: Open
 Type:   Feature/Change Request
 Package:Class/Object related
 Operating System:   Ubuntu 10.04.3 LTS
 PHP Version:5.3.5
 Block user comment: N
 Private report: N

 New Comment:

I stand by my request because of cohesion.
I often see useless code in derived classes, e.g.:

function __construct($name) {
parent::__construct($name);
}

which does absolutely nothing and I delete this code, because php will do it 
automatically.
For the same reason I'd like to remove

function __construct() {
;
}

which also does absolutely nothing and php will do the same automatically 
EXCEPT 
in the case I described.

So, I stand by my request :)


Previous Comments:

[2011-10-07 10:03:48] larue...@php.net

yes, you can instantiate a calss without a constructor be declared, but that 
doesn't mean there is default empty constructor. 

in PHP, constructor most like a magic method which will be called after a 
object instantiated immediatlely. 
 
so if there is no constructor for a class, the new operator still can 
instantiate a class. but you can't call a no-exists constructor directly :)


[2011-10-07 09:55:01] dagguh at gmail dot com

Well you can call:

$base = new Base();

which works, because php uses default, empty constructor.
If new operator can call it, why derived classes can't?


[2011-10-07 09:41:18] larue...@php.net

Actually, there is no `default constructor` in PHP, you should decalare one be 
fore you call to it. 
I think this should be mark as a feature request.

----
[2011-10-07 09:25:40] dagguh at gmail dot com

Fixed version and OS

----
[2011-10-07 09:24:50] dagguh at gmail dot com

PS. Actually my PHP version is 5.3.5




The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at

https://bugs.php.net/bug.php?id=55864


-- 
Edit this bug report at https://bugs.php.net/bug.php?id=55864&edit=1


Req #53831 [Com]: DateInterval constructor does not handle valid ISO 8601 strings

2011-10-12 Thread dagguh at gmail dot com
Edit report at https://bugs.php.net/bug.php?id=53831&edit=1

 ID: 53831
 Comment by: dagguh at gmail dot com
 Reported by:pallinger at dsd dot sztaki dot hu
 Summary:DateInterval constructor does not handle valid ISO
 8601 strings
 Status: Open
 Type:   Feature/Change Request
 Package:Date/time related
 Operating System:   ubuntu linux 10.10
 PHP Version:5.3.5
 Block user comment: N
 Private report: N

 New Comment:

http://en.wikipedia.org/wiki/Iso8601#Durations

This decimal fraction may be specified with either a comma or a full stop, as 
in 
"P0,5Y" or "P0.5Y".

Remember to accept both comma and a full stop.


Previous Comments:

[2011-01-24 18:41:19] pallinger at dsd dot sztaki dot hu

Description:

---
>From manual page: http://www.php.net/dateinterval.construct
---
The documentation says that "Each duration period is represented by an integer 
value followed by a period designator.", however, the ISO 8601 allows 
non-integer values for the last number 
(http://en.wikipedia.org/wiki/ISO_8601#Durations).
This is quite important if I want to parse XML data which contains 
millisecond-precision durations, as the seconds will surely not be integers.

Test script:
---


Expected result:

Should print out a valid DateInterval object, eg.:
object(DateInterval)#1 (8) {
  ["y"]=>
  int(0)
  ["m"]=>
  int(0)
  ["d"]=>
  int(0)
  ["h"]=>
  int(0)
  ["i"]=>
  int(0)
  ["s"]=>
  float(1.1)
  ["invert"]=>
  int(0)
  ["days"]=>
  bool(false)
}
It could also include a millisecond/microsecond/nanosecond field to accomodate 
additional precision. However, if the durations that are stored are still 
integers, it would be difficult to handle durations like "P0.5Y".

Actual result:
--
PHP Fatal error:  Uncaught exception 'Exception' with message 
'DateInterval::__construct(): Unknown or bad format (PT1.1S)' in -:1
Stack trace:
#0 -(1): DateInterval->__construct('PT1.1S')
#1 {main}
  thrown in - on line 1







-- 
Edit this bug report at https://bugs.php.net/bug.php?id=53831&edit=1


Req #50019 [Com]: DatePeriod doesn't accept negative intervals

2011-10-12 Thread dagguh at gmail dot com
Edit report at https://bugs.php.net/bug.php?id=50019&edit=1

 ID: 50019
 Comment by: dagguh at gmail dot com
 Reported by:jennifer dot kimball at nrc dot ca
 Summary:DatePeriod doesn't accept negative intervals
 Status: Open
 Type:   Feature/Change Request
 Package:Date/time related
 Operating System:   Solaris 10
 PHP Version:5.3.0
 Block user comment: N
 Private report: N

 New Comment:

You are mistaken.

This is the faulty line:
$i=DateInterval::createFromDateString('-1 year');

DateInterval::createFromDateString doesn't report any error when it fails. Fix 
your DateInterval first :)


Previous Comments:

[2009-10-27 15:13:56] jennifer dot kimball at nrc dot ca

Description:

DatePeriod should be able to create a list of dates that goes into the future 
from the start date, or into the past from the start date. There is nothing in 
the documentation to suggest this should not be possible, and trying it does 
not throw an error.

Given that a question like 'What are the dates of the previous 3 Saturdays' is 
fairly common, it seems sensible that DatePeriod be able to calculate that way.

Reproduce code:
---
---
>From manual page: dateperiod.construct#Description
---
//postive interval works:
$d1=date_create('2004-12-25');
$i=DateInterval::createFromDateString('1 year');
$d2=date_create('2009-03-03');
$p=new DatePeriod($d1,$i,$d2);
foreach($p as $d) echo $d->format('Y-m-d');


//negative interval fails with no error
$d1=date_create('2009-12-25');
$i=DateInterval::createFromDateString('-1 year');
$d2=date_create('2004-03-03');
$p=new DatePeriod($d1,$i,$d2);
foreach($p as $d) echo $d->format('Y-m-d');

Expected result:

//postive interval output (which does happen)
2004-12-25
2005-12-25
2006-12-25
2007-12-25
2008-12-25

//negative interval output (which does not happen)
2009-12-25
2008-12-25
2007-12-25
2006-12-25
2005-12-25
2004-12-25

Actual result:
--
//no output
//no error






-- 
Edit this bug report at https://bugs.php.net/bug.php?id=50019&edit=1


Req #60098 [Com]: Static constructors, or static intializers

2011-10-24 Thread dagguh at gmail dot com
Edit report at https://bugs.php.net/bug.php?id=60098&edit=1

 ID: 60098
 Comment by: dagguh at gmail dot com
 Reported by:syntaqx at gmail dot com
 Summary:Static constructors, or static intializers
 Status: Open
 Type:   Feature/Change Request
 Package:SPL related
 Operating System:   All
 PHP Version:5.4.0beta1
 Block user comment: N
 Private report: N

 New Comment:

You mean something like Static Initialization Blocks from Java? Yeah, I'd like 
to 
see them too.

http://download.oracle.com/javase/tutorial/java/javaOO/initial.html


Previous Comments:

[2011-10-19 17:48:18] syntaqx at gmail dot com

Description:

I've noticed a fairly large trend in a lot of php frameworks, as well as in my 
own code, and I was curious about whether this is planned, the reasons as to 
why 
it might not be, or if it has even been brought up.

I've tried to find any other requests about this, but haven't been very 
successful.

Basically, my request is this:
When a class comes into existence (whether the code is in the file you're 
currently in, or you're including it), a static constructor (a common method 
for 
it is "::init") is called. This is called only once, the first time the class 
exists, and would act as a protected method (allowing parent-child objects to 
call it incase of a class reset?).

This would be pretty awesome, but I don't know if it's practical, or what all 
your thoughts might have been as I'm sure plenty of you have seen it floating 
around.

Thanks a bunch for taking the time to read my request, I'm excited to hear what 
you think :)







-- 
Edit this bug report at https://bugs.php.net/bug.php?id=60098&edit=1


Req #60107 [Com]: Allow subtype polymorphism in interfaces

2011-10-25 Thread dagguh at gmail dot com
Edit report at https://bugs.php.net/bug.php?id=60107&edit=1

 ID: 60107
 Comment by: dagguh at gmail dot com
 Reported by:mkallman at gmail dot com
 Summary:Allow subtype polymorphism in interfaces
 Status: Open
 Type:   Feature/Change Request
 Package:Unknown/Other Function
 Operating System:   All
 PHP Version:5.3.8
 Block user comment: N
 Private report: N

 New Comment:

I disagree, your request violates the LSP. 
http://en.wikipedia.org/wiki/Liskov_substitution_principle

Derived classes cannot expect more than parent class expects.
By more I mean a condition that is harder to meet.


Previous Comments:

[2011-10-21 11:59:16] mkallman at gmail dot com

Description:

Please allow for subtype polymorphism/downcasting in interfaces. 

Test script:
---
interface Deliverable {}

interface DeliverableWithTruck extends Deliverable {}

interface DeliveryService {
function deliver( Deliverable $deliverable, $destination );
}


class CookieJar implements DeliverableWithTruck {}

class ExpressDeliveryService implements DeliveryService {

function deliver( DeliverableWithTruck $deliverable, $destination ) {
echo "Delivery underway";
}

}


$fedEx = new ExpressDeliveryService;
$chocolateChipCookies = new CookieJar;

$fedEx->deliver( $chocolateChipCookies, "Sesame Street" );


Expected result:

Delivery underway

Actual result:
--
Fatal error: Declaration of ExpressDeliveryService::deliver() must be 
compatible 
with that of DeliveryService::deliver()






-- 
Edit this bug report at https://bugs.php.net/bug.php?id=60107&edit=1


Req #44033 [Com]: make working abstract methods body in abstract classes

2012-10-26 Thread dagguh at gmail dot com
Edit report at https://bugs.php.net/bug.php?id=44033&edit=1

 ID: 44033
 Comment by: dagguh at gmail dot com
 Reported by:giorgio dot liscio at email dot it
 Summary:make working abstract methods body in abstract
 classes
 Status: Open
 Type:   Feature/Change Request
 Package:Class/Object related
 Operating System:   *
 PHP Version:5.2.5
 Block user comment: N
 Private report: N

 New Comment:

You obviously don't know what abstract methods are about.

Learn OOP, please. This is what you want:

customCheck();
  }

 protected abstract function customCheck();
}

class Real extends Base
{

  protected function customCheck()
  {
echo("IT IS WORKING!");
  }
}

?>


Previous Comments:

[2008-02-03 20:33:53] giorgio dot liscio at email dot it

the requested behavior can works with multiple abstract inheritance

abstract class One
{abstract function m(){echo("one ");}}
abstract class Two extends One
{abstract function m(){parent::m();echo("two ");}}
abstract class Three extends Two
{abstract function m(){parent::m();echo("three ");}}

class RealClass extends Three
{
 function m(){parent::m();echo("real implementation");}
}


[2008-02-03 18:57:02] giorgio dot liscio at email dot it

Description:

hello
i think can be useful make working abstract methods body in abstract classes
please read carefully ;) i hope you like it
thank you for your time

Reproduce code:
---


Expected result:

echo("WOW ");
echo("IT IS WORKING!");

Actual result:
--
Fatal error: Abstract function Base::commonCheck() cannot contain body






-- 
Edit this bug report at https://bugs.php.net/bug.php?id=44033&edit=1


Req #44033 [Com]: make working abstract methods body in abstract classes

2012-10-26 Thread dagguh at gmail dot com
Edit report at https://bugs.php.net/bug.php?id=44033&edit=1

 ID: 44033
 Comment by: dagguh at gmail dot com
 Reported by:giorgio dot liscio at email dot it
 Summary:make working abstract methods body in abstract
 classes
 Status: Open
 Type:   Feature/Change Request
 Package:Class/Object related
 Operating System:   *
 PHP Version:5.2.5
 Block user comment: N
 Private report: N

 New Comment:

To promote OOD, this issue should be closed as "won't fix"


Previous Comments:

[2012-10-26 15:59:36] dagguh at gmail dot com

You obviously don't know what abstract methods are about.

Learn OOP, please. This is what you want:

customCheck();
  }

 protected abstract function customCheck();
}

class Real extends Base
{

  protected function customCheck()
  {
echo("IT IS WORKING!");
  }
}

?>


[2008-02-03 20:33:53] giorgio dot liscio at email dot it

the requested behavior can works with multiple abstract inheritance

abstract class One
{abstract function m(){echo("one ");}}
abstract class Two extends One
{abstract function m(){parent::m();echo("two ");}}
abstract class Three extends Two
{abstract function m(){parent::m();echo("three ");}}

class RealClass extends Three
{
 function m(){parent::m();echo("real implementation");}
}


[2008-02-03 18:57:02] giorgio dot liscio at email dot it

Description:

hello
i think can be useful make working abstract methods body in abstract classes
please read carefully ;) i hope you like it
thank you for your time

Reproduce code:
---


Expected result:

echo("WOW ");
echo("IT IS WORKING!");

Actual result:
--
Fatal error: Abstract function Base::commonCheck() cannot contain body






-- 
Edit this bug report at https://bugs.php.net/bug.php?id=44033&edit=1


Req #62320 [Com]: Abstract static property?

2012-10-26 Thread dagguh at gmail dot com
Edit report at https://bugs.php.net/bug.php?id=62320&edit=1

 ID: 62320
 Comment by: dagguh at gmail dot com
 Reported by:techlivezheng at gmail dot com
 Summary:Abstract static property?
 Status: Open
 Type:   Feature/Change Request
 Package:Scripting Engine problem
 Operating System:   Linux
 PHP Version:5.4.3
 Block user comment: N
 Private report: N

 New Comment:

Late Static Binding is a failed concept and should be avoided in all cases.
There is no such thing as static inheritance. Static members of a class belong 
to 
this class and this class only.

Just use the regular instance methods and regular inheritance.
Your code will be more testable, extensible and modular.

Please close this issue as "won't fix".


Previous Comments:

[2012-06-14 07:04:45] techlivezheng at gmail dot com

Description:

As we have "late static bindings" now, would it be reasonable to have a 
"abstract static property"?

See the bellow example.

abstract class A {
//If this could be declared as abstract to make 
//the subclass have to redeclare it in order to
//have it own $mTest to use.
//If $mTest is not declared in one subclass, it would
//change the $mTest of A which is shared by many 
//subclasses, some unexpected things would happen.
//The design is to make each subclass have its own
//$mTest to use and it has to be existed.
//$mTest in A is just for a skeleton purpose, even should
//not be assigned a value.
static $mTest;

static function setTest($value) {
static::$mTest = $value;
}

static function DumpTest () {
echo 'static:' . static::$mTest . "\n";
echo 'A-self:' . self::$mTest . "\n";
}
}

class B extends A {
static function DumpTest () {
parent::DumpTest();
echo 'B-self:' . self::$mTest . "\n";
echo 'B-parent:' . parent::$mTest . "\n";
}
}

class C extends A {
static $mTest;
static function DumpTest () {
parent::DumpTest();
echo 'C-self:' . self::$mTest . "\n";
echo 'C-parent:' . parent::$mTest . "\n";
}
}

class D extends C {
static $mTest;
static function DumpTest () {
parent::DumpTest();
echo 'D-self:' . self::$mTest . "\n";
echo 'D-parent:' . parent::$mTest . "\n";
}
}

B::setTest('test1');//This will change the $mStorages of class A
B::DumpTest();
//static:test1
//A-self:test1
//B-self:test1
//B-parent:test1
C::setTest('test2');
C::DumpTest();
//static:test2
//A-self:test1
//C-self:test2
//C-parent:test1
D::setTest('test3');
D::DumpTest();
static:test3
//A-self:test1
//C-self:test2
//C-parent:test1
//D-self:test3
//D-parent:test2







-- 
Edit this bug report at https://bugs.php.net/bug.php?id=62320&edit=1


Req #47971 [Com]: Allow 'static' keyword to be applied to entire classes

2012-10-26 Thread dagguh at gmail dot com
Edit report at https://bugs.php.net/bug.php?id=47971&edit=1

 ID: 47971
 Comment by: dagguh at gmail dot com
 Reported by:cscott at ggot dot org
 Summary:Allow 'static' keyword to be applied to entire
 classes
 Status: Open
 Type:   Feature/Change Request
 Package:Class/Object related
 Operating System:   *
 PHP Version:*
 Block user comment: N
 Private report: N

 New Comment:

What you are referring to is a utility class.
It only has static members and a private constructor, which should never be 
called (even from the class itself).

Your suggestion could be useful, because implementing private empty 
constructors 
is just boilerplate code.
PS. Some people even throw an exception inside the private constructor.


Previous Comments:

[2009-10-31 00:27:53] cscott at ggot dot org

For Relevancy: I do not believe that namespaces solve this problem, as 
__autoload does not work with namespaces (and, for obvious reasons, 
shouldn't).


[2009-04-14 21:07:14] cscott at ggot dot org

Description:

Fairly simple: A developer is allowed to define his/her classes as abstract or 
final, but not as static.  For continuity's sake, it would be preferable to be 
able to declare classes as static as well.  This would greatly ease the 
creation of static function collections/libraries, especially those included 
with __autoload().

When a class is declared as abstract, it is a statement at the open that this 
is an incomplete member; you can specify any method inside a class to be 
abstract and the class is effectively abstract, yet this keyword is allowed in 
the class declaration.

When a class is declared final, it is a statement at the open that all members 
are to be considered final, and that this class should not be extended any 
further.

By allowing classes to be declared as static, it would follow with allowing 
"abstract class foo" in the sense that the keyword reflects the contents of the 
class, and would follow with "final class foo" in that it would define a 
binding construct for all members of the class.

Whether
a) In a static class, all methods and members are automatically static
-OR-
b) In a static class, all methods and members must be declared static
Is surely not for me to decide -- either is useful, as it either forces me to 
ensure all members are static, or it does the legwork for me.  As such, I make 
no suggestion and defer to the wisdom of the developer(s).

Thank you for your consideration.







-- 
Edit this bug report at https://bugs.php.net/bug.php?id=47971&edit=1


Req #38569 [Com]: override keyword requested

2012-10-26 Thread dagguh at gmail dot com
Edit report at https://bugs.php.net/bug.php?id=38569&edit=1

 ID: 38569
 Comment by: dagguh at gmail dot com
 Reported by:psykora at gmail dot com
 Summary:override keyword requested
 Status: Open
 Type:   Feature/Change Request
 Package:Feature/Change Request
 Operating System:   Irrelevant
 PHP Version:5.1.5
 Block user comment: N
 Private report: N

 New Comment:

This is a valid feature request.

If this change is implemented, the override keyword SHOULD be mandatory for 
overridden methods, but this way backwards compatibility would be broken.


Previous Comments:

[2007-12-12 19:52:41] michael at dmgx dot com

Agreed.  Currently I use a comment to place the word there just to help myself 
out visually. I.E.

public /*override*/ function foo () {}

Override shouldn't be required per se - but if used it should throw an error 
when the parent method doesn't exist.

BTW, this has been added to Actionscript 3 which is where I first saw it. Adobe 
mentions having the keyword helps out their compiler - so maybe the Zend Engine 
could make use of the keyword as well.


[2006-08-23 15:24:19] psykora at gmail dot com

Description:

The override keyword (f.e. like C#.NET has) could be usefull for specifing to 
compiler, that current method is overriding parent's class method.

Compiler then should throw Fatal Error when there is no parent's method for 
override.

This could resolve common mistakes when developer changes (or removes) abstract 
method from parent's class.







-- 
Edit this bug report at https://bugs.php.net/bug.php?id=38569&edit=1


Bug #53155 [Com]: conditional class creation does not reset static variable in method

2012-10-26 Thread dagguh at gmail dot com
Edit report at https://bugs.php.net/bug.php?id=53155&edit=1

 ID: 53155
 Comment by: dagguh at gmail dot com
 Reported by:frederic dot hardy at mageekbox dot net
 Summary:conditional class creation does not reset static
 variable in method
 Status: Open
 Type:   Bug
 Package:Scripting Engine problem
 Operating System:   FreeBSD
 PHP Version:5.3.3
 Block user comment: N
 Private report: N

 New Comment:

Another proof that LSB produces bad code.
Just look at it.

There is no such thing as static inheritance, so maybe you should simply learn 
to 
code.


Previous Comments:

[2012-05-11 21:05:49] ash at itsash dot co dot uk

I have the same issue on 5.3.6 on Ubuntu.

static::$classVariable with late static binding causes php to override the 
parent 
static variable.

When using static $methodVariable = 'first_value';  if this is later changed, 
by 
$methodVariable, when a new instance of that class is initiated, the 
$methodVariable SHOULD be 'first_value', however UNEXPECTEDLY it carries over 
from any prior instance.


[2010-10-27 02:54:21] fel...@php.net

Probably related to bug #48623


[2010-10-25 21:41:26] frederic dot hardy at mageekbox dot net

Description:

when a class which extends a parent class with a method which define a static 
variable is created then a condition is verified, the static variable is not 
reset in the chield class.

Test script:
---
 0)
{
class b extends a {}
}

var_dump(b::getInstance());

?>

Expected result:

object(a)#1 (0) {
}
object(b)#2 (0) {
}

Actual result:
--
object(a)#1 (0) {
}
object(a)#1 (0) {
}  






-- 
Edit this bug report at https://bugs.php.net/bug.php?id=53155&edit=1


Bug #48623 [Com]: Incorrect scope for static variables in object methods

2012-10-26 Thread dagguh at gmail dot com
Edit report at https://bugs.php.net/bug.php?id=48623&edit=1

 ID: 48623
 Comment by: dagguh at gmail dot com
 Reported by:falkon1313 at gmail dot com
 Summary:Incorrect scope for static variables in object
 methods
 Status: Open
 Type:   Bug
 Package:Scripting Engine problem
 Operating System:   *
 PHP Version:5.2.10
 Block user comment: N
 Private report: N

 New Comment:

Why the hell are you using the static keyword?
Use a class field, like normal people do:

stored = $val;
}
return $this->stored;
  }
}

$a = new TestClass();
echo $a->test() ."\n";
echo $a->test('alpha') ."\n";
$b = new TestClass();
echo $b->test() ."\n";
echo $b->test('bravo') ."\n";
echo $a->test() ."\n";

TADA! Suddenly you get your expected result


Previous Comments:

[2009-06-21 00:53:14] falkon1313 at gmail dot com

Description:

When a variable is declared static within an object method, it's scope is 
spread across all instantiated objects of the class.

This is not a static class variable, nor is it in a static class method, it is 
in a method that requires an instantiated object, operates within the context 
of that object, and should have the object scope.

Reproduce code:
---
test() ."\n";
echo $a->test('alpha') ."\n";
$b = new TestClass();
echo $b->test() ."\n";
echo $b->test('bravo') ."\n";
echo $a->test() ."\n";


Expected result:

empty
alpha
empty
bravo
alpha


Actual result:
--
empty
alpha
alpha
bravo
bravo






-- 
Edit this bug report at https://bugs.php.net/bug.php?id=48623&edit=1


Bug #48623 [Com]: Incorrect scope for static variables in object methods

2012-10-26 Thread dagguh at gmail dot com
Edit report at https://bugs.php.net/bug.php?id=48623&edit=1

 ID: 48623
 Comment by: dagguh at gmail dot com
 Reported by:falkon1313 at gmail dot com
 Summary:Incorrect scope for static variables in object
 methods
 Status: Open
 Type:   Bug
 Package:Scripting Engine problem
 Operating System:   *
 PHP Version:5.2.10
 Block user comment: N
 Private report: N

 New Comment:

BTW. dont use ifs on non-boolean variables... YUCK!
You should write:
if (isset($val))


Previous Comments:

[2012-10-26 16:21:14] dagguh at gmail dot com

Why the hell are you using the static keyword?
Use a class field, like normal people do:

stored = $val;
}
return $this->stored;
  }
}

$a = new TestClass();
echo $a->test() ."\n";
echo $a->test('alpha') ."\n";
$b = new TestClass();
echo $b->test() ."\n";
echo $b->test('bravo') ."\n";
echo $a->test() ."\n";

TADA! Suddenly you get your expected result


[2009-06-21 00:53:14] falkon1313 at gmail dot com

Description:

When a variable is declared static within an object method, it's scope is 
spread across all instantiated objects of the class.

This is not a static class variable, nor is it in a static class method, it is 
in a method that requires an instantiated object, operates within the context 
of that object, and should have the object scope.

Reproduce code:
---
test() ."\n";
echo $a->test('alpha') ."\n";
$b = new TestClass();
echo $b->test() ."\n";
echo $b->test('bravo') ."\n";
echo $a->test() ."\n";


Expected result:

empty
alpha
empty
bravo
alpha


Actual result:
--
empty
alpha
alpha
bravo
bravo






-- 
Edit this bug report at https://bugs.php.net/bug.php?id=48623&edit=1


Req #54003 [Com]: re-enable abstract static methods

2012-10-26 Thread dagguh at gmail dot com
Edit report at https://bugs.php.net/bug.php?id=54003&edit=1

 ID: 54003
 Comment by: dagguh at gmail dot com
 Reported by:giorgio dot liscio at email dot it
 Summary:re-enable abstract static methods
 Status: Open
 Type:   Feature/Change Request
 Package:Class/Object related
 PHP Version:5.3.5
 Block user comment: N
 Private report: N

 New Comment:

1. Don't use LSB next time.
2. Use normal inheritance instead.
3. WONTFIX


Previous Comments:

[2012-03-06 04:19:14] cgili at yahoo dot com

Inheritance and method override is something really important on PHP, it's 
important to redefine not only the methods but also the parameters they take, 
for instance, you have a class Rectangle with a method called Area that 
calculates the area in m2 by requiring the height and width, now you want to 
create a Cube class extending the Rectangle class, and override the function 
Area to calculate the area in cubic meters, the formula is different and the 
parameters are 3, height, width and deep. It's the very "BASIC" definition of 
Class inheritance and Method Overriding.


[2011-02-13 00:14:32] giorgio dot liscio at email dot it

Description:

hi, please read carefully my request before trash this

since static inheritance is now implemented in php, enabling this again can 
provide an awesome natural feature of the language

I talked with some php hackers, and they agree with me, but in past, I did not 
have good news about this:

I'm sure my example makes totally sense, and this should stay disabled only if 
there are technical limitations that do not matter with the good logic of my 
example

in practice, I can understand WONT FIX, but not BOGUS

abstract class AFileSystemItem
{
 public static functiongetIfValid   ($fullPath)
 {
  // i use static::isValid to get the method defined in the called class
  if(static::isValid($fullPath)) return new static($fullPath);
 }
 protected function__construct  ($fp){}

 // i want to force real classes to implement a way to check a path before 
instance an object
 protected abstract static functionisValid  ($fullPath); // 
abstract declaration
}

class Dir extends AFileSystemItem
{
 protected static function isValid  ($fullPath)  // 
implementation
 {
 return is_dir($fullPath);
 }
}

class File extends AFileSystemItem
{
 protected static function isValid  ($fullPath)  // 
implementation
 {
 return is_file($fullPath);
 }
}

class Image extends File
{
 protected static function isValid  ($fullPath)  // 
implementation with override
 {
 if(parent::isValid($fullPath) AND (bool)getimagesize($fullPath)) 
return true; return false;
 }
}







-- 
Edit this bug report at https://bugs.php.net/bug.php?id=54003&edit=1


Bug #55375 [Com]: Inherited constructor signature: new behavior of PHP5.4 or bug?

2012-10-26 Thread dagguh at gmail dot com
Edit report at https://bugs.php.net/bug.php?id=55375&edit=1

 ID: 55375
 Comment by: dagguh at gmail dot com
 Reported by:mikaelk...@php.net
 Summary:Inherited constructor signature: new behavior of
 PHP5.4 or bug?
 Status: Open
 Type:   Bug
 Package:Class/Object related
 Operating System:   Debian Squeeze
 PHP Version:5.4.0alpha3
 Block user comment: N
 Private report: N

 New Comment:

Abstract constructors? What are you smoking? WONTFIX


Previous Comments:

[2011-08-06 15:58:36] perraud dot mickael at orange dot fr

Perfect, thanks!


[2011-08-06 15:52:07] fel...@php.net

In fact the behavior has been changed in 5.4, related to bug #51421.
I'll add the change to UPGRADING file, thanks.


[2011-08-06 15:51:26] paj...@php.net

It sounds to me like a bug fix. As the child declaration is more restrictive 
than 
the parent declaration, and is against any good design or OO convention.


[2011-08-06 11:02:30] mikaelk...@php.net

Description:

I just experiment this behavior with PHP5.4a3 when running the following code:
https://bugs.php.net/bug.php?id=55375&edit=1


Bug #51421 [Com]: Abstract __construct constructor argument list not enforced

2012-10-26 Thread dagguh at gmail dot com
Edit report at https://bugs.php.net/bug.php?id=51421&edit=1

 ID: 51421
 Comment by: dagguh at gmail dot com
 Reported by:awood at theiet dot org
 Summary:Abstract __construct constructor argument list not
 enforced
 Status: Closed
 Type:   Bug
 Package:Scripting Engine problem
 Operating System:   Windows XP SP3
 PHP Version:5.2SVN-2010-03-29 (snap)
 Assigned To:felipe
 Block user comment: N
 Private report: N

 New Comment:

Abstract constructors again.
Learn some basics of OOP.

Why would you EVER want to enforce argument list of a constructor is beyond me.
I bet you are doing something like:
new $iHaveNoClueAboutProgramming($foo, $bar);

Guess what, this code is bad.


Previous Comments:

[2010-06-28 18:41:25] fel...@php.net

The fix has been reverted for 5.2 and 5.3 branches, due BC issue.


[2010-06-28 18:38:00] fel...@php.net

Automatic comment from SVN on behalf of felipe
Revision: http://svn.php.net/viewvc/?view=revision&revision=300817
Log: - Reverted fix for bug #51421


[2010-06-27 00:05:15] fel...@php.net

This bug has been fixed in SVN.

Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
http://snaps.php.net/.
 
Thank you for the report, and for helping us make PHP better.




[2010-06-27 00:05:15] fel...@php.net

Automatic comment from SVN on behalf of felipe
Revision: http://svn.php.net/viewvc/?view=revision&revision=300770
Log: - Fixed bug #51421 (Abstract __construct constructor argument list not 
enforced)


[2010-03-29 01:41:53] awood at theiet dot org

Description:

PHP Version = 5.2.6.6

I cannot seem to enforce a class's __construct argument list by defining an 
abstract constructor in the base class. This can, however, be achieved as 
expected by using an object interface.

This was mistakenly reported as not working for interfaces either in bug #43557 
(closed).

Test script:
---
class Type1 {} //for demo purposes
class Type2 {} //for demo purposes

abstract class BaseClass {
   abstract public function __construct(Type1 $foo, Type2 $bar);
}

class ExtendedClass extends BaseClass {
   public function __construct() {
  //expected - fatal error as argument list doesn't match
  //actually happens - nothing, script continues as normal
   }
}

interface SomeInterface {
   public function __construct(Type1 $foo, Type2 $bar);
}

class InterfacedClass implements SomeInterface {
   public function __construct() {
  //generates fatal error as expected
   }
}

Expected result:

Fatal error when declaring ExtendedClass and InterfacedClass as abstract and 
concrete method signatures are different.

Actual result:
--
Only a fatal error when declaring InterfacedClass, no error when declaring 
ExtendedClass.






-- 
Edit this bug report at https://bugs.php.net/bug.php?id=51421&edit=1


[PHP-BUG] Req #63371 [NEW]: Overriding method with an abstract method

2012-10-26 Thread dagguh at gmail dot com
From: dagguh at gmail dot com
Operating system: Irrelevant
PHP version:  5.3.18
Package:  *General Issues
Bug Type: Feature/Change Request
Bug description:Overriding method with an abstract method

Description:

In Java you can override a method with an abstract one, but in PHP it
results in:
Fatal error: Cannot make non abstract method 
IdentifiableExceptionTests::getSystemUnderTest() abstract in class 
RestResponseExceptionTests in xxx on line yyy


Test script:
---
class HttpNotFoundException extends RestResponseException {

public function getHttpStatusCode() {
// ...
}
}

abstract class RestResponseException extends IdentifiableException {

public abstract function getHttpStatusCode();
}

class IdentifiableException extends Exception {

// ...
}

// --- and here come the tests:

class HttpNotFoundExceptionTests extends RestResponseExceptionTests {

protected function getSystemUnderTest() {
return new HttpNotFoundException();
}

// ... tests logic specific to HttpNotFoundException

}

class RestResponseExceptionTests extends IdentifiableExceptionTests {

/**
 * @return RestResponseException
 */
protected abstract function getSystemUnderTest();

// ... tests specific for RestResponseException, even though it is an
abstract class, it has some logic implemented and tests for that portion of
logic are specified here. It is important to note that while
getSystemUnderTest()  method in IdentifiableExceptionTests expects
IdentifiableException, in RestResponseExceptionTests it expects
RestResponseException, which is a proper subclass of IdentifiableException

}

class IdentifiableExceptionTests extends PHPUnit_Framework_TestCase {

/**
 * @return IdentifiableException
 */
protected function getSystemUnderTest() {
return new IdentifiableException();
}

//... tests IdentifiableException logic
}


Expected result:

I expect this code to work.
It works in Java, so why cannot it work in PHP?

Actual result:
--
Fatal error: Cannot make non abstract method 
IdentifiableExceptionTests::getSystemUnderTest() abstract in class 
RestResponseExceptionTests in xxx on line yyy

-- 
Edit bug report at https://bugs.php.net/bug.php?id=63371&edit=1
-- 
Try a snapshot (PHP 5.4):   
https://bugs.php.net/fix.php?id=63371&r=trysnapshot54
Try a snapshot (PHP 5.3):   
https://bugs.php.net/fix.php?id=63371&r=trysnapshot53
Try a snapshot (trunk): 
https://bugs.php.net/fix.php?id=63371&r=trysnapshottrunk
Fixed in SVN:   https://bugs.php.net/fix.php?id=63371&r=fixed
Fixed in release:   https://bugs.php.net/fix.php?id=63371&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=63371&r=needtrace
Need Reproduce Script:  https://bugs.php.net/fix.php?id=63371&r=needscript
Try newer version:  https://bugs.php.net/fix.php?id=63371&r=oldversion
Not developer issue:https://bugs.php.net/fix.php?id=63371&r=support
Expected behavior:  https://bugs.php.net/fix.php?id=63371&r=notwrong
Not enough info:
https://bugs.php.net/fix.php?id=63371&r=notenoughinfo
Submitted twice:
https://bugs.php.net/fix.php?id=63371&r=submittedtwice
register_globals:   https://bugs.php.net/fix.php?id=63371&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=63371&r=php4
Daylight Savings:   https://bugs.php.net/fix.php?id=63371&r=dst
IIS Stability:  https://bugs.php.net/fix.php?id=63371&r=isapi
Install GNU Sed:https://bugs.php.net/fix.php?id=63371&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=63371&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=63371&r=nozend
MySQL Configuration Error:  https://bugs.php.net/fix.php?id=63371&r=mysqlcfg



Req #63371 [Com]: Overriding method with an abstract method

2012-10-26 Thread dagguh at gmail dot com
Edit report at https://bugs.php.net/bug.php?id=63371&edit=1

 ID: 63371
 Comment by: dagguh at gmail dot com
 Reported by:dagguh at gmail dot com
 Summary:Overriding method with an abstract method
 Status: Open
 Type:   Feature/Change Request
 Package:*General Issues
 Operating System:   Irrelevant
 PHP Version:5.3.18
 Block user comment: N
 Private report: N

 New Comment:

@hanskrentel:
I made the comparison, because Java is generally more restrictive than PHP.
This time, it is PHP which imposes a restriction, which is not present in Java. 
Furthermore, this restriction is aribtrary and completely unnecessary.

Moreover, PHP is strongly influenced from Java since PHP5.


Previous Comments:

[2012-10-26 17:23:52] hanskrentel at yahoo dot de

> It works in Java, so why cannot it work in PHP?

Because PHP is PHP and Java is Java. So where to file the bug-report? Shouldn't 
it 
be reported as a bug at Java, because Java doesn't do it like PHP?


[2012-10-26 17:16:30] dagguh at gmail dot com

Description:

In Java you can override a method with an abstract one, but in PHP it results 
in:
Fatal error: Cannot make non abstract method 
IdentifiableExceptionTests::getSystemUnderTest() abstract in class 
RestResponseExceptionTests in xxx on line yyy


Test script:
---
class HttpNotFoundException extends RestResponseException {

public function getHttpStatusCode() {
// ...
}
}

abstract class RestResponseException extends IdentifiableException {

public abstract function getHttpStatusCode();
}

class IdentifiableException extends Exception {

// ...
}

// --- and here come the tests:

class HttpNotFoundExceptionTests extends RestResponseExceptionTests {

protected function getSystemUnderTest() {
return new HttpNotFoundException();
}

// ... tests logic specific to HttpNotFoundException

}

class RestResponseExceptionTests extends IdentifiableExceptionTests {

/**
 * @return RestResponseException
 */
protected abstract function getSystemUnderTest();

// ... tests specific for RestResponseException, even though it is an 
abstract class, it has some logic implemented and tests for that portion of 
logic are specified here. It is important to note that while 
getSystemUnderTest()  method in IdentifiableExceptionTests expects 
IdentifiableException, in RestResponseExceptionTests it expects 
RestResponseException, which is a proper subclass of IdentifiableException

}

class IdentifiableExceptionTests extends PHPUnit_Framework_TestCase {

/**
 * @return IdentifiableException
 */
protected function getSystemUnderTest() {
return new IdentifiableException();
}

//... tests IdentifiableException logic
}


Expected result:

I expect this code to work.
It works in Java, so why cannot it work in PHP?

Actual result:
--
Fatal error: Cannot make non abstract method 
IdentifiableExceptionTests::getSystemUnderTest() abstract in class 
RestResponseExceptionTests in xxx on line yyy






-- 
Edit this bug report at https://bugs.php.net/bug.php?id=63371&edit=1


Req #63298 [Com]: Nothing resolves upwards in PHP

2012-10-26 Thread dagguh at gmail dot com
Edit report at https://bugs.php.net/bug.php?id=63298&edit=1

 ID: 63298
 Comment by: dagguh at gmail dot com
 Reported by:nat at nath dot is
 Summary:Nothing resolves upwards in PHP
 Status: Open
 Type:   Feature/Change Request
 Package:*General Issues
 Operating System:   Unix
 PHP Version:5.4.7
 Block user comment: N
 Private report: N

 New Comment:

your Animal class is not in global namespace, but in MyProject.
You gotta import it via:
use MyProject\Animal;

This request is invalid
BTW. Namespaces should be all in lowercase.


Previous Comments:

[2012-10-17 22:25:08] nat at nath dot is

Description:

---
>From manual page: http://www.php.net/language.namespaces.global
---

I would love to use namespaces, but it seems kind of silly that nothing in PHP 
resolves upwards (be that variables, classes, constants or functions).



Test script:
---
https://gist.github.com/3908714/c7639b02a8a4fc2c13ebfbcb35e41d17ab1b8d44

Expected result:

whoof

Actual result:
--
Fatal error: Class 'MyProject\Animal\Animal' not found in 
/Users/Nathaniel/Projects/test/animal/dog.php on line 5







-- 
Edit this bug report at https://bugs.php.net/bug.php?id=63298&edit=1


Req #62574 [Com]: New operator for htmlspecialchars

2012-10-26 Thread dagguh at gmail dot com
Edit report at https://bugs.php.net/bug.php?id=62574&edit=1

 ID: 62574
 Comment by: dagguh at gmail dot com
 Reported by:thbley at gmail dot com
 Summary:New operator for htmlspecialchars
 Status: Open
 Type:   Feature/Change Request
 Package:*General Issues
 PHP Version:Irrelevant
 Block user comment: N
 Private report: N

 New Comment:

This is valid.

@ajf:
You should never dop anything "ahead-of-time" in programming. You shoudl escape 
a 
variable right before passing it to en environment, that requires this form of 
escaping


Previous Comments:

[2012-09-04 18:15:37] ajf at ajf dot me

(I'm all for this though, I'm just pointing out other options)


[2012-09-04 18:06:32] ajf at ajf dot me

You can escape things ahead-of-time, you know. In fact, I have a feeling you 
could use foreach to traverse the symtable and escape everything. (don't do 
that 
though, that's a horrendous idea)


[2012-07-16 04:07:43] thbley at gmail dot com

Description:

old:


new:
echo <$str>;
 ?>

or:








-- 
Edit this bug report at https://bugs.php.net/bug.php?id=62574&edit=1


Bug #62537 [Com]: Composed class has fatal error with duplicate, equal array properties

2012-10-26 Thread dagguh at gmail dot com
Edit report at https://bugs.php.net/bug.php?id=62537&edit=1

 ID: 62537
 Comment by: dagguh at gmail dot com
 Reported by:jeremeamia at gmail dot com
 Summary:Composed class has fatal error with duplicate, equal
 array properties
 Status: Open
 Type:   Bug
 Package:Class/Object related
 Operating System:   Ubuntu
 PHP Version:5.4.4
 Block user comment: N
 Private report: N

 New Comment:

If it is logically the same thing, it should be only in one of these traits, 
don't 
you think?
SRP and DRY, fellas


Previous Comments:

[2012-07-20 09:07:13] ahar...@php.net

I'd call this a bug, rather than a documentation issue; if Foo::$var === 
Bar::$var, I can't really see why it should fatal.

Reclassifying, and we'll see what the engine folk think.


[2012-07-12 01:36:55] jeremeamia at gmail dot com

Another test script, which might be even more relevant:

  trait Foo {public $var = [];}
  class Bar {use Foo; public $var = [];}

This also causes a fatal error for me, which should only be a strict error 
based 
on the documentation.


[2012-07-11 19:45:00] jeremeamia at gmail dot com

Description:

---
>From manual page: http://www.php.net/language.oop5.traits
---

The manual says, "If a trait defines a property then a class can not define a 
property with the same name, otherwise an error is issued. It is an E_STRICT if 
the class definition is compatible (same visibility and initial value) or fatal 
error otherwise."

This does not appear to be true when the same-named properties have array 
values. 
See the test script for a quick example. It seems that it behaves as the 
documentation describes only with scalar values.

This is either missing/erroneous documentation (i.e. the behavior is intended), 
or 
it is a bug (i.e. equal array values should not cause a fatal error).

Test script:
---
trait Foo {public $var = [];}
trait Bar {public $var = [];}
class Baz {use Foo, Bar;}

Expected result:

To behave as the documentation describes, i.e. no fatal errors occuring.

Actual result:
--
PHP Fatal error:  Foo and Bar define the same property ($var) in the 
composition 
of Baz. However, the definition differs and is considered incompatible.






-- 
Edit this bug report at https://bugs.php.net/bug.php?id=62537&edit=1


Req #62435 [Com]: Shorted if and references handling

2012-10-26 Thread dagguh at gmail dot com
Edit report at https://bugs.php.net/bug.php?id=62435&edit=1

 ID: 62435
 Comment by: dagguh at gmail dot com
 Reported by:grzegorz129 at gmail dot com
 Summary:Shorted if and references handling
 Status: Open
 Type:   Feature/Change Request
 Package:Scripting Engine problem
 Operating System:   N/A
 PHP Version:5.4.4
 Block user comment: N
 Private report: N

 New Comment:

"Short if" is known as ternary operator.

What you want to write is:
$this->_currentExceptionInfo =& ((isset($this->_exceptionsMap[$code])) ? $this-
>_exceptionsMap[$code] : $this->_exceptionsMap[self::X_INTERNAL]);

BTW. Using references is a bad idea.
This request is invalid.


Previous Comments:

[2012-06-28 09:41:09] grzegorz129 at gmail dot com

Description:

PHP doesn't allow to use references in short if construction - I don't have 
idea 
why it's limited. I think it should be improved in future releases.

Test script:
---
$this->_currentExceptionInfo = ((isset($this->_exceptionsMap[$code])) ? 
&$this->_exceptionsMap[$code] : &$this->_exceptionsMap[self::X_INTERNAL]); 
//Error

//The same function but it works as expected
if(isset($this->_exceptionsMap[$code])) $this->_currentExceptionInfo = 
&$this->_exceptionsMap[$code];
else $this->_currentExceptionInfo = &$this->_exceptionsMap[self::X_INTERNAL];







-- 
Edit this bug report at https://bugs.php.net/bug.php?id=62435&edit=1


Req #62257 [Com]: Allow variables in class create

2012-10-26 Thread dagguh at gmail dot com
Edit report at https://bugs.php.net/bug.php?id=62257&edit=1

 ID: 62257
 Comment by: dagguh at gmail dot com
 Reported by:valentiny510 at yahoo dot es
 Summary:Allow variables in class create
 Status: Open
 Type:   Feature/Change Request
 Package:Class/Object related
 Operating System:   XP
 PHP Version:5.4.3
 Block user comment: N
 Private report: N

 New Comment:

Absolutely disagreed.
Downvoting this abomination.
Leave creating anonymous classes to mock frameworks


Previous Comments:

[2012-06-13 19:47:54] valentiny510 at yahoo dot es

With the short names was just an example. Imagine one autoload function where 
you can create classes on the fly:

(pseudofunction)
function autoload( $class )
{
if ( isset (array($class)))
include/require $class
elseif (file_exists($class))
include $class
else
class $class
{
function __get( $what ){ return $what 'to be / not to be' }
}
}

and I can put here more than 10-20 quick examples...


[2012-06-08 23:37:27] ni...@php.net

If you want to shorten long names make use of the namespacing support 
introduced in 5.3. Simply write

use SomeVery\VeryLong\NameAndMore as ShortName;

and you're done. You can also do this programmatically using class_alias().


[2012-06-08 01:20:34] valentiny510 at yahoo dot es

P.S. Not only for long names.. but also for autoloading/extending multiple 
classes.. now I let you to imaginate..


[2012-06-08 01:08:33] valentiny510 at yahoo dot es

Description:

I think may be very useful sometimes allowing the use of variables when create 
some class like this:

$class = 'test';
class $class { }

Sometimes when working with some cms/framework etc.. they have 
a_very_very_very_long_name_for some_classes and will be more easy (depends of 
situation) to have an array with shorten name. Ex:

$short_names = array (
'short1' => 'a_very_long_name_of_some_class',
'short2' => 'another_very_long_name');
foreach ($short_names as $short => $long)
class $short extends $long { }
/*endforeach*/;








-- 
Edit this bug report at https://bugs.php.net/bug.php?id=62257&edit=1


[PHP-BUG] Bug #63384 [NEW]: Cannot override an abstract method with an abstract method

2012-10-29 Thread dagguh at gmail dot com
From: dagguh at gmail dot com
Operating system: Irrelevant
PHP version:  5.3.18
Package:  Class/Object related
Bug Type: Bug
Bug description:Cannot override an abstract method with an abstract method

Description:

It is impossible to override an abstract method with another abstract
method.
This is useful if you are trying to indicate (to both IDE and other
developers) 
that the overriden method returns type is expected to be a subclass of the

inherited method return type.

PS. Java allows it and it is generally a more restrictive language than
PHP.

Test script:
---
abstract class RuntimeExceptionReporter extends ExceptionReporter {

/**
 * @return RuntimeException
 */
public abstract function getExceptionToReport();

// ... some operations specific to RuntimeException

}

abstract class ExceptionReporter {

/**
 * @return Exception
 */
public abstract function getExceptionToReport();

// ... some operations on an Exception

}

Expected result:

Correct inheritance

Actual result:
--
Fatal error: Can't inherit abstract function 
ExceptionReporter::getExceptionToReport() (previously declared abstract in

RuntimeExceptionReporter) in xxx on line yyy

-- 
Edit bug report at https://bugs.php.net/bug.php?id=63384&edit=1
-- 
Try a snapshot (PHP 5.4):   
https://bugs.php.net/fix.php?id=63384&r=trysnapshot54
Try a snapshot (PHP 5.3):   
https://bugs.php.net/fix.php?id=63384&r=trysnapshot53
Try a snapshot (trunk): 
https://bugs.php.net/fix.php?id=63384&r=trysnapshottrunk
Fixed in SVN:   https://bugs.php.net/fix.php?id=63384&r=fixed
Fixed in release:   https://bugs.php.net/fix.php?id=63384&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=63384&r=needtrace
Need Reproduce Script:  https://bugs.php.net/fix.php?id=63384&r=needscript
Try newer version:  https://bugs.php.net/fix.php?id=63384&r=oldversion
Not developer issue:https://bugs.php.net/fix.php?id=63384&r=support
Expected behavior:  https://bugs.php.net/fix.php?id=63384&r=notwrong
Not enough info:
https://bugs.php.net/fix.php?id=63384&r=notenoughinfo
Submitted twice:
https://bugs.php.net/fix.php?id=63384&r=submittedtwice
register_globals:   https://bugs.php.net/fix.php?id=63384&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=63384&r=php4
Daylight Savings:   https://bugs.php.net/fix.php?id=63384&r=dst
IIS Stability:  https://bugs.php.net/fix.php?id=63384&r=isapi
Install GNU Sed:https://bugs.php.net/fix.php?id=63384&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=63384&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=63384&r=nozend
MySQL Configuration Error:  https://bugs.php.net/fix.php?id=63384&r=mysqlcfg



Bug #63359 [Com]: Defining a interface const with value of another constant triggers fatal error

2012-11-14 Thread dagguh at gmail dot com
Edit report at https://bugs.php.net/bug.php?id=63359&edit=1

 ID: 63359
 Comment by: dagguh at gmail dot com
 Reported by:maciej dot sz at gmail dot com
 Summary:Defining a interface const with value of another
 constant triggers fatal error
 Status: Open
 Type:   Bug
 Package:Scripting Engine problem
 Operating System:   Linux
 PHP Version:5.4.8
 Block user comment: N
 Private report: N

 New Comment:

This is especially painful when you are trying to work your way around lack of 
class literal.




You often need the class name for mocking frameworks.


Previous Comments:

[2012-10-25 10:45:43] maciej dot sz at gmail dot com

Description:

When a constant is defined in an interface with a value of another class or 
interface constant, a fatal error is triggered:

Fatal error: Cannot inherit previously-inherited or override constant FOO from 
interface IMyInterface in Bar.php on line 3

To reproduce this following conditions must be met (took me 2 days to figure 
this out):
- the constant value must be defined as another class/interface constant
- classes and interfaces must be autoloaded on demand
- two classes must implement the interface
- one class must inherit the other one
- the super class must be instantiated before the sub class

Seems like this is related to bug #33732 and bug #38286 but is still not fixed.

Test script:
---

File IMyInterface.php:
--
https://bugs.php.net/bug.php?id=63359&edit=1