#41338 [NEW]: ceil() gives strange results

2007-05-09 Thread kjarli at gmail dot com
From: kjarli at gmail dot com
Operating system: Windows vista
PHP version:  5.2.2
PHP Bug Type: Math related
Bug description:  ceil() gives strange results

Description:

when creating formulas, i encountered a strange bug:
this is the basic forumula:
ceil(user_hp * 1.1)

when user_hp = 100 you get the following formula

ceil(100*(110/100)) in my script.

this will result 111 instead of 110


Reproduce code:
---
?php
$lol1 = ceil(100 * (110 / 100));
$lol2 = ceil(100 * 1.1);
$lol3 = ceil(110);
$lol4 = ceil(110.0);

echo $lol1;
? 
br /
?php
echo $lol2;
? 
br /
?php
echo $lol3;
? 
br /
?php
echo $lol4;
?

Expected result:

110
110
110
110


Actual result:
--
111
111
110
110

-- 
Edit bug report at http://bugs.php.net/?id=41338edit=1
-- 
Try a CVS snapshot (PHP 4.4): 
http://bugs.php.net/fix.php?id=41338r=trysnapshot44
Try a CVS snapshot (PHP 5.2): 
http://bugs.php.net/fix.php?id=41338r=trysnapshot52
Try a CVS snapshot (PHP 6.0): 
http://bugs.php.net/fix.php?id=41338r=trysnapshot60
Fixed in CVS: http://bugs.php.net/fix.php?id=41338r=fixedcvs
Fixed in release: 
http://bugs.php.net/fix.php?id=41338r=alreadyfixed
Need backtrace:   http://bugs.php.net/fix.php?id=41338r=needtrace
Need Reproduce Script:http://bugs.php.net/fix.php?id=41338r=needscript
Try newer version:http://bugs.php.net/fix.php?id=41338r=oldversion
Not developer issue:  http://bugs.php.net/fix.php?id=41338r=support
Expected behavior:http://bugs.php.net/fix.php?id=41338r=notwrong
Not enough info:  
http://bugs.php.net/fix.php?id=41338r=notenoughinfo
Submitted twice:  
http://bugs.php.net/fix.php?id=41338r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=41338r=globals
PHP 3 support discontinued:   http://bugs.php.net/fix.php?id=41338r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=41338r=dst
IIS Stability:http://bugs.php.net/fix.php?id=41338r=isapi
Install GNU Sed:  http://bugs.php.net/fix.php?id=41338r=gnused
Floating point limitations:   http://bugs.php.net/fix.php?id=41338r=float
No Zend Extensions:   http://bugs.php.net/fix.php?id=41338r=nozend
MySQL Configuration Error:http://bugs.php.net/fix.php?id=41338r=mysqlcfg


#43456 [NEW]: forcing type of variable in class

2007-11-29 Thread kjarli at gmail dot com
From: kjarli at gmail dot com
Operating system: 
PHP version:  5.2.5
PHP Bug Type: Feature/Change Request
Bug description:  forcing type of variable in class

Description:

Why not adding something like this in classes:

public $array:Array;
private $bool:Bool = false;
protected $number:Number = 40;
var $string:String = 'a text';

This is like forcing a variable into a bool, array, number etc.
This should be pure for classes only.
Assigning an array value to like a :Number, will cause a notice error.

This is usefull for 
1. Debugging
2. accessing public values
3. If you are working with more than 1 person, your class won't get messed
up.
4. if you use like :Number, and you insert '10', it can force it into a
number.


-- 
Edit bug report at http://bugs.php.net/?id=43456edit=1
-- 
Try a CVS snapshot (PHP 4.4): 
http://bugs.php.net/fix.php?id=43456r=trysnapshot44
Try a CVS snapshot (PHP 5.2): 
http://bugs.php.net/fix.php?id=43456r=trysnapshot52
Try a CVS snapshot (PHP 5.3): 
http://bugs.php.net/fix.php?id=43456r=trysnapshot53
Try a CVS snapshot (PHP 6.0): 
http://bugs.php.net/fix.php?id=43456r=trysnapshot60
Fixed in CVS: http://bugs.php.net/fix.php?id=43456r=fixedcvs
Fixed in release: 
http://bugs.php.net/fix.php?id=43456r=alreadyfixed
Need backtrace:   http://bugs.php.net/fix.php?id=43456r=needtrace
Need Reproduce Script:http://bugs.php.net/fix.php?id=43456r=needscript
Try newer version:http://bugs.php.net/fix.php?id=43456r=oldversion
Not developer issue:  http://bugs.php.net/fix.php?id=43456r=support
Expected behavior:http://bugs.php.net/fix.php?id=43456r=notwrong
Not enough info:  
http://bugs.php.net/fix.php?id=43456r=notenoughinfo
Submitted twice:  
http://bugs.php.net/fix.php?id=43456r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=43456r=globals
PHP 3 support discontinued:   http://bugs.php.net/fix.php?id=43456r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=43456r=dst
IIS Stability:http://bugs.php.net/fix.php?id=43456r=isapi
Install GNU Sed:  http://bugs.php.net/fix.php?id=43456r=gnused
Floating point limitations:   http://bugs.php.net/fix.php?id=43456r=float
No Zend Extensions:   http://bugs.php.net/fix.php?id=43456r=nozend
MySQL Configuration Error:http://bugs.php.net/fix.php?id=43456r=mysqlcfg


#46240 [NEW]: Build in foreach else support

2008-10-06 Thread kjarli at gmail dot com
From: kjarli at gmail dot com
Operating system: *
PHP version:  5.2.6
PHP Bug Type: Feature/Change Request
Bug description:  Build in foreach else support

Description:

Each time you want to foreach an array, you first have to check with 
a count or empty if you want to give a message or w/e to notify there 
is no entry to an array (or object if implements like iterator).

If possible add a else option to foreach.




Reproduce code:
---
?php // old style
if(count($myArray)  0) {
foreach($myArray as $key = $value) {
}
}

//new style

foreach($myArray as $key = $value) {
} else {
   // empty array/object
}
(kinda like how smarty implements it)


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



#44839 [NEW]: custom timer class gives incorrect time with sleep(1);

2008-04-26 Thread kjarli at gmail dot com
From: kjarli at gmail dot com
Operating system: windows xp media center
PHP version:  5.2.5
PHP Bug Type: Unknown/Other Function
Bug description:  custom timer class gives incorrect time with sleep(1);

Description:

When I tried to benchmark my type casting tests, I found out I was getting
very, very low numbers. So I added sleep(1);
The result was nothing I expected.

Reproduce code:
---
All needed provided in: http://pastebin.org/32109

Expected result:

To see a time of about 1.00[0-9]* seconds.

Actual result:
--
about 90% of the time, the number of seconds is 0.999[0-9]*

Very wierd since I used sleep(1);

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



#45390 [NEW]: file_exists probably does not use custom include paths

2008-06-28 Thread kjarli at gmail dot com
From: kjarli at gmail dot com
Operating system: Windows xp sp3
PHP version:  5.2.6
PHP Bug Type: *Directory/Filesystem functions
Bug description:  file_exists probably does not use custom include paths

Description:

Using some custom include paths does probably not effect file_exists

Reproduce code:
---
?php
// stripped down code of that what I'm using
// create a file: $rootPath/library/Berg/file.php you want to check

// this below is $rootPath/application/bootstrap.php
$rootPath = dirname(dirname(__FILE__)) . DIRECTORY_SEPARATOR;

set_include_path($rootPath . 'library' . PATH_SEPARATOR .
 get_include_path());

var_dump(file_exists('Berg/file.php')) . 'br /'; // result false
var_dump(file_exists($rootPath . '/library/file.php')) // result true

require('Berg/file.php'); // works
require($rootPath . '/library/file.php'); // works

?

Expected result:

I expect both var_dumps to return true

Actual result:
--
The one using the include path (or actually does not) gives false instead
of true.

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



#45390 [Opn]: file_exists probably does not use custom include paths

2008-06-28 Thread kjarli at gmail dot com
 ID:   45390
 User updated by:  kjarli at gmail dot com
 Reported By:  kjarli at gmail dot com
 Status:   Open
 Bug Type: *Directory/Filesystem functions
 Operating System: Windows xp sp3
 PHP Version:  5.2.6
 New Comment:

I seem to have made a type error when submitting:
var_dump(file_exists($rootPath . '/library/file.php')) // result true

is supposed to be

var_dump(file_exists($rootPath . '/library/Berg/file.php')) // result
true

Sorry for the confusing.


Previous Comments:


[2008-06-28 22:31:46] kjarli at gmail dot com

Description:

Using some custom include paths does probably not effect file_exists

Reproduce code:
---
?php
// stripped down code of that what I'm using
// create a file: $rootPath/library/Berg/file.php you want to check

// this below is $rootPath/application/bootstrap.php
$rootPath = dirname(dirname(__FILE__)) . DIRECTORY_SEPARATOR;

set_include_path($rootPath . 'library' . PATH_SEPARATOR .
 get_include_path());

var_dump(file_exists('Berg/file.php')) . 'br /'; // result false
var_dump(file_exists($rootPath . '/library/file.php')) // result true

require('Berg/file.php'); // works
require($rootPath . '/library/file.php'); // works

?

Expected result:

I expect both var_dumps to return true

Actual result:
--
The one using the include path (or actually does not) gives false
instead of true.





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



#45390 [Opn]: file_exists probably does not use custom include paths

2008-06-29 Thread kjarli at gmail dot com
 ID:   45390
 User updated by:  kjarli at gmail dot com
 Reported By:  kjarli at gmail dot com
 Status:   Open
 Bug Type: *Directory/Filesystem functions
 Operating System: Windows xp sp3
 PHP Version:  5.2.6
 New Comment:

Well, maybe it becomes time that it does :)


Previous Comments:


[2008-06-29 02:22:15] crrodriguez at suse dot de

file_exists() does not use include_path, that's expected behaviuor.



[2008-06-28 22:35:33] kjarli at gmail dot com

I seem to have made a type error when submitting:
var_dump(file_exists($rootPath . '/library/file.php')) // result true

is supposed to be

var_dump(file_exists($rootPath . '/library/Berg/file.php')) // result
true

Sorry for the confusing.



[2008-06-28 22:31:46] kjarli at gmail dot com

Description:

Using some custom include paths does probably not effect file_exists

Reproduce code:
---
?php
// stripped down code of that what I'm using
// create a file: $rootPath/library/Berg/file.php you want to check

// this below is $rootPath/application/bootstrap.php
$rootPath = dirname(dirname(__FILE__)) . DIRECTORY_SEPARATOR;

set_include_path($rootPath . 'library' . PATH_SEPARATOR .
 get_include_path());

var_dump(file_exists('Berg/file.php')) . 'br /'; // result false
var_dump(file_exists($rootPath . '/library/file.php')) // result true

require('Berg/file.php'); // works
require($rootPath . '/library/file.php'); // works

?

Expected result:

I expect both var_dumps to return true

Actual result:
--
The one using the include path (or actually does not) gives false
instead of true.





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



[PHP-BUG] Req #51373 [NEW]: remove or change the 'function' in classes

2010-03-23 Thread kjarli at gmail dot com
From: 
Operating system: 
PHP version:  Irrelevant
Package:  Unknown/Other Function
Bug Type: Feature/Change Request
Bug description:remove or change the 'function' in classes

Description:

The function keyword is pretty deprecated in php atm. If you got a function
inside 

a class people always refer to it as a 'method' and not a function. Besides
that, 

there is actually no need for that keyword... 

class foo {

  public function foobar() {}

}

Is actually the same as:



class foo {

  public foobar() {}

}



Should not be hard to understand that it's a function or method...



I propose to either change the keyword to method or remove it completely

Test script:
---
?php

class foo {

  // old

  public function foobar() {}



  // suggestion 0

  public method foobar() {}



  // suggestion 1

  public foobar() {}

}


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



Bug #29206 [Com]: DOMDocument::LoadXML: Strict Standards: DOMDocument::loadXML(); is not static

2012-10-11 Thread kjarli at gmail dot com
Edit report at https://bugs.php.net/bug.php?id=29206edit=1

 ID: 29206
 Comment by: kjarli at gmail dot com
 Reported by:tommy at vandervorst-bs dot nl
 Summary:DOMDocument::LoadXML: Strict Standards:
 DOMDocument::loadXML(); is not static
 Status: Not a bug
 Type:   Bug
 Package:DOM XML related
 Operating System:   Windows Server 2003 Standard
 PHP Version:5.0.0
 Block user comment: N
 Private report: N

 New Comment:

DOMDocument::load has exactly the same problem. Either allow it or disallow it 
but do not give a warning if you use it even tho the documentation states it's 
allowed.


Previous Comments:

[2012-04-15 14:37:23] hanskrentel at yahoo dot de

In PHP 5.3.10 Windows I have the problem that it's giving an error.

In my eyes it does not violate strict standards as the PHP documentation for 
that 
function states that this function can be called statically as well.

Could this be reviewed?


[2006-01-10 01:32:02] nfor...@php.net

Surely the error message here is misleading. These functions/methods are 
clearly marked with ALLOW_STATIC... they definitely should not throw any sort 
of notice.

Here's a patch to eliminate the message completely:
http://noel.dotgeek.org/allow_static.patch



[2004-07-16 12:43:39] rricha...@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

This is not a pure static method as it is really an object method that is also 
allowed to be called statically, so under E_STRICT, that non-fatal message is 
issued.
add $d-saveXML() and you will see the document was loaded.


[2004-07-16 11:56:34] tommy at vandervorst-bs dot nl

Description:

The following code:

$d = DOMDocument::loadXML(somexmlhere/here/xml/some);

works perfectly well, but when setting PHP to report E_STRICT warnings:

error_reporting(E_ALL|E_STRICT);

It says:

Strict Standards: Non-static method DOMDocument::loadXML() should not be called 
statically in [some script] on line [some line]

which I think is incorrect, since DOMDocument::loadXML is (even according to 
the manual, http://nl2.php.net/manual/en/function.dom-domdocument-loadxml.php) 
a static function.

Reproduce code:
---
?php

error_reporting(E_ALL|E_STRICT);
$d = DOMDocument::loadXML(somexmlhere/here/xml/some);

?

Expected result:

No error, this code is (in my eyes) perfectly valid.

Actual result:
--
Strict Standards: Non-static method DOMDocument::loadXML() should not be called 
statically in [some script] on line [some line]






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


Req #26411 [Com]: while {} else {}

2013-02-04 Thread kjarli at gmail dot com
Edit report at https://bugs.php.net/bug.php?id=26411edit=1

 ID: 26411
 Comment by: kjarli at gmail dot com
 Reported by:php at bellytime dot com
 Summary:while {} else {}
 Status: Open
 Type:   Feature/Change Request
 Package:Scripting Engine problem
 Operating System:   *
 PHP Version:*
 Block user comment: N
 Private report: N

 New Comment:

I don't really see a problem why not to implement this
?php

while(!true) {
  // do something
} else[if[...]] {
  // nothing to do
}


//Could internally be translated to:

$looped = false;
while(!true) { 
  $looped = true;
  // do something
}

if(!$looped) {
  // nothing to do
}

?


Previous Comments:

[2012-08-23 17:09:14] bensor987 at neuf dot fr

I would like to go further in that way : iterated. iterated would be parsed 
if there has been at least 1 iteration in the loop.
?php
...
// Usual Case
$array_raw = SomeClass::getAll( $dbconn );
$cnt_raw = count( $array_raw );

$arr_output = array();

for ( $i = 0; $i  $cnt_raw; $i++ ) {
$arr_output[] = $array_raw[$i]-id . ' - ' . $array_raw[$i]-label;
}
if ( $cnt_raw  0 ){
echo some_function( $arr_output );
} else {
echo 'Nothing to display';
}
...
?

?php
...
// Shorter, faster, lighter
$array_raw = SomeClass::getAll( $dbconn );
$cnt_raw = count( $array_raw );

$arr_output = array();

for ( $i = 0; $i  $cnt_raw; $i++ ) {
$arr_output[] = $array_raw[$i]-id . ' - ' . $array_raw[$i]-label;
} iterated {
echo some_function( $arr_output );
} none {
echo 'Nothing to display';
}
...
?


[2012-08-22 17:36:01] bensor987 at neuf dot fr

I understand your opinion. You want to make the else keyword usable only when 
false is encountered, like in if...else. I didn't think about this.

In that case, let's use another keyword, because this syntax is an excellent 
idea.

Why not this ? 

?php
while ($row = mysql_fetch_assoc($result)) {
   print 'Here is a result';
   ...
} none {
   print 'No results found';
}
?


[2012-08-22 17:05:05] ras...@php.net

It's not that simple. Loops are repeatedly evaluated conditions. It isn't clear 
whether adding an else clause would only apply to the first evaluation or also 
subsequent ones.


[2012-08-22 16:46:52] bensor987 at neuf dot fr

no such syntax in other languageswhat do you mean ? PHP doesn't have the 
right innovate ? 

I see plenty of cases I would use this syntax. The elses would be triggered 
if there hasn't been any iteration in the loop. It means : less variables to 
use (so less memory usage), less code lines, etc... 

There are only advantages to this syntax (and it's pretty simple to understand, 
no KISS violation here). It's not because it isn't done by other languages that 
we shouldn't implement it.


[2012-08-22 10:44:30] ni...@php.net

Python has an else for loops, but it means something completely different.




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


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


[PHP-BUG] Req #65004 [NEW]: SoapServer::handle() should return instead of print

2013-06-10 Thread kjarli at gmail dot com
From: kjarli at gmail dot com
Operating system: *
PHP version:  5.3.26
Package:  SOAP related
Bug Type: Feature/Change Request
Bug description:SoapServer::handle() should return instead of print

Description:

Case: I'm using a framework with MVC, symfony2. I'm using SOAP for 1 part
of the 
system to receive notifications by an external party. Using
SoapServer::handle() 
requires me to hack/cheat on the MVC pattern. 

Say I want to use the normal route in any framework, thus assign my 
SoapServer::handle() to a variable in the output, that's impossible because
it's 
send to the browser straight away. This breaks several things:

- The framework using Output Buffering 
- PHPUnit using Output Buffering.

Soap feels like php 4.0 and it's time to update it. My feature request:
Have 
SoapServer::handle() return the string instead or make a new method that
does 
this.

Test script:
---
$classmap = array(...);
$server = new \SoapServer(
__DIR__ . '/../Resources/config/Notification.wsdl',
array('classmap' = $this-classmap)
);


$server-setObject($this-get('mysoap.methods'));
$response = new Response();
$response-headers-set('Content-Type', 'text/xml; charset=ISO-8859-1');

// Sadly handle() prints the output rather than returning it -.-
ob_start();
$server-handle();
$content = ob_get_length()  0
? ob_get_clean()
: '?xml version=1.0 encoding=UTF-8?rooterrorNo soap response
generated/error/root';
$response-setContent($content);


Expected result:

.

Actual result:
--
Would be so much easier if I could just do:

[...]

$response = new Response();
$response-headers-set('Content-Type', 'text/xml; charset=ISO-8859-1');
$response-setContent($server-handle());

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



Req #65004 [Com]: SoapServer::handle() should return instead of print

2013-09-04 Thread kjarli at gmail dot com
Edit report at https://bugs.php.net/bug.php?id=65004edit=1

 ID: 65004
 Comment by: kjarli at gmail dot com
 Reported by:kjarli at gmail dot com
 Summary:SoapServer::handle() should return instead of print
 Status: Open
 Type:   Feature/Change Request
 Package:SOAP related
 Operating System:   *
 PHP Version:5.3.26
 Block user comment: N
 Private report: N

 New Comment:

Yes, it's possible somewhat like that, but it still requires me to use ob_* 
functions. ob_* functions bug unit-tests and pretty much everything else, they 
are very annoying to use and they conflict with a framework output buffer.

It only makes sense if it would return instead of print so that I can do with 
the 
content what ever I want.


Previous Comments:

[2013-09-04 07:04:01] guillaume dot lintot at laposte dot net

You can do it this way

?php
   class \SoapServer2 extends \SoapServer{
  public function handle($soap_request = null){
 ob_start();
 parent::handle($soap_request);
 $output = ob_get_contents();
 ob_end_clean();
 return $output;
  }
   }

   $server = new \SoapServer2(
  __DIR__ . '/../Resources/config/Notification.wsdl',
  array('classmap' = $this-classmap));
   // ...


[2013-06-10 12:42:29] kjarli at gmail dot com

Description:

Case: I'm using a framework with MVC, symfony2. I'm using SOAP for 1 part of 
the 
system to receive notifications by an external party. Using 
SoapServer::handle() 
requires me to hack/cheat on the MVC pattern. 

Say I want to use the normal route in any framework, thus assign my 
SoapServer::handle() to a variable in the output, that's impossible because 
it's 
send to the browser straight away. This breaks several things:

- The framework using Output Buffering 
- PHPUnit using Output Buffering.

Soap feels like php 4.0 and it's time to update it. My feature request: Have 
SoapServer::handle() return the string instead or make a new method that does 
this.

Test script:
---
$classmap = array(...);
$server = new \SoapServer(
__DIR__ . '/../Resources/config/Notification.wsdl',
array('classmap' = $this-classmap)
);


$server-setObject($this-get('mysoap.methods'));
$response = new Response();
$response-headers-set('Content-Type', 'text/xml; charset=ISO-8859-1');

// Sadly handle() prints the output rather than returning it -.-
ob_start();
$server-handle();
$content = ob_get_length()  0
? ob_get_clean()
: '?xml version=1.0 encoding=UTF-8?rooterrorNo soap response 
generated/error/root';
$response-setContent($content);


Expected result:

.

Actual result:
--
Would be so much easier if I could just do:

[...]

$response = new Response();
$response-headers-set('Content-Type', 'text/xml; charset=ISO-8859-1');
$response-setContent($server-handle());






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