]> granicus.if.org Git - php/commitdiff
Merge branch 'pull-request/54'
authorStanislav Malyshev <stas@php.net>
Thu, 24 May 2012 19:17:07 +0000 (14:17 -0500)
committerStanislav Malyshev <stas@php.net>
Thu, 24 May 2012 19:18:12 +0000 (14:18 -0500)
* pull-request/54:
  Allow arbitrary expressions for empty()

    This change is as per RFC https://wiki.php.net/rfc/empty_isset_exprs.

    The change allows passing the result of function calls and other
    expressions to the empty() language construct. This is accomplished by
    simply rewriting empty(expr) to !expr.

    The change does not affect the suppression of errors when using empty()
    on variables. empty($undefinedVar) will continue not to throw errors.
    When an expression is used inside empty() on the other hand, errors will
    not be suppressed. Thus empty($undefinedVar + $somethingElse) *will*
    throw a notice.

    The change also does not make empty() into a real function, so using
    'empty' as a callback is still not possible.

    In addition to the empty() changes the commit adds nicer error messages
    when isset() is used on function call results or other expressions.

1  2 
UPGRADING
Zend/zend_compile.c

diff --cc UPGRADING
index 44f75561d7893ec7706729b0421005aed3879476,0fae6147db2c8af516cd5d98941d4af245daa4fb..73cf10641fc51b3b8aa5a3f2a730c17e7a1bc6c5
+++ b/UPGRADING
@@@ -51,15 -54,7 +54,15 @@@ PHP X.Y UPGRADE NOTE
    - Implemented format character "Z": NUL-padded string
    - "a" now does not remove trailing NUL characters on unpack() anymore
    - "A" will now strip all trailing ASCII whitespace on unpack() (it used to
-     remove only trailing spaces.
 -    remove only trailing spaces)
++    remove only trailing spaces).
 +- MessageFormatter::format() and related functions now accepted named arguments
 +  and mixed numeric/named arguments in ICU 4.8+.
 +- MessageFormatter::format() and related functions now don't error out when
 +  an insufficient argument count is provided. Instead, the placeholders will
 +  remain unsubstituted.
 +- MessageFormatter::parse() and MessageFormat::format() (and their static
 +  equivalents) now don't throw away better than second precision in the
 +  arguments.
  
  ========================================
  5. New Functions
Simple merge