[PHP-CVS] com php-src: Allow the ldap extension to be compiled with Oracle's LDAP implementation, if desired. Note the implementations differ so you will see different ldap behavior.: ext/ldap/config

2013-10-04 Thread Christopher Jones
Commit:5bc377457e155ceaddd27a536467a4d353fdcd4f
Author:Christopher Jones  Fri, 4 Oct 2013 15:50:16 
-0700
Parents:   fb6f5d2e2d44e205cdde7320a7674e43fdd7980b
Branches:  PHP-5.5 master

Link:   
http://git.php.net/?p=php-src.git;a=commitdiff;h=5bc377457e155ceaddd27a536467a4d353fdcd4f

Log:
Allow the ldap extension to be compiled with Oracle's LDAP
implementation, if desired.  Note the implementations differ so you
will see different ldap behavior.

The patch allows configuration similar to:
--with-ldap=$HOME/instantclient --with-oci8=instantclient,$HOME/instantclient

The patch doesn't support configuration similar to:
--with-ldap --with-oci8=instantclient,$HOME/instantclient
since this would try and mix the default LDAP and Oracle LDAP
implementations.

This patch closes out bug #61450 and the associated github PR.

Regardless of this patch, my recommended way to install both OCI8 and
ldap extensions is to statically configure PHP with ldap, and then add
OCI8 as a shared extension from PECL.

Bugs:
https://bugs.php.net/61450

Changed paths:
  M  ext/ldap/config.m4
  M  ext/ldap/ldap.c

diff --git a/ext/ldap/config.m4 b/ext/ldap/config.m4
index 3c8e23e..2804cd5 100644
--- a/ext/ldap/config.m4
+++ b/ext/ldap/config.m4
@@ -15,6 +15,28 @@ AC_DEFUN([PHP_LDAP_CHECKS], [
 LDAP_DIR=$1
 LDAP_INCDIR=$1/ldap/public
 LDAP_LIBDIR=$1/$PHP_LIBDIR
+  else
+
+dnl Find Oracle Instant Client RPM header location corresponding to the 
given lib path e.g. for --with-ldap=/usr/lib/oracle/12.1/client64/lib
+AC_CHECK_SIZEOF(long int, 4)
+if test "$ac_cv_sizeof_long_int" = "4"; then
+  PHP_OCI8_IC_LIBDIR_SUFFIX=""
+else
+  PHP_OCI8_IC_LIBDIR_SUFFIX=64
+fi
+OCISDKRPMINC=`echo "$1" | $SED -e 
's!^/usr/lib/oracle/\(.*\)/client\('${PHP_OCI8_IC_LIBDIR_SUFFIX}'\)*/lib[/]*$!/usr/include/oracle/\1/client\2!'`
+
+dnl Check for Oracle Instant Client RPM install
+if test -f $OCISDKRPMINC/ldap.h; then
+  LDAP_DIR=$1
+  LDAP_INCDIR=$OCISDKRPMINC
+  LDAP_LIBDIR=$1
+dnl Check for Oracle Instant Client ZIP install
+elif test -f $1/sdk/include/ldap.h; then
+  LDAP_DIR=$1
+  LDAP_INCDIR=$1/sdk/include
+  LDAP_LIBDIR=$1
+fi
   fi
 ])
 
@@ -143,12 +165,21 @@ if test "$PHP_LDAP" != "no"; then
 PHP_ADD_LIBRARY_WITH_PATH(umich_lber, $LDAP_LIBDIR, LDAP_SHARED_LIBADD)
 PHP_ADD_LIBRARY_WITH_PATH(umich_ldap, $LDAP_LIBDIR, LDAP_SHARED_LIBADD)
 
-  elif test -f $LDAP_LIBDIR/libclntsh.$SHLIB_SUFFIX_NAME; then
+  elif test -f $LDAP_LIBDIR/libclntsh.$SHLIB_SUFFIX_NAME.12.1; then
 PHP_ADD_LIBRARY_WITH_PATH(clntsh, $LDAP_LIBDIR, LDAP_SHARED_LIBADD)
 AC_DEFINE(HAVE_ORALDAP,1,[ ])
-if test -f $LDAP_LIBDIR/libclntsh.$SHLIB_SUFFIX_NAME.10.1; then
-  AC_DEFINE(HAVE_ORALDAP_10,1,[ ])
-fi
+AC_DEFINE(HAVE_ORALDAP_12,1,[ ])
+
+  elif test -f $LDAP_LIBDIR/libclntsh.$SHLIB_SUFFIX_NAME.11.1; then
+PHP_ADD_LIBRARY_WITH_PATH(clntsh, $LDAP_LIBDIR, LDAP_SHARED_LIBADD)
+AC_DEFINE(HAVE_ORALDAP,1,[ ])
+AC_DEFINE(HAVE_ORALDAP_11,1,[ ])
+
+  elif test -f $LDAP_LIBDIR/libclntsh.$SHLIB_SUFFIX_NAME; then
+ PHP_ADD_LIBRARY_WITH_PATH(clntsh, $LDAP_LIBDIR, LDAP_SHARED_LIBADD)
+ AC_DEFINE(HAVE_ORALDAP,1,[ ])
+ AC_DEFINE(HAVE_ORALDAP_10,1,[ ])
+
   else
 AC_MSG_ERROR(Cannot find ldap libraries in $LDAP_LIBDIR.)
   fi
diff --git a/ext/ldap/ldap.c b/ext/ldap/ldap.c
index 71d57d6..e95f898 100644
--- a/ext/ldap/ldap.c
+++ b/ext/ldap/ldap.c
@@ -152,7 +152,7 @@ PHP_MINIT_FUNCTION(ldap)
REGISTER_LONG_CONSTANT("LDAP_DEREF_FINDING", LDAP_DEREF_FINDING, 
CONST_PERSISTENT | CONST_CS);
REGISTER_LONG_CONSTANT("LDAP_DEREF_ALWAYS", LDAP_DEREF_ALWAYS, 
CONST_PERSISTENT | CONST_CS);
 
-#if (LDAP_API_VERSION > 2000) || HAVE_NSLDAP || HAVE_ORALDAP_10
+#if (LDAP_API_VERSION > 2000) || HAVE_NSLDAP || HAVE_ORALDAP
/* LDAP options */
REGISTER_LONG_CONSTANT("LDAP_OPT_DEREF", LDAP_OPT_DEREF, 
CONST_PERSISTENT | CONST_CS);
REGISTER_LONG_CONSTANT("LDAP_OPT_SIZELIMIT", LDAP_OPT_SIZELIMIT, 
CONST_PERSISTENT | CONST_CS);
@@ -361,7 +361,7 @@ PHP_FUNCTION(ldap_connect)
 static int _get_lderrno(LDAP *ldap)
 {
 #if !HAVE_NSLDAP
-#if LDAP_API_VERSION > 2000 || HAVE_ORALDAP_10
+#if LDAP_API_VERSION > 2000 || HAVE_ORALDAP
int lderr;
 
/* New versions of OpenLDAP do it this way */
@@ -550,7 +550,7 @@ static void php_set_opts(LDAP *ldap, int sizelimit, int 
timelimit, int deref, in
 {
/* sizelimit */
if (sizelimit > -1) {
-#if (LDAP_API_VERSION >= 2004) || HAVE_NSLDAP || HAVE_ORALDAP_10
+#if (LDAP_API_VERSION >= 2004) || HAVE_NSLDAP || HAVE_ORALDAP
ldap_get_option(ldap, LDAP_OPT_SIZELIMIT, old_sizelimit);
ldap_set_option(ldap, LDAP_OPT_SIZELIMIT, &sizelimit);
 #else
@@ -561,7 +561,7 @@ static void php_set_opts(LDAP *ldap, int sizelimit, int 
timelimit, int deref, in
 
/* timelimit */
if (timelimit > -1) {
-#if (LDAP_API_VERSION >= 2004) || HAVE_NSLD

[PHP-CVS] com php-src: Fix bug #65667: ftp_nb_continue produces segfault: NEWS ext/ftp/php_ftp.c ext/ftp/tests/ftp_nb_continue.phpt ext/ftp/tests/server.inc

2013-10-04 Thread Nikita Popov
Commit:96cc419924c38874f9e2f2e5ccf3cd0430d90f43
Author:Philip Hofstetter  Wed, 2 Oct 
2013 08:35:02 +0200
Committer: Nikita Popov   Fri, 4 Oct 2013 17:25:46 +0200
Parents:   8973390541faaadfdfc0f838421f037060188e5e
Branches:  PHP-5.4 PHP-5.5 master

Link:   
http://git.php.net/?p=php-src.git;a=commitdiff;h=96cc419924c38874f9e2f2e5ccf3cd0430d90f43

Log:
Fix bug #65667: ftp_nb_continue produces segfault

the idea behind ftp_nb_get is for it to be followed by multiple calls
to ftp_nb_continue in order to download a file piece-by-piece.

As such, it's unwise to close the stream used to write the downloaded
data to when the file hasn't been completely downloaded within the first
call to ftp_nb_get.

This regression was added in a93a462dcefd62e07963dd2da506fbb3409c88b5
and this patch restores the behavior that was seen pre-patch.

Bugs:
https://bugs.php.net/65667

Changed paths:
  M  NEWS
  M  ext/ftp/php_ftp.c
  A  ext/ftp/tests/ftp_nb_continue.phpt
  M  ext/ftp/tests/server.inc


Diff:
diff --git a/NEWS b/NEWS
index 9963714..7a7ceca 100644
--- a/NEWS
+++ b/NEWS
@@ -2,6 +2,9 @@ PHP 
   NEWS
 |||
 ?? ??? 2013, PHP 5.4.22
 
+- FTP:
+  . Fixed bug #65667 (ftp_nb_continue produces segfault). (Philip Hofstetter)
+
 - Sockets:
   . Fixed bug #65808 (the socket_connect() won't work with IPv6 address).
 (Mike)
diff --git a/ext/ftp/php_ftp.c b/ext/ftp/php_ftp.c
index da22e0b..21e13ea 100644
--- a/ext/ftp/php_ftp.c
+++ b/ext/ftp/php_ftp.c
@@ -968,7 +968,9 @@ PHP_FUNCTION(ftp_nb_get)
RETURN_LONG(PHP_FTP_FAILED);
}
 
-php_stream_close(outstream);
+   if (ret == PHP_FTP_FINISHED){
+   php_stream_close(outstream);
+   }
 
RETURN_LONG(ret);
 }
diff --git a/ext/ftp/tests/ftp_nb_continue.phpt 
b/ext/ftp/tests/ftp_nb_continue.phpt
new file mode 100644
index 000..1f70339
--- /dev/null
+++ b/ext/ftp/tests/ftp_nb_continue.phpt
@@ -0,0 +1,182 @@
+--TEST--
+Testing whether ftp_nb_continue() fetches more data
+--SKIPIF--
+
+--FILE--
+
+--CLEAN--
+
+--EXPECT--
+This is line 0 of the test data.
+This is line 1 of the test data.
+This is line 2 of the test data.
+This is line 3 of the test data.
+This is line 4 of the test data.
+This is line 5 of the test data.
+This is line 6 of the test data.
+This is line 7 of the test data.
+This is line 8 of the test data.
+This is line 9 of the test data.
+This is line 10 of the test data.
+This is line 11 of the test data.
+This is line 12 of the test data.
+This is line 13 of the test data.
+This is line 14 of the test data.
+This is line 15 of the test data.
+This is line 16 of the test data.
+This is line 17 of the test data.
+This is line 18 of the test data.
+This is line 19 of the test data.
+This is line 20 of the test data.
+This is line 21 of the test data.
+This is line 22 of the test data.
+This is line 23 of the test data.
+This is line 24 of the test data.
+This is line 25 of the test data.
+This is line 26 of the test data.
+This is line 27 of the test data.
+This is line 28 of the test data.
+This is line 29 of the test data.
+This is line 30 of the test data.
+This is line 31 of the test data.
+This is line 32 of the test data.
+This is line 33 of the test data.
+This is line 34 of the test data.
+This is line 35 of the test data.
+This is line 36 of the test data.
+This is line 37 of the test data.
+This is line 38 of the test data.
+This is line 39 of the test data.
+This is line 40 of the test data.
+This is line 41 of the test data.
+This is line 42 of the test data.
+This is line 43 of the test data.
+This is line 44 of the test data.
+This is line 45 of the test data.
+This is line 46 of the test data.
+This is line 47 of the test data.
+This is line 48 of the test data.
+This is line 49 of the test data.
+This is line 50 of the test data.
+This is line 51 of the test data.
+This is line 52 of the test data.
+This is line 53 of the test data.
+This is line 54 of the test data.
+This is line 55 of the test data.
+This is line 56 of the test data.
+This is line 57 of the test data.
+This is line 58 of the test data.
+This is line 59 of the test data.
+This is line 60 of the test data.
+This is line 61 of the test data.
+This is line 62 of the test data.
+This is line 63 of the test data.
+This is line 64 of the test data.
+This is line 65 of the test data.
+This is line 66 of the test data.
+This is line 67 of the test data.
+This is line 68 of the test data.
+This is line 69 of the test data.
+This is line 70 of the test data.
+This is line 71 of the test data.
+This is line 72 of the test data.
+This is line 73 of the test data.
+This is line 74 of the test data.
+This is line 75 of the test data.
+This is line 76 of the test data.
+This is line 77 of the test data.
+This is line 78 of the test data.
+This is line 79 of the test data.
+This is

[PHP-CVS] com php-src: Merge branch 'PHP-5.4' into PHP-5.5: ext/standard/var.c

2013-10-04 Thread Michael Wallner
Commit:d72a4d1634ff8938cf60c57132d36a79b55bbe4d
Author:Michael Wallner  Fri, 4 Oct 2013 16:17:37 +0200
Parents:   adfb5ab7ced3b0d4456680edb1766f4ad4f279d6 
8973390541faaadfdfc0f838421f037060188e5e
Branches:  PHP-5.5 master

Link:   
http://git.php.net/?p=php-src.git;a=commitdiff;h=d72a4d1634ff8938cf60c57132d36a79b55bbe4d

Log:
Merge branch 'PHP-5.4' into PHP-5.5

* PHP-5.4:
  fix bug #64146 (serialize incorrectly saving objects when they are cloned)

Bugs:
https://bugs.php.net/64146

Changed paths:
  MM  ext/standard/var.c


Diff:



--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-CVS] com php-src: Merge branch 'PHP-5.5': ext/standard/var.c

2013-10-04 Thread Michael Wallner
Commit:f72ed22749178b9d17455a308cefc523fd85109e
Author:Michael Wallner  Fri, 4 Oct 2013 16:17:46 +0200
Parents:   39022ba227af59a7ab040d7b8fa3510747920733 
d72a4d1634ff8938cf60c57132d36a79b55bbe4d
Branches:  master

Link:   
http://git.php.net/?p=php-src.git;a=commitdiff;h=f72ed22749178b9d17455a308cefc523fd85109e

Log:
Merge branch 'PHP-5.5'

* PHP-5.5:
  fix bug #64146 (serialize incorrectly saving objects when they are cloned)

Bugs:
https://bugs.php.net/64146

Changed paths:
  MM  ext/standard/var.c


Diff:



--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-CVS] com php-src: fix bug #64146 (serialize incorrectly saving objects when they are cloned): ext/standard/tests/serialize/bug64146.phpt ext/standard/var.c

2013-10-04 Thread Michael Wallner
Commit:8973390541faaadfdfc0f838421f037060188e5e
Author:Michael Wallner  Fri, 4 Oct 2013 16:16:15 +0200
Parents:   e8ae795529eff83482797dff0d1a1de7f0a84c8d
Branches:  PHP-5.4 PHP-5.5 master

Link:   
http://git.php.net/?p=php-src.git;a=commitdiff;h=8973390541faaadfdfc0f838421f037060188e5e

Log:
fix bug #64146 (serialize incorrectly saving objects when they are
cloned)

Bugs:
https://bugs.php.net/64146

Changed paths:
  A  ext/standard/tests/serialize/bug64146.phpt
  M  ext/standard/var.c


Diff:
diff --git a/ext/standard/tests/serialize/bug64146.phpt 
b/ext/standard/tests/serialize/bug64146.phpt
new file mode 100644
index 000..18ae78d
--- /dev/null
+++ b/ext/standard/tests/serialize/bug64146.phpt
@@ -0,0 +1,60 @@
+--TEST--
+Bug #64146 (serialize incorrectly saving objects when they are cloned)
+--FILE--
+a[] = new B(1);
+$this->a[] = new B(2);
+}
+}
+
+class B implements Serializable
+{
+public $b;
+
+public function __construct($c)
+{
+$this->b = new C($c);
+}
+
+public function serialize()
+{
+return serialize(clone $this->b);
+}
+
+public function unserialize($data)
+{
+$this->b = unserialize($data);
+}
+}
+
+class C
+{
+public $c;
+
+public function __construct($c)
+{
+$this->c = $c;
+}
+}
+
+$a = unserialize(serialize(new A()));
+
+print $a->a[0]->b->c . "\n";
+print $a->a[1]->b->c . "\n";
+
+?>
+Done
+--EXPECT--
+Test
+1
+2
+Done
diff --git a/ext/standard/var.c b/ext/standard/var.c
index f76a14c..f71c4a4 100644
--- a/ext/standard/var.c
+++ b/ext/standard/var.c
@@ -549,11 +549,9 @@ static inline int php_add_var_hash(HashTable *var_hash, 
zval *var, void *var_old
char id[32], *p;
register int len;
 
-   /* relies on "(long)" being a perfect hash function for data pointers,
-* however the actual identity of an object has had to be determined
-* by its object handle since 5.0. */
if ((Z_TYPE_P(var) == IS_OBJECT) && Z_OBJ_HT_P(var)->get_class_entry) {
-   p = smart_str_print_long(id + sizeof(id) - 1, (long) 
Z_OBJ_HANDLE_P(var));
+   p = smart_str_print_long(id + sizeof(id) - 1,
+   (long) zend_objects_get_address(var TSRMLS_CC));
*(--p) = 'O';
len = id + sizeof(id) - 1 - p;
} else {


--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-CVS] com php-src: such a weird hack probably helps in finding regressions in the future: ext/standard/tests/serialize/bug65806.phpt

2013-10-04 Thread Michael Wallner
Commit:e8ae795529eff83482797dff0d1a1de7f0a84c8d
Author:Michael Wallner  Fri, 4 Oct 2013 16:11:49 +0200
Parents:   f6ff3a28d60c24dea2a05344d9b7eb823f09b4e5
Branches:  PHP-5.4 PHP-5.5 master

Link:   
http://git.php.net/?p=php-src.git;a=commitdiff;h=e8ae795529eff83482797dff0d1a1de7f0a84c8d

Log:
such a weird hack probably helps in finding regressions in the future

Changed paths:
  A  ext/standard/tests/serialize/bug65806.phpt


Diff:
diff --git a/ext/standard/tests/serialize/bug65806.phpt 
b/ext/standard/tests/serialize/bug65806.phpt
new file mode 100644
index 000..19fab95
--- /dev/null
+++ b/ext/standard/tests/serialize/bug65806.phpt
@@ -0,0 +1,83 @@
+--TEST--
+Bug #65806 (unserialize fails with object which is referenced multiple times)
+--FILE--
+_obj = $obj;
+$this->_serialized = serialize($this->_obj);
+}
+public function get()
+{
+return $this->_obj;
+}
+public function __sleep()
+{
+$this->_serialized = serialize($this->_obj);
+return array(
+"\0" . __CLASS__ . "\0_serialized",
+);
+}
+public function __wakeup()
+{
+   $this->_obj = unserialize($this->_serialized);
+   }
+}
+
+echo "SCRIPT START" . PHP_EOL;
+
+$objA = new myObjA();
+$objB = new myObjB();
+$objC = new myObjC();
+
+$objB->attrA = new ArrayIterator();
+$objB->attrB = $objA;
+
+$objC->attrC = $objB;
+$objC->attrD = $objA;
+
+$list = new myList($objC);
+
+echo 'check ' . check($list->get()) . PHP_EOL;
+
+echo "start serialize/unserialize" . PHP_EOL;
+$newList = unserialize(serialize($list));
+echo "finish serialize/unserialize" . PHP_EOL;
+
+//after unserialize the property myObjC::attrD is null instead of expected 
object
+echo 'check ' . check($newList->get()) . PHP_EOL;
+
+echo "SCRIPT END" . PHP_EOL ;
+
+function check(myObjC $obj) {
+
+if (!is_object($obj->attrC)) {
+return 'failed (myObjC::attrC => ' . var_export($obj->attrC, true) . 
')';
+}
+if (!is_object($obj->attrD)) {
+return 'failed (myObjC::attrD => ' . var_export($obj->attrD, true) . 
')';
+}
+return 'successful';
+}
+?>
+--EXPECT--
+SCRIPT START
+check successful
+start serialize/unserialize
+finish serialize/unserialize
+check successful
+SCRIPT END
+


--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-CVS] com php-src: Fix bug #65821: By-ref foreach on property access of string offset segfaults: NEWS Zend/zend_compile.c Zend/zend_vm_def.h Zend/zend_vm_execute.h

2013-10-04 Thread Nikita Popov
Commit:536260f2c52af7057a657af96d991acf27c0cc86
Author:Nikita Popov  Fri, 4 Oct 2013 13:13:46 +0200
Parents:   2e2bda3508444190cb9b707dffe328a263ec60a1
Branches:  PHP-5.5 master

Link:   
http://git.php.net/?p=php-src.git;a=commitdiff;h=536260f2c52af7057a657af96d991acf27c0cc86

Log:
Fix bug #65821: By-ref foreach on property access of string offset segfaults

This removes the now unnecessary ZEND_FETCH_ADD_LOCK on the
container of a property fetch of a by-reference foreach.

Bugs:
https://bugs.php.net/65821

Changed paths:
  M  NEWS
  M  Zend/zend_compile.c
  M  Zend/zend_vm_def.h
  M  Zend/zend_vm_execute.h

diff --git a/NEWS b/NEWS
index 1b1f9c4..796f82f 100644
--- a/NEWS
+++ b/NEWS
@@ -5,6 +5,8 @@ PHP 
   NEWS
 - Core:
   . Fixed bug #64979 (Wrong behavior of static variables in closure 
generators).
 (Nikita)
+  . Fixed bug #65821 (By-ref foreach on property access of string offset
+segfaults). (Nikita)
 
 - CLI server:
   . Fixed bug #65633 (built-in server treat some http headers as
diff --git a/Zend/zend_compile.c b/Zend/zend_compile.c
index f250b2b..9008f23 100644
--- a/Zend/zend_compile.c
+++ b/Zend/zend_compile.c
@@ -1749,7 +1749,6 @@ void zend_do_begin_function_declaration(znode 
*function_token, znode *function_n
zend_op dummy_opline;
 
dummy_opline.result_type = IS_UNUSED;
-   dummy_opline.op1_type = IS_UNUSED;
 
zend_stack_push(&CG(foreach_copy_stack), (void *) 
&dummy_opline, sizeof(zend_op));
}
@@ -2662,7 +2661,7 @@ static int generate_free_switch_expr(const 
zend_switch_entry *switch_entry TSRML
opline->opcode = (switch_entry->cond.op_type == IS_TMP_VAR) ? ZEND_FREE 
: ZEND_SWITCH_FREE;
SET_NODE(opline->op1, &switch_entry->cond);
SET_UNUSED(opline->op2);
-   opline->extended_value = 0;
+
return 0;
 }
 /* }}} */
@@ -2672,7 +2671,7 @@ static int generate_free_foreach_copy(const zend_op 
*foreach_copy TSRMLS_DC) /*
zend_op *opline;
 
/* If we reach the separator then stop applying the stack */
-   if (foreach_copy->result_type == IS_UNUSED && foreach_copy->op1_type == 
IS_UNUSED) {
+   if (foreach_copy->result_type == IS_UNUSED) {
return 1;
}
 
@@ -2681,16 +2680,6 @@ static int generate_free_foreach_copy(const zend_op 
*foreach_copy TSRMLS_DC) /*
opline->opcode = (foreach_copy->result_type == IS_TMP_VAR) ? ZEND_FREE 
: ZEND_SWITCH_FREE;
COPY_NODE(opline->op1, foreach_copy->result);
SET_UNUSED(opline->op2);
-   opline->extended_value = 1;
-
-   if (foreach_copy->op1_type != IS_UNUSED) {
-   opline = get_next_op(CG(active_op_array) TSRMLS_CC);
-
-   opline->opcode = (foreach_copy->op1_type == IS_TMP_VAR) ? 
ZEND_FREE : ZEND_SWITCH_FREE;
-   COPY_NODE(opline->op1, foreach_copy->op1);
-   SET_UNUSED(opline->op2);
-   opline->extended_value = 0;
-   }
 
return 0;
 }
@@ -6227,7 +6216,6 @@ void zend_do_foreach_begin(znode *foreach_token, znode 
*open_brackets_token, zno
 {
zend_op *opline;
zend_bool is_variable;
-   zend_bool push_container = 0;
zend_op dummy_opline;
 
if (variable) {
@@ -6239,14 +6227,6 @@ void zend_do_foreach_begin(znode *foreach_token, znode 
*open_brackets_token, zno
/* save the location of FETCH_W instruction(s) */
open_brackets_token->u.op.opline_num = 
get_next_op_number(CG(active_op_array));
zend_do_end_variable_parse(array, BP_VAR_W, 0 TSRMLS_CC);
-   if (CG(active_op_array)->last > 0 &&
-   
CG(active_op_array)->opcodes[CG(active_op_array)->last-1].opcode == 
ZEND_FETCH_OBJ_W) {
-   /* Only lock the container if we are fetching from a 
real container and not $this */
-   if 
(CG(active_op_array)->opcodes[CG(active_op_array)->last-1].op1_type == IS_VAR) {
-   
CG(active_op_array)->opcodes[CG(active_op_array)->last-1].extended_value |= 
ZEND_FETCH_ADD_LOCK;
-   push_container = 1;
-   }
-   }
} else {
is_variable = 0;
open_brackets_token->u.op.opline_num = 
get_next_op_number(CG(active_op_array));
@@ -6266,11 +6246,6 @@ void zend_do_foreach_begin(znode *foreach_token, znode 
*open_brackets_token, zno
opline->extended_value = is_variable ? ZEND_FE_RESET_VARIABLE : 0;
 
COPY_NODE(dummy_opline.result, opline->result);
-   if (push_container) {
-   COPY_NODE(dummy_opline.op1, 
CG(active_op_array)->opcodes[CG(active_op_array)->last-2].op1);
-   } else {
-   dummy_opline.op1_type = IS_UNUSED;
-   }
zend_stack_push(&CG(foreach_copy_stack), (void *) &dummy_opline, 
sizeof(zend_op));
 
/* save the

[PHP-CVS] com php-src: Merge branch 'PHP-5.5': Zend/zend_compile.c Zend/zend_vm_def.h Zend/zend_vm_execute.h

2013-10-04 Thread Nikita Popov
Commit:ff46b6f6337a49d7ee07e3bdc2d4f97de4b4bf86
Author:Nikita Popov  Fri, 4 Oct 2013 13:15:45 +0200
Parents:   e13e5b17ffce68c7ea65d3410a6b4fe433135914 
536260f2c52af7057a657af96d991acf27c0cc86
Branches:  master

Link:   
http://git.php.net/?p=php-src.git;a=commitdiff;h=ff46b6f6337a49d7ee07e3bdc2d4f97de4b4bf86

Log:
Merge branch 'PHP-5.5'

Changed paths:
  MM  Zend/zend_compile.c
  MM  Zend/zend_vm_def.h
  MM  Zend/zend_vm_execute.h


Diff:



--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-CVS] com php-src: Merge branch 'PHP-5.4' into PHP-5.5: ext/xmlreader/php_xmlreader.c

2013-10-04 Thread Michael Wallner
Commit:2e2bda3508444190cb9b707dffe328a263ec60a1
Author:Michael Wallner  Fri, 4 Oct 2013 11:22:43 +0200
Parents:   92fd085ebfb4cc8256cad235a51b34b246a4c3b7 
f6ff3a28d60c24dea2a05344d9b7eb823f09b4e5
Branches:  PHP-5.5 master

Link:   
http://git.php.net/?p=php-src.git;a=commitdiff;h=2e2bda3508444190cb9b707dffe328a263ec60a1

Log:
Merge branch 'PHP-5.4' into PHP-5.5

* PHP-5.4:
  Fixed bug #64230 (XMLReader does not suppress errors)

Bugs:
https://bugs.php.net/64230

Changed paths:
  MM  ext/xmlreader/php_xmlreader.c


Diff:
diff --cc ext/xmlreader/php_xmlreader.c
index 464998c,adf2821..aae55c8
--- a/ext/xmlreader/php_xmlreader.c
+++ b/ext/xmlreader/php_xmlreader.c
@@@ -844,10 -843,9 +843,9 @@@ PHP_METHOD(xmlreader, next
if 
(xmlStrEqual(xmlTextReaderConstLocalName(intern->ptr), (xmlChar *)name)) {
RETURN_TRUE;
}
 -  retval = xmlTextReaderNext(intern->ptr); 
 +  retval = xmlTextReaderNext(intern->ptr);
}
if (retval == -1) {
-   php_error_docref(NULL TSRMLS_CC, E_WARNING, "An Error 
Occurred while reading");
RETURN_FALSE;
} else {
RETURN_BOOL(retval);


--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-CVS] com php-src: Merge branch 'PHP-5.5': ext/xmlreader/php_xmlreader.c

2013-10-04 Thread Michael Wallner
Commit:e13e5b17ffce68c7ea65d3410a6b4fe433135914
Author:Michael Wallner  Fri, 4 Oct 2013 11:22:52 +0200
Parents:   099b295646b108ad56d1ec3b37dfcb5812fd378c 
2e2bda3508444190cb9b707dffe328a263ec60a1
Branches:  master

Link:   
http://git.php.net/?p=php-src.git;a=commitdiff;h=e13e5b17ffce68c7ea65d3410a6b4fe433135914

Log:
Merge branch 'PHP-5.5'

* PHP-5.5:
  Fixed bug #64230 (XMLReader does not suppress errors)

Bugs:
https://bugs.php.net/64230

Changed paths:
  MM  ext/xmlreader/php_xmlreader.c


Diff:



--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-CVS] com php-src: Fixed bug #64230 (XMLReader does not suppress errors): NEWS ext/xmlreader/php_xmlreader.c ext/xmlreader/tests/bug64230.phpt

2013-10-04 Thread Michael Wallner
Commit:f6ff3a28d60c24dea2a05344d9b7eb823f09b4e5
Author:Michael Wallner  Fri, 4 Oct 2013 11:22:17 +0200
Parents:   dc3d360a0ff8c17cb2ce2030813d30b578249be9
Branches:  PHP-5.4 PHP-5.5 master

Link:   
http://git.php.net/?p=php-src.git;a=commitdiff;h=f6ff3a28d60c24dea2a05344d9b7eb823f09b4e5

Log:
Fixed bug #64230 (XMLReader does not suppress errors)

Bugs:
https://bugs.php.net/64230

Changed paths:
  M  NEWS
  M  ext/xmlreader/php_xmlreader.c
  A  ext/xmlreader/tests/bug64230.phpt


Diff:
diff --git a/NEWS b/NEWS
index ffde301..9963714 100644
--- a/NEWS
+++ b/NEWS
@@ -8,6 +8,7 @@ PHP 
   NEWS
 
 - XMLReader:
   . Fixed bug #51936 (Crash with clone XMLReader). (Mike)
+  . Fixed bug #64230 (XMLReader does not suppress errors). (Mike)
 
 
 ?? ??? 2013, PHP 5.4.21
diff --git a/ext/xmlreader/php_xmlreader.c b/ext/xmlreader/php_xmlreader.c
index 8b80320..adf2821 100644
--- a/ext/xmlreader/php_xmlreader.c
+++ b/ext/xmlreader/php_xmlreader.c
@@ -805,7 +805,6 @@ PHP_METHOD(xmlreader, read)
if (intern != NULL && intern->ptr != NULL) {
retval = xmlTextReaderRead(intern->ptr);
if (retval == -1) {
-   php_error_docref(NULL TSRMLS_CC, E_WARNING, "An Error 
Occurred while reading");
RETURN_FALSE;
} else {
RETURN_BOOL(retval);
@@ -847,7 +846,6 @@ PHP_METHOD(xmlreader, next)
retval = xmlTextReaderNext(intern->ptr); 
}
if (retval == -1) {
-   php_error_docref(NULL TSRMLS_CC, E_WARNING, "An Error 
Occurred while reading");
RETURN_FALSE;
} else {
RETURN_BOOL(retval);
diff --git a/ext/xmlreader/tests/bug64230.phpt 
b/ext/xmlreader/tests/bug64230.phpt
new file mode 100644
index 000..0b07092
--- /dev/null
+++ b/ext/xmlreader/tests/bug64230.phpt
@@ -0,0 +1,50 @@
+--TEST--
+Bug #64230 (XMLReader does not suppress errors)
+--SKIPIF--
+
+--FILE--
+message);
+   }
+   libxml_clear_errors();
+}
+
+echo "Internal errors TRUE\n";
+libxml_use_internal_errors(true);
+
+$x = new XMLReader;
+$x->xml("");
+$x->read();
+
+show_internal_errors();
+
+echo "Internal errors FALSE\n";
+libxml_use_internal_errors(false);
+
+$x = new XMLReader;
+$x->xml("");
+$x->read();
+
+show_internal_errors();
+
+?>
+Done
+--EXPECTF--
+Test
+Internal errors TRUE
+Internal: Specification mandate value for attribute att
+
+Internal errors FALSE
+
+Warning: XMLReader::read(): %s: parser error : Specification mandate value for 
attribute att in %s on line %d
+
+Warning: XMLReader::read():  in %s on line %d
+
+Warning: XMLReader::read():  ^ in %s on line %d
+Done


--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php