Bug #63013 [Fbk->Csd]: Error not thrown with constructor call

2012-09-06 Thread samu dot voutilainen at gmail dot com
Edit report at https://bugs.php.net/bug.php?id=63013&edit=1

 ID: 63013
 User updated by:samu dot voutilainen at gmail dot com
 Reported by:samu dot voutilainen at gmail dot com
 Summary:Error not thrown with constructor call
-Status: Feedback
+Status: Closed
 Type:   Bug
 Package:*General Issues
 Operating System:   Linux
 PHP Version:5.4.6
 Block user comment: N
 Private report: N

 New Comment:

error_reporting = E_ALL & ~E_DEPRECATED & ~E_STRICT
display_errors = On

Looks like I accidentally didn’t have only E_ALL (that should be all errors 
that exists, no?)

Anyway, now I’m not able to reproduce the problem even with original 
error_reporting, so I think it comes up randomly. I guess this one can be 
closed as invalid and if I manage to reproduce it, try to do proper test case. 

I did spot this before (no errors where should’ve been, just immediate 
death), so I think there is something, but need first manage to reproduce it...


Previous Comments:

[2012-09-06 01:40:33] ahar...@php.net

I can't reproduce this either. We'll have to wait for the new example.

Can you also provide your display_errors and error_reporting settings, please?


[2012-09-05 14:24:35] samu dot voutilainen at gmail dot com

I don’t get the warnings for the case I had; this simpler example does 
though. I’ll construct an example with proper namespaces to see if it causes 
it.


[2012-09-05 13:20:23] larue...@php.net

PHP will warn you:

PHP Warning:  Missing argument 1 for AbstractHandler::__construct(), called in 
/tmp/1.php on line 30 and defined in /tmp/1.php on line 18
PHP Warning:  Missing argument 2 for AbstractHandler::__construct(), called in 
/tmp/1.php on line 30 and defined in /tmp/1.php on line 18
PHP Warning:  Missing argument 3 for AbstractHandler::__construct(), called in 
/tmp/1.php on line 30 and defined in /tmp/1.php on line 18


[2012-09-05 10:41:20] samu dot voutilainen at gmail dot com

Also the code I have uses namespaces.


[2012-09-05 10:37:20] samu dot voutilainen at gmail dot com

Description:

When inheriting from a class and calling constructor with invalid arguments, it 
won’t throw any error, but die silently. There is no information in web 
server log or PHP-FPM’s logs and nothing is returned to client either.



Test script:
---
class SlamObject {

}

class Utility extends SlamObject {

}

abstract class AbstractHandler extends Utility {

protected $version;

protected $session;

protected $output;

public function __construct($session, $output, $version) {
$this->session = $session;
$this->output = $output;
$this->version = $version;
}

}

class Foo extends AbstractClass {

}

$foo = new Foo();

Expected result:

At the point of Foo, fatal error is thrown telling that you called constructor 
with wrong arguments.

Actual result:
--
Silent death at this point with no information anywhere.






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


Bug #63013 [Opn]: Error not thrown with constructor call

2012-09-05 Thread samu dot voutilainen at gmail dot com
Edit report at https://bugs.php.net/bug.php?id=63013&edit=1

 ID: 63013
 User updated by:samu dot voutilainen at gmail dot com
 Reported by:samu dot voutilainen at gmail dot com
 Summary:Error not thrown with constructor call
 Status: Open
 Type:   Bug
 Package:*General Issues
 Operating System:   Linux
 PHP Version:5.4.6
 Block user comment: N
 Private report: N

 New Comment:

I don’t get the warnings for the case I had; this simpler example does 
though. I’ll construct an example with proper namespaces to see if it causes 
it.


Previous Comments:

[2012-09-05 13:20:23] larue...@php.net

PHP will warn you:

PHP Warning:  Missing argument 1 for AbstractHandler::__construct(), called in 
/tmp/1.php on line 30 and defined in /tmp/1.php on line 18
PHP Warning:  Missing argument 2 for AbstractHandler::__construct(), called in 
/tmp/1.php on line 30 and defined in /tmp/1.php on line 18
PHP Warning:  Missing argument 3 for AbstractHandler::__construct(), called in 
/tmp/1.php on line 30 and defined in /tmp/1.php on line 18


[2012-09-05 10:41:20] samu dot voutilainen at gmail dot com

Also the code I have uses namespaces.


[2012-09-05 10:37:20] samu dot voutilainen at gmail dot com

Description:

When inheriting from a class and calling constructor with invalid arguments, it 
won’t throw any error, but die silently. There is no information in web 
server log or PHP-FPM’s logs and nothing is returned to client either.



Test script:
---
class SlamObject {

}

class Utility extends SlamObject {

}

abstract class AbstractHandler extends Utility {

protected $version;

protected $session;

protected $output;

public function __construct($session, $output, $version) {
$this->session = $session;
$this->output = $output;
$this->version = $version;
}

}

class Foo extends AbstractClass {

}

$foo = new Foo();

Expected result:

At the point of Foo, fatal error is thrown telling that you called constructor 
with wrong arguments.

Actual result:
--
Silent death at this point with no information anywhere.






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


Bug #63013 [Opn]: Error not thrown with constructor call

2012-09-05 Thread samu dot voutilainen at gmail dot com
Edit report at https://bugs.php.net/bug.php?id=63013&edit=1

 ID: 63013
 User updated by:samu dot voutilainen at gmail dot com
 Reported by:samu dot voutilainen at gmail dot com
 Summary:Error not thrown with constructor call
 Status: Open
 Type:   Bug
 Package:*General Issues
 Operating System:   Linux
 PHP Version:5.4.6
 Block user comment: N
 Private report: N

 New Comment:

Also the code I have uses namespaces.


Previous Comments:

[2012-09-05 10:37:20] samu dot voutilainen at gmail dot com

Description:

When inheriting from a class and calling constructor with invalid arguments, it 
won’t throw any error, but die silently. There is no information in web 
server log or PHP-FPM’s logs and nothing is returned to client either.



Test script:
---
class SlamObject {

}

class Utility extends SlamObject {

}

abstract class AbstractHandler extends Utility {

protected $version;

protected $session;

protected $output;

public function __construct($session, $output, $version) {
$this->session = $session;
$this->output = $output;
$this->version = $version;
}

}

class Foo extends AbstractClass {

}

$foo = new Foo();

Expected result:

At the point of Foo, fatal error is thrown telling that you called constructor 
with wrong arguments.

Actual result:
--
Silent death at this point with no information anywhere.






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


[PHP-BUG] Bug #63013 [NEW]: Error not thrown with constructor call

2012-09-05 Thread samu dot voutilainen at gmail dot com
From: samu dot voutilainen at gmail dot com
Operating system: Linux
PHP version:  5.4.6
Package:  *General Issues
Bug Type: Bug
Bug description:Error not thrown with constructor call

Description:

When inheriting from a class and calling constructor with invalid
arguments, it won’t throw any error, but die silently. There is no
information in web server log or PHP-FPM’s logs and nothing is returned
to client either.



Test script:
---
class SlamObject {

}

class Utility extends SlamObject {

}

abstract class AbstractHandler extends Utility {

protected $version;

protected $session;

protected $output;

public function __construct($session, $output, $version) {
$this->session = $session;
$this->output = $output;
$this->version = $version;
}

}

class Foo extends AbstractClass {

}

$foo = new Foo();

Expected result:

At the point of Foo, fatal error is thrown telling that you called
constructor with wrong arguments.

Actual result:
--
Silent death at this point with no information anywhere.

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



Bug #54513 [Fbk->Csd]: json_decode skips value where json_encode includes it

2011-04-13 Thread samu dot voutilainen at gmail dot com
Edit report at http://bugs.php.net/bug.php?id=54513&edit=1

 ID: 54513
 User updated by:samu dot voutilainen at gmail dot com
 Reported by:samu dot voutilainen at gmail dot com
 Summary:json_decode skips value where json_encode includes
 it
-Status: Feedback
+Status: Closed
 Type:   Bug
 Package:JSON related
 Operating System:   Gentoo Linux x86
 PHP Version:5.3.6
 Block user comment: N
 Private report: N

 New Comment:

Hmph, sorry, I’m not able to reproduce it either...


Previous Comments:

[2011-04-12 17:23:31] scott...@php.net

I need a reproduce script.



I just used:

a = 1;

$test->b = array();

$test->c = 'foo';



$json = json_encode($test);

var_dump($test);

var_dump(json_decode($json));



And I got the output:

object(stdClass)#1 (3) {

  ["a"]=>

  int(1)

  ["b"]=>

  array(0) {

  }

  ["c"]=>

  string(3) "foo"

}

object(stdClass)#2 (3) {

  ["a"]=>

  int(1)

  ["b"]=>

  array(0) {

  }

  ["c"]=>

  string(3) "foo"

}



Nothing missing there.

------------
[2011-04-12 13:26:41] samu dot voutilainen at gmail dot com

Description:

If you have empty array inside object, json_encode() does encode the
value into JSON format, but when the data is decoded with json_decode(),
this empty JSON array is omitted from output.



Consider following structure:



 ["timetable"]=>

  object(pizzaonline\model\Timetable)#30 (9) {

["id"]=>

string(3) "774"

["timetable"]=>

array(0) {

}

["opening_hours"]=>

..



Corresponding json_encode would be:



"timetable":{

"id":"774",

"timetable":[



],

"opening_hours":[

  ..



This is all right, but I have a loop that removes this empty array with
unset(). So PHP structure from JSON is encoded is like:



["timetable"]=>

  object(pizzaonline\model\Timetable)#30 (8) {

["id"]=>

string(3) "774"

["opening_hours"]=>



But using json_encode() returns same result that is in snippet 2.



Just ask if any questions, I’ll do example script later...







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


[PHP-BUG] Bug #54513 [NEW]: json_decode skips value where json_encode includes it

2011-04-12 Thread samu dot voutilainen at gmail dot com
From: 
Operating system: Gentoo Linux x86
PHP version:  5.3.6
Package:  JSON related
Bug Type: Bug
Bug description:json_decode skips value where json_encode includes it

Description:

If you have empty array inside object, json_encode() does encode the value
into JSON format, but when the data is decoded with json_decode(), this
empty JSON array is omitted from output.



Consider following structure:



 ["timetable"]=>

  object(pizzaonline\model\Timetable)#30 (9) {

["id"]=>

string(3) "774"

["timetable"]=>

array(0) {

}

["opening_hours"]=>

..



Corresponding json_encode would be:



"timetable":{

"id":"774",

"timetable":[



],

"opening_hours":[

  ..



This is all right, but I have a loop that removes this empty array with
unset(). So PHP structure from JSON is encoded is like:



["timetable"]=>

  object(pizzaonline\model\Timetable)#30 (8) {

["id"]=>

string(3) "774"

["opening_hours"]=>



But using json_encode() returns same result that is in snippet 2.



Just ask if any questions, I’ll do example script later...


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



[PHP-BUG] Bug #52095 [NEW]: Subclassing a class in a namespace doesn’t allow overloading functions

2010-06-16 Thread samu dot voutilainen at gmail dot com
From: 
Operating system: Linux
PHP version:  5.3.2
Package:  Reproducible crash
Bug Type: Bug
Bug description:Subclassing a class in a namespace doesn’t allow overloading 
functions

Description:

Code below demonstrates how to produce the bug.



I get to error log a very obscure error:



[Wed Jun 16 15:50:26 2010] [error] [client 127.0.0.1] PHP Fatal error: 
Class 'slm\\util\\Logger' not found in [..]/a.php on line 160



As a note, there is no call to Logger in this class. 

Test script:
---
namespace foo {

class A {

 public function meh($is = true) { }

}

}

namespace bar {

class B extends /foo/A {

 public function meh() {}

}

}

Expected result:

B::meh() to override A::meh()

Actual result:
--
No output and very strange error to the system log:



[Wed Jun 16 15:50:26 2010] [error] [client 127.0.0.1] PHP Fatal error: 
Class 'slm\\util\\Logger' not found in [..]/a.php on line 160

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