Bug #63435 [Opn->Asn]: Datetime::format('u') sometimes wrong by 1 microsecond

2012-12-01 Thread remi
Edit report at https://bugs.php.net/bug.php?id=63435&edit=1

 ID: 63435
 Updated by: r...@php.net
 Reported by:miau dot jp at gmail dot com
 Summary:Datetime::format('u') sometimes wrong by 1
 microsecond
-Status: Open
+Status: Assigned
 Type:   Bug
 Package:Date/time related
 Operating System:   Any
 PHP Version:5.3.18
-Assigned To:
+Assigned To:remi
 Block user comment: N
 Private report: N



Previous Comments:

[2012-11-04 15:50:59] miau dot jp at gmail dot com

Description:

When storing '015700' microseconds in a Datetime object,
Datetime::format('u') returns '015699'. This behavior is critical when
I use optimistic locking.


$datetime = Datetime::createFromFormat('u', '015700');
$datetime->format('u'); // => '015699'


Datetime objects hold microseconds as "double" type in C.
'015700' is held as 0.015698679. Datetime::format('u')
calls floor() and it returns .015699.
(see https://github.com/php/php-src/blob/PHP-5.3.18/ext/date/php_date.c#L1098 )


Test script:
---
$datetime = Datetime::createFromFormat('u', '015700');
$datetime->format('u');


Expected result:

015700

Actual result:
--
015699






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


Bug #63435 [Asn->Csd]: Datetime::format('u') sometimes wrong by 1 microsecond

2012-12-01 Thread remi
Edit report at https://bugs.php.net/bug.php?id=63435&edit=1

 ID: 63435
 Updated by: r...@php.net
 Reported by:miau dot jp at gmail dot com
 Summary:Datetime::format('u') sometimes wrong by 1
 microsecond
-Status: Assigned
+Status: Closed
 Type:   Bug
 Package:Date/time related
 Operating System:   Any
 PHP Version:5.3.18
 Assigned To:remi
 Block user comment: N
 Private report: N

 New Comment:

Automatic comment on behalf of remi
Revision: 
http://git.php.net/?p=php-src.git;a=commit;h=c2554b4bb43700ae16db34d9706db1db85ec78a4
Log: Fixed Bug #63435 Datetime::format('u') sometimes wrong by 1 microsecond


Previous Comments:

[2012-11-04 15:50:59] miau dot jp at gmail dot com

Description:

When storing '015700' microseconds in a Datetime object,
Datetime::format('u') returns '015699'. This behavior is critical when
I use optimistic locking.


$datetime = Datetime::createFromFormat('u', '015700');
$datetime->format('u'); // => '015699'


Datetime objects hold microseconds as "double" type in C.
'015700' is held as 0.015698679. Datetime::format('u')
calls floor() and it returns .015699.
(see https://github.com/php/php-src/blob/PHP-5.3.18/ext/date/php_date.c#L1098 )


Test script:
---
$datetime = Datetime::createFromFormat('u', '015700');
$datetime->format('u');


Expected result:

015700

Actual result:
--
015699






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


Bug #63646 [Opn->Wfx]: Trait method names matching classes that use said trait treated as constructors

2012-12-01 Thread laruence
Edit report at https://bugs.php.net/bug.php?id=63646&edit=1

 ID: 63646
 Updated by: larue...@php.net
 Reported by:phpbugs at catchall dot drarok dot com
 Summary:Trait method names matching classes that use said
 trait treated as constructors
-Status: Open
+Status: Wont fix
 Type:   Bug
 Package:Scripting Engine problem
 Operating System:   OS X 10.8
 PHP Version:master-Git-2012-11-29 (Git)
 Block user comment: N
 Private report: N

 New Comment:

Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to report
a bug at http://bugs.php.net/how-to-report.php

the method name same as class name is considered as constructor as of PHP 5.4 

although we encourage use __construct instead of that. but it should also be 
compatible


Previous Comments:

[2012-11-29 09:48:49] phpbugs at catchall dot drarok dot com

Description:

If you use a Trait which has a method name matching your class name, it is used 
as 
an old-style constructor in the case where the using class doesn't define a 
constructor.

If you *do* define a constructor, you receive the error "Fatal error: Hello has 
colliding constructor definitions coming from traits".

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


Bug #63646 [Com]: Trait method names matching classes that use said trait treated as constructors

2012-12-01 Thread ni...@php.net
Edit report at https://bugs.php.net/bug.php?id=63646&edit=1

 ID: 63646
 Comment by: ni...@php.net
 Reported by:phpbugs at catchall dot drarok dot com
 Summary:Trait method names matching classes that use said
 trait treated as constructors
 Status: Wont fix
 Type:   Bug
 Package:Scripting Engine problem
 Operating System:   OS X 10.8
 PHP Version:master-Git-2012-11-29 (Git)
 Block user comment: N
 Private report: N

 New Comment:

@laruence: On the other hand, if you are using a namespaced class old-style 
constructors aren't used either. So the same might also be done with traits.


Previous Comments:

[2012-12-01 11:31:06] larue...@php.net

Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to report
a bug at http://bugs.php.net/how-to-report.php

the method name same as class name is considered as constructor as of PHP 5.4 

although we encourage use __construct instead of that. but it should also be 
compatible


[2012-11-29 09:48:49] phpbugs at catchall dot drarok dot com

Description:

If you use a Trait which has a method name matching your class name, it is used 
as 
an old-style constructor in the case where the using class doesn't define a 
constructor.

If you *do* define a constructor, you receive the error "Fatal error: Hello has 
colliding constructor definitions coming from traits".

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


Bug #63652 [Com]: Using twice the same trait causes fatal error.

2012-12-01 Thread stealz at op dot pl
Edit report at https://bugs.php.net/bug.php?id=63652&edit=1

 ID: 63652
 Comment by: stealz at op dot pl
 Reported by:stealz at op dot pl
 Summary:Using twice the same trait causes fatal error.
 Status: Open
 Type:   Bug
 Package:Class/Object related
 Operating System:   Windows 7
 PHP Version:5.4.9
 Block user comment: N
 Private report: N

 New Comment:

Thank you for your reply.
PHP had warned me indeed, but it doesn't change the fact that, as I wrote, this 
is exactly the same method of exactly the same trait, so it shouldn't be 
colliding at all.
Can you please prove me wrong?


Previous Comments:

[2012-12-01 05:52:37] larue...@php.net

I think PHP had warn you about method collisions..


[2012-12-01 05:52:32] larue...@php.net

I think PHP had warn you about method collisions..


[2012-11-30 01:48:47] stealz at op dot pl

Description:

I think PHP should check whether traits were used already (ex. in parent class) 
and ignore them instead using again. It causes fatal error due to collisions 
which are obvious, because trait name is the same.
What's interesting, collisions refer only to methods. PHP seems not to see the 
problem if double-used trait contains properties only.

Test script:
---
trait LifeOrganism {
public $age; // it's fine
#public function live() {} // uncomment to get Fatal error
}

trait Man {
use LifeOrganism;
}

trait Elephant {
use LifeOrganism;
}

class ElephantMan {
use Man, Elephant;
}

Expected result:

Ignore trait which was already used.

Actual result:
--
Fatal error.






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


[PHP-BUG] Bug #63664 [NEW]: PHP 5.4 Snapshots don't contain PHP 5.4 code, but 5.5 code

2012-12-01 Thread silvas91 at sapo dot pt
From: silvas91 at sapo dot pt
Operating system: Irrelevant
PHP version:  Irrelevant
Package:  *General Issues
Bug Type: Bug
Bug description:PHP 5.4 Snapshots don't contain PHP 5.4 code, but 5.5 code

Description:

I've downloaded php5.4-201212011230.tar.xz and php_version.h has:

/* automatically generated by configure */
/* edit configure.in to change version number */
#define PHP_MAJOR_VERSION 5
#define PHP_MINOR_VERSION 5
#define PHP_RELEASE_VERSION 0
#define PHP_EXTRA_VERSION "-dev"
#define PHP_VERSION "5.5.0-dev"
#define PHP_VERSION_ID 50500

Also NEWS file has 5.5 changelog instead of 5.4.


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



Bug #63664 [Opn->Dup]: PHP 5.4 Snapshots don't contain PHP 5.4 code, but 5.5 code

2012-12-01 Thread remi
Edit report at https://bugs.php.net/bug.php?id=63664&edit=1

 ID: 63664
 Updated by: r...@php.net
 Reported by:silvas91 at sapo dot pt
 Summary:PHP 5.4 Snapshots don't contain PHP 5.4 code, but
 5.5 code
-Status: Open
+Status: Duplicate
 Type:   Bug
 Package:*General Issues
 Operating System:   Irrelevant
 PHP Version:Irrelevant
-Assigned To:
+Assigned To:remi
 Block user comment: N
 Private report: N

 New Comment:

See bug 63644


Previous Comments:

[2012-12-01 14:25:56] silvas91 at sapo dot pt

Description:

I've downloaded php5.4-201212011230.tar.xz and php_version.h has:

/* automatically generated by configure */
/* edit configure.in to change version number */
#define PHP_MAJOR_VERSION 5
#define PHP_MINOR_VERSION 5
#define PHP_RELEASE_VERSION 0
#define PHP_EXTRA_VERSION "-dev"
#define PHP_VERSION "5.5.0-dev"
#define PHP_VERSION_ID 50500

Also NEWS file has 5.5 changelog instead of 5.4.







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


[PHP-BUG] Bug #63665 [NEW]: Relative namespace import causes getClass() method to throw an exception

2012-12-01 Thread dev at jurajsplayground dot com
From: dev at jurajsplayground dot com
Operating system: Ubuntu
PHP version:  5.4.9
Package:  Reflection related
Bug Type: Bug
Bug description:Relative namespace import causes getClass() method to throw an 
exception

Description:

While importing of namespaced classes via relative namespace directive
works when 
creating objects, ReflectionParameter::getClass() has a problem with it and

throws an exception that such class cannot be found.

Test script:
---
namespace Foo\Bar;
use A\B\BInterface;

class Bar implements BarInterface {
public function __construct()
{
echo "Hello!";
}

public function getSomething(BInterface $b){}
}

namespace Foo\Bar;
use A\B\BInterface;

interface BarInterface {
public function getSomething(BInterface $b);
}

namespace Foo\Bar\A\B;

interface BInterface {}

namespace TestNamespace;

$obj = new \Foo\Bar\Bar();
$ref = new \ReflectionMethod("\\Foo\Bar\Bar", "getSomething");
echo current($ref->getParameters())->getClass();

Expected result:

Should display interface information

Actual result:
--
ReflectionException is thrown: Class A\B\BInterface does not exist

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



[PHP-BUG] Bug #63666 [NEW]: Poor date() performance [PATCH]

2012-12-01 Thread njaguar at gmail dot com
From: njaguar at gmail dot com
Operating system: any
PHP version:  5.4.9
Package:  Performance problem
Bug Type: Bug
Bug description:Poor date() performance [PATCH]

Description:

Full info here:
http://news.php.net/php.internals/64127

4.4.9 on old machine vs 5.4.9 on new machine:
date: 1.856 sec date: 2.111 sec

after patch (~20% performance increase):
date: 1.763 sec

* new machine is 2 to 200x faster than old machine, see link above for more
details


Test script:
---
// common date output format

// use any preferred timing methods either within php, or externally time
execution of the script (eg, microtime(), etc) -- the former will be more
accurate at isolating the date() function, overall
$c = 100;
for($i=0; $i<$c; $i++) date('F j, Y, g:i a', $now);


Expected result:

worse performance on stock builds, better when patch is applied -- still
considerably slower than 4.4.9 version of date() and related, but is an
improvement

Actual result:
--
By moving the frequently used iso fetching function into the switch
statement, this prevents an otherwise unnecessary step for other more
common usages of date formatting.

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



Bug #63665 [Opn]: Relative namespace import causes getClass() method to throw an exception

2012-12-01 Thread laruence
Edit report at https://bugs.php.net/bug.php?id=63665&edit=1

 ID: 63665
 Updated by: larue...@php.net
 Reported by:dev at jurajsplayground dot com
 Summary:Relative namespace import causes getClass() method
 to throw an exception
 Status: Open
 Type:   Bug
 Package:Reflection related
 Operating System:   Ubuntu
 PHP Version:5.4.9
-Assigned To:
+Assigned To:dmitry
 Block user comment: N
 Private report: N

 New Comment:

actually, this is not a only reflection specific issue.

getSomething($arg);


PHP Catchable fatal error:  Argument 1 passed to Foo\Bar\Bar::getSomething() 
must be an instance of A\B\BInterface, instance of Foo\Bar\A\B\Foo given, 
called 
in /tmp/1.php on line 30 and defined in /tmp/1.php on line 18


dmitry, could you please look at this one?


Previous Comments:

[2012-12-01 23:10:49] dev at jurajsplayground dot com

Description:

While importing of namespaced classes via relative namespace directive works 
when 
creating objects, ReflectionParameter::getClass() has a problem with it and 
throws an exception that such class cannot be found.

Test script:
---
namespace Foo\Bar;
use A\B\BInterface;

class Bar implements BarInterface {
public function __construct()
{
echo "Hello!";
}

public function getSomething(BInterface $b){}
}

namespace Foo\Bar;
use A\B\BInterface;

interface BarInterface {
public function getSomething(BInterface $b);
}

namespace Foo\Bar\A\B;

interface BInterface {}

namespace TestNamespace;

$obj = new \Foo\Bar\Bar();
$ref = new \ReflectionMethod("\\Foo\Bar\Bar", "getSomething");
echo current($ref->getParameters())->getClass();

Expected result:

Should display interface information

Actual result:
--
ReflectionException is thrown: Class A\B\BInterface does not exist






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


Bug #63665 [Asn]: Relative namespace import causes getClass() method to throw an exception

2012-12-01 Thread laruence
Edit report at https://bugs.php.net/bug.php?id=63665&edit=1

 ID: 63665
 Updated by: larue...@php.net
 Reported by:dev at jurajsplayground dot com
 Summary:Relative namespace import causes getClass() method
 to throw an exception
 Status: Assigned
 Type:   Bug
 Package:Reflection related
 Operating System:   Ubuntu
 PHP Version:5.4.9
 Assigned To:dmitry
 Block user comment: N
 Private report: N

 New Comment:

I have tried to make a fix, but for such situation

use \Foo;  CG(current_import) only hold the Foo name but doesn't hold the 
global 
name flag..

so, I can not simply resolve the full name of a class name which is imported 
and 
in a namespace.


Previous Comments:

[2012-12-02 05:22:58] larue...@php.net

actually, this is not a only reflection specific issue.

getSomething($arg);


PHP Catchable fatal error:  Argument 1 passed to Foo\Bar\Bar::getSomething() 
must be an instance of A\B\BInterface, instance of Foo\Bar\A\B\Foo given, 
called 
in /tmp/1.php on line 30 and defined in /tmp/1.php on line 18


dmitry, could you please look at this one?


[2012-12-01 23:10:49] dev at jurajsplayground dot com

Description:

While importing of namespaced classes via relative namespace directive works 
when 
creating objects, ReflectionParameter::getClass() has a problem with it and 
throws an exception that such class cannot be found.

Test script:
---
namespace Foo\Bar;
use A\B\BInterface;

class Bar implements BarInterface {
public function __construct()
{
echo "Hello!";
}

public function getSomething(BInterface $b){}
}

namespace Foo\Bar;
use A\B\BInterface;

interface BarInterface {
public function getSomething(BInterface $b);
}

namespace Foo\Bar\A\B;

interface BInterface {}

namespace TestNamespace;

$obj = new \Foo\Bar\Bar();
$ref = new \ReflectionMethod("\\Foo\Bar\Bar", "getSomething");
echo current($ref->getParameters())->getClass();

Expected result:

Should display interface information

Actual result:
--
ReflectionException is thrown: Class A\B\BInterface does not exist






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