Bug #49348 [Com]: Uninitialized ++$foo-bar; does not cause a notice (but ++$bar; does!)

2013-03-29 Thread bugs dot php dot net at majkl578 dot cz
Edit report at https://bugs.php.net/bug.php?id=49348edit=1

 ID: 49348
 Comment by: bugs dot php dot net at majkl578 dot cz
 Reported by:BelStudent at yandex dot ru
 Summary:Uninitialized ++$foo-bar; does not cause a notice
 (but ++$bar; does!)
 Status: Closed
 Type:   Bug
 Package:Scripting Engine problem
 Operating System:   *
 PHP Version:5.*, 6
 Assigned To:stas
 Block user comment: N
 Private report: N

 New Comment:

The message is not consistent with the other one triggered in similar case.

Consider the following code:
$x = new stdClass();
echo $x-foo++;
echo $x-bar;

It triggers two notices:
Notice: Undefined property: foo
Notice: Undefined property: stdClass::$bar

The first one was added by fix for this bug and is wrong. It should be same as 
the other one (should contain classname and dollar).


Previous Comments:

[2013-02-21 08:58:40] s...@php.net

Automatic comment on behalf of stas
Revision: 
http://git.php.net/?p=php-src.git;a=commit;h=0c6d903ce7615a7197cb997d67d98058c3ec5d6a
Log: fix bug #49348 - issue notice on get_property_ptr_ptr when used for read


[2013-02-20 08:35:21] dmi...@php.net

I think the fix is fine, but it may go only into 5.5 and above.


[2013-02-19 09:18:04] s...@php.net

Potential fix in this pull: https://github.com/php/php-src/pull/281


[2013-02-19 04:59:16] s...@php.net

The problem here is that get_property_ptr_ptr does not produce notices. It 
doesn't 
because it does not know the fetch type - in some cases it's BP_VAR_W, then it 
shouldn't produce notice, in some it's BP_VAR_RW and then it should. However 
get_property_ptr_ptr doesn't have a parameter to pass this info.

Looks like such parameter needs to be added...


[2009-09-01 08:41:52] sjo...@php.net

I was talking about this:
http://svn.php.net/viewvc/php/php-src/trunk/Zend/zend_execute.c?revision=286362view=markup#l251

With ++$foo, type is BP_VAR_RW, which makes sense and gives a notice. With 
++$this-foo, it is BP_VAR_W.




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=49348


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


[PHP-BUG] Bug #64513 [NEW]: DateTimeImmutable is incompatible with DateTime and leads to BC breaks

2013-03-25 Thread bugs dot php dot net at majkl578 dot cz
From: bugs dot php dot net at majkl578 dot cz
Operating system: -
PHP version:  5.5.0beta1
Package:  Date/time related
Bug Type: Bug
Bug description:DateTimeImmutable is incompatible with DateTime and leads to BC 
breaks

Description:

PHP 5.5 adds DateTimeImmutable, which extends DateTime.

As Benjamin Eberlei already pointed out in internals list [1], the behavior
is not compatible with each other and therefore the inheritance seems to be
wrong.
This bad implementation is not backward compatible and may lead to serious
problems with existing code.

Here are some examples which would get broken (bad behavior or even
infinite loop!) by passing DateTimeImmutable instead of DateTime.


function testOne(DateTime $dt)
{
for ($i = 1; $i = 2; $i++, $dt-modify('first day of next month')) {
echo $dt-format('Y/m/d'), PHP_EOL;
}
}

testOne(new DateTime());
// 2013/03/25
// 2013/04/01

testOne(new DateTimeImmutable());
// 2013/03/25
// 2013/03/25

---

function testTwo(DateTime $from, DateTime $to)
{
for ($current = clone $from; $current = $to; $current-modify('+ 1 
day'))
{
echo $current-format('Y/m/d'), PHP_EOL;
}
}

testTwo(new DateTime(), new DateTime('+ 1 day'));
// 2013/03/25
// 2013/03/26

testTwo(new DateTimeImmutable(), new DateTimeImmutable('+ 1 day'));
// 2013/03/25
// 2013/03/25
// 2013/03/25
// infinite loop occurs!



This clearly shows what side-effects might this feature have.

Please, do not add another badly designed feature and revert it before 5.5
gets released.


[1] http://marc.info/?l=php-internalsm=136135370215794w=2


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



[PHP-BUG] Bug #63762 [NEW]: Sigsegv when Exception::$trace is changed by user

2012-12-13 Thread bugs dot php dot net at majkl578 dot cz
From: bugs dot php dot net at majkl578 dot cz
Operating system: Linux
PHP version:  5.4.9
Package:  Reproducible crash
Bug Type: Bug
Bug description:Sigsegv when Exception::$trace is changed by user

Description:

Segmentation fault occurs when calling Exception::getTraceAsString() after
Exception::$trace has been changed by reflection to a value PHP doesn't
understand.

Test script:
---
$e = new Exception();

$ref = new ReflectionProperty($e, 'trace');
$ref-setAccessible(TRUE);
$ref-setValue($e, array(NULL));

var_dump($e-getTraceAsString());

Expected result:

an error / trace converted using fallback mode (e.g. var_dump) / nothing

Actual result:
--
SIGSEGV

backtrace:
#0  0x00a20c30 in _zend_is_inconsistent (ht=0x0, file=0x10792f8
/data/build/php/5.4/php-5.4.9/Zend/zend_hash.c, line=919) at
/data/build/php/5.4/php-5.4.9/Zend/zend_hash.c:54
#1  0x00a237cc in zend_hash_find (ht=0x0, arKey=0x107c10d file,
nKeyLength=5, pData=0x7fffa558) at
/data/build/php/5.4/php-5.4.9/Zend/zend_hash.c:919
#2  0x00a32fcc in _build_trace_string (frame=0x77fb4330,
num_args=3, args=0x7fffa5f8, hash_key=0x7fffa5e0) at
/data/build/php/5.4/php-5.4.9/Zend/zend_exceptions.c:472
#3  0x00a231ac in zend_hash_apply_with_arguments
(ht=0x77fb41e0, apply_func=0xa32daa _build_trace_string, num_args=3)
at /data/build/php/5.4/php-5.4.9/Zend/zend_hash.c:772
#4  0x00a335e4 in zim_exception_getTraceAsString (ht=0,
return_value=0x77fb43b8, return_value_ptr=0x0, this_ptr=0x77fb27e8,
return_value_used=1)
at /data/build/php/5.4/php-5.4.9/Zend/zend_exceptions.c:515
#5  0x00a4f4c7 in zend_do_fcall_common_helper_SPEC
(execute_data=0x77f7c0e8) at
/data/build/php/5.4/php-5.4.9/Zend/zend_vm_execute.h:642
#6  0x00a50370 in ZEND_DO_FCALL_BY_NAME_SPEC_HANDLER
(execute_data=0x77f7c0e8) at
/data/build/php/5.4/php-5.4.9/Zend/zend_vm_execute.h:752
#7  0x00a4de96 in execute (op_array=0x77fb3680) at
/data/build/php/5.4/php-5.4.9/Zend/zend_vm_execute.h:410
#8  0x00a118c1 in zend_execute_scripts (type=8, retval=0x0,
file_count=3) at /data/build/php/5.4/php-5.4.9/Zend/zend.c:1309
#9  0x00988cb0 in php_execute_script (primary_file=0x7fffdfd0)
at /data/build/php/5.4/php-5.4.9/main/main.c:2482
#10 0x00b57db2 in do_cli (argc=2, argv=0x7fffe378) at
/data/build/php/5.4/php-5.4.9/sapi/cli/php_cli.c:988
#11 0x00b58d6d in main (argc=2, argv=0x7fffe378) at
/data/build/php/5.4/php-5.4.9/sapi/cli/php_cli.c:1364

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



[PHP-BUG] Bug #63173 [NEW]: Crash when invoking invalid callback

2012-09-27 Thread bugs dot php dot net at majkl578 dot cz
From: bugs dot php dot net at majkl578 dot cz
Operating system: Linux  Windows
PHP version:  5.4.7
Package:  Reproducible crash
Bug Type: Bug
Bug description:Crash when invoking invalid callback

Description:

PHP crashes when the callback (defined as an array) is invalid.

Test script:
---
$foo = [
1 = 0,
2 = 0,
];

$foo();

Expected result:

PHP Fatal error

Actual result:
--
Segmentation fault; backtrace:

Program received signal SIGSEGV, Segmentation fault.
0x00a53ddf in ZEND_INIT_FCALL_BY_NAME_SPEC_CV_HANDLER
(execute_data=0x77f740e8) at
/storage/build/php/5.4/php-5.4.7/Zend/zend_vm_execute.h:1922
1922if (Z_TYPE_PP(obj) != IS_STRING  
Z_TYPE_PP(obj) != IS_OBJECT) {
(gdb) bt
#0  0x00a53ddf in ZEND_INIT_FCALL_BY_NAME_SPEC_CV_HANDLER
(execute_data=0x77f740e8) at
/storage/build/php/5.4/php-5.4.7/Zend/zend_vm_execute.h:1922
#1  0x00a4cb52 in execute (op_array=0x77fab698) at
/storage/build/php/5.4/php-5.4.7/Zend/zend_vm_execute.h:410
#2  0x00a1064a in zend_execute_scripts (type=8, retval=0x0,
file_count=3) at /storage/build/php/5.4/php-5.4.7/Zend/zend.c:1286
#3  0x00987c90 in php_execute_script (primary_file=0x7fffdfc0)
at /storage/build/php/5.4/php-5.4.7/main/main.c:2473
#4  0x00b569ea in do_cli (argc=2, argv=0x7fffe368) at
/storage/build/php/5.4/php-5.4.7/sapi/cli/php_cli.c:988
#5  0x00b579a5 in main (argc=2, argv=0x7fffe368) at
/storage/build/php/5.4/php-5.4.7/sapi/cli/php_cli.c:1364

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



[PHP-BUG] Bug #62631 [NEW]: Malformed error messages (contain invalid characters)

2012-07-21 Thread bugs dot php dot net at majkl578 dot cz
From: bugs dot php dot net at majkl578 dot cz
Operating system: Debian
PHP version:  5.4.5
Package:  Scripting Engine problem
Bug Type: Bug
Bug description:Malformed error messages (contain invalid characters)

Description:

After running a test script below, CLI SAPI correctly outputs an expected
error message, but FPM SAPI (at least) doesn't. The error message contains
some invalid characters after the class name. Also the name of class 
method are completely missing in the message.
I also attached an url-encoded version (to preserve invalid characters) of
the message caught by error_get_last() in a shutdown handler.

Test script:
---
?php

$foo = new stdClass();
echo $foo-bar();

Expected result:

Fatal error: Call to undefined method stdClass::bar() in /www/temp.php on
line 10

Actual result:
--
Fatal error: in /www/temp.php on line 10



URL-encoded version of the error message:
Fatal+Error+Call+to+undefined+method+stdClass%E0%08K%B4c%F0%CB%DB%0C%3A%3Abar()

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



Bug #62631 [Fbk-Opn]: Malformed error messages (contain invalid characters)

2012-07-21 Thread bugs dot php dot net at majkl578 dot cz
Edit report at https://bugs.php.net/bug.php?id=62631edit=1

 ID: 62631
 User updated by:bugs dot php dot net at majkl578 dot cz
 Reported by:bugs dot php dot net at majkl578 dot cz
 Summary:Malformed error messages (contain invalid
 characters)
-Status: Feedback
+Status: Open
 Type:   Bug
 Package:Scripting Engine problem
 Operating System:   Debian
 PHP Version:5.4.5
 Block user comment: N
 Private report: N

 New Comment:

Yes, 3.1.11-dev. After updating to 3.1.11 release, the problem seems to be gone.


Previous Comments:

[2012-07-22 03:13:00] ras...@php.net

Are you using APC? If so, which version?


[2012-07-22 03:09:19] bugs dot php dot net at majkl578 dot cz

Description:

After running a test script below, CLI SAPI correctly outputs an expected error 
message, but FPM SAPI (at least) doesn't. The error message contains some 
invalid characters after the class name. Also the name of class  method are 
completely missing in the message.
I also attached an url-encoded version (to preserve invalid characters) of the 
message caught by error_get_last() in a shutdown handler.

Test script:
---
?php

$foo = new stdClass();
echo $foo-bar();

Expected result:

Fatal error: Call to undefined method stdClass::bar() in /www/temp.php on line 
10

Actual result:
--
Fatal error: in /www/temp.php on line 10



URL-encoded version of the error message:
Fatal+Error+Call+to+undefined+method+stdClass%E0%08K%B4c%F0%CB%DB%0C%3A%3Abar()






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