cvs: ZendEngine2 / zend_vm_def.h zend_vm_execute.h /tests bug46238.phpt

[email protected] ("Felipe Pena")
Newsgroups php.zend-engine.cvs
Message-ID <cvsfelipe1223253320@cvsserver>
felipe		Mon Oct  6 00:35:20 2008 UTC

  Added files:                 
    /ZendEngine2/tests	bug46238.phpt 

  Modified files:              
    /ZendEngine2	zend_vm_def.h zend_vm_execute.h 
  Log:
  - Fixed bug #46238 (Segmentation fault on static call with empty string method)
  
  
http://cvs.php.net/viewvc.cgi/ZendEngine2/zend_vm_def.h?r1=1.246&r2=1.247&diff_format=u
Index: ZendEngine2/zend_vm_def.h
diff -u ZendEngine2/zend_vm_def.h:1.246 ZendEngine2/zend_vm_def.h:1.247
--- ZendEngine2/zend_vm_def.h:1.246	Fri Aug 15 19:45:25 2008
+++ ZendEngine2/zend_vm_def.h	Mon Oct  6 00:35:19 2008
@@ -18,7 +18,7 @@
    +----------------------------------------------------------------------+
 */
 
-/* $Id: zend_vm_def.h,v 1.246 2008/08/15 19:45:25 felipe Exp $ */
+/* $Id: zend_vm_def.h,v 1.247 2008/10/06 00:35:19 felipe Exp $ */
 
 /* If you change this file, please regenerate the zend_vm_execute.h and
  * zend_vm_opcodes.h files by running:
@@ -2038,7 +2038,7 @@
 		}
 	}
 	if(OP2_TYPE != IS_UNUSED) {
-		zstr function_name_strval;
+		zstr function_name_strval = NULL_ZSTR;
 		unsigned int function_name_strlen = 0;
 		zend_free_op free_op2;
 		zend_uchar function_name_type;
@@ -2059,7 +2059,7 @@
 			}
 		}
 
-		if (function_name_strlen) {
+		if (function_name_strval.v) {
 			if (ce->get_static_method) {
 				EX(fbc) = ce->get_static_method(ce, function_name_type, function_name_strval, function_name_strlen TSRMLS_CC);
 			} else {
http://cvs.php.net/viewvc.cgi/ZendEngine2/zend_vm_execute.h?r1=1.250&r2=1.251&diff_format=u
Index: ZendEngine2/zend_vm_execute.h
diff -u ZendEngine2/zend_vm_execute.h:1.250 ZendEngine2/zend_vm_execute.h:1.251
--- ZendEngine2/zend_vm_execute.h:1.250	Fri Aug 15 19:45:25 2008
+++ ZendEngine2/zend_vm_execute.h	Mon Oct  6 00:35:19 2008
@@ -2707,7 +2707,7 @@
 		}
 	}
 	if(IS_CONST != IS_UNUSED) {
-		zstr function_name_strval;
+		zstr function_name_strval = NULL_ZSTR;
 		unsigned int function_name_strlen = 0;
 
 		zend_uchar function_name_type;
@@ -2728,7 +2728,7 @@
 			}
 		}
 
-		if (function_name_strlen) {
+		if (function_name_strval.v) {
 			if (ce->get_static_method) {
 				EX(fbc) = ce->get_static_method(ce, function_name_type, function_name_strval, function_name_strlen TSRMLS_CC);
 			} else {
@@ -3311,7 +3311,7 @@
 		}
 	}
 	if(IS_TMP_VAR != IS_UNUSED) {
-		zstr function_name_strval;
+		zstr function_name_strval = NULL_ZSTR;
 		unsigned int function_name_strlen = 0;
 		zend_free_op free_op2;
 		zend_uchar function_name_type;
@@ -3332,7 +3332,7 @@
 			}
 		}
 
-		if (function_name_strlen) {
+		if (function_name_strval.v) {
 			if (ce->get_static_method) {
 				EX(fbc) = ce->get_static_method(ce, function_name_type, function_name_strval, function_name_strlen TSRMLS_CC);
 			} else {
@@ -3791,7 +3791,7 @@
 		}
 	}
 	if(IS_VAR != IS_UNUSED) {
-		zstr function_name_strval;
+		zstr function_name_strval = NULL_ZSTR;
 		unsigned int function_name_strlen = 0;
 		zend_free_op free_op2;
 		zend_uchar function_name_type;
@@ -3812,7 +3812,7 @@
 			}
 		}
 
-		if (function_name_strlen) {
+		if (function_name_strval.v) {
 			if (ce->get_static_method) {
 				EX(fbc) = ce->get_static_method(ce, function_name_type, function_name_strval, function_name_strlen TSRMLS_CC);
 			} else {
@@ -4027,7 +4027,7 @@
 		}
 	}
 	if(IS_UNUSED != IS_UNUSED) {
-		zstr function_name_strval;
+		zstr function_name_strval = NULL_ZSTR;
 		unsigned int function_name_strlen = 0;
 
 		zend_uchar function_name_type;
@@ -4048,7 +4048,7 @@
 			}
 		}
 
-		if (function_name_strlen) {
+		if (function_name_strval.v) {
 			if (ce->get_static_method) {
 				EX(fbc) = ce->get_static_method(ce, function_name_type, function_name_strval, function_name_strlen TSRMLS_CC);
 			} else {
@@ -4475,7 +4475,7 @@
 		}
 	}
 	if(IS_CV != IS_UNUSED) {
-		zstr function_name_strval;
+		zstr function_name_strval = NULL_ZSTR;
 		unsigned int function_name_strlen = 0;
 
 		zend_uchar function_name_type;
@@ -4496,7 +4496,7 @@
 			}
 		}
 
-		if (function_name_strlen) {
+		if (function_name_strval.v) {
 			if (ce->get_static_method) {
 				EX(fbc) = ce->get_static_method(ce, function_name_type, function_name_strval, function_name_strlen TSRMLS_CC);
 			} else {
@@ -10771,7 +10771,7 @@
 		}
 	}
 	if(IS_CONST != IS_UNUSED) {
-		zstr function_name_strval;
+		zstr function_name_strval = NULL_ZSTR;
 		unsigned int function_name_strlen = 0;
 
 		zend_uchar function_name_type;
@@ -10792,7 +10792,7 @@
 			}
 		}
 
-		if (function_name_strlen) {
+		if (function_name_strval.v) {
 			if (ce->get_static_method) {
 				EX(fbc) = ce->get_static_method(ce, function_name_type, function_name_strval, function_name_strlen TSRMLS_CC);
 			} else {
@@ -12686,7 +12686,7 @@
 		}
 	}
 	if(IS_TMP_VAR != IS_UNUSED) {
-		zstr function_name_strval;
+		zstr function_name_strval = NULL_ZSTR;
 		unsigned int function_name_strlen = 0;
 		zend_free_op free_op2;
 		zend_uchar function_name_type;
@@ -12707,7 +12707,7 @@
 			}
 		}
 
-		if (function_name_strlen) {
+		if (function_name_strval.v) {
 			if (ce->get_static_method) {
 				EX(fbc) = ce->get_static_method(ce, function_name_type, function_name_strval, function_name_strlen TSRMLS_CC);
 			} else {
@@ -14581,7 +14581,7 @@
 		}
 	}
 	if(IS_VAR != IS_UNUSED) {
-		zstr function_name_strval;
+		zstr function_name_strval = NULL_ZSTR;
 		unsigned int function_name_strlen = 0;
 		zend_free_op free_op2;
 		zend_uchar function_name_type;
@@ -14602,7 +14602,7 @@
 			}
 		}
 
-		if (function_name_strlen) {
+		if (function_name_strval.v) {
 			if (ce->get_static_method) {
 				EX(fbc) = ce->get_static_method(ce, function_name_type, function_name_strval, function_name_strlen TSRMLS_CC);
 			} else {
@@ -15564,7 +15564,7 @@
 		}
 	}
 	if(IS_UNUSED != IS_UNUSED) {
-		zstr function_name_strval;
+		zstr function_name_strval = NULL_ZSTR;
 		unsigned int function_name_strlen = 0;
 
 		zend_uchar function_name_type;
@@ -15585,7 +15585,7 @@
 			}
 		}
 
-		if (function_name_strlen) {
+		if (function_name_strval.v) {
 			if (ce->get_static_method) {
 				EX(fbc) = ce->get_static_method(ce, function_name_type, function_name_strval, function_name_strlen TSRMLS_CC);
 			} else {
@@ -17093,7 +17093,7 @@
 		}
 	}
 	if(IS_CV != IS_UNUSED) {
-		zstr function_name_strval;
+		zstr function_name_strval = NULL_ZSTR;
 		unsigned int function_name_strlen = 0;
 
 		zend_uchar function_name_type;
@@ -17114,7 +17114,7 @@
 			}
 		}
 
-		if (function_name_strlen) {
+		if (function_name_strval.v) {
 			if (ce->get_static_method) {
 				EX(fbc) = ce->get_static_method(ce, function_name_type, function_name_strval, function_name_strlen TSRMLS_CC);
 			} else {

http://cvs.php.net/viewvc.cgi/ZendEngine2/tests/bug46238.phpt?view=markup&rev=1.1
Index: ZendEngine2/tests/bug46238.phpt
+++ ZendEngine2/tests/bug46238.phpt
--TEST--
Bug #46238 (Segmentation fault on static call with empty string method)
--FILE--
<?php

class a {
        static function __callStatic($name, $arguments)
        {
                var_dump(array($name, $arguments));
        }
}

$a = 'a';
$b = '';

$a::$b($a);
$a::$b(array());
$a::$b(NULL);
$a::$b(1);
$a::$b();


$b = "\0";

$a::$b($a);
$a::$b(array());
$a::$b(NULL);
$a::$b(1);
$a::$b();

?>
--EXPECT--
array(2) {
  [0]=>
  unicode(0) ""
  [1]=>
  array(1) {
    [0]=>
    unicode(1) "a"
  }
}
array(2) {
  [0]=>
  unicode(0) ""
  [1]=>
  array(1) {
    [0]=>
    array(0) {
    }
  }
}
array(2) {
  [0]=>
  unicode(0) ""
  [1]=>
  array(1) {
    [0]=>
    NULL
  }
}
array(2) {
  [0]=>
  unicode(0) ""
  [1]=>
  array(1) {
    [0]=>
    int(1)
  }
}
array(2) {
  [0]=>
  unicode(0) ""
  [1]=>
  array(0) {
  }
}
array(2) {
  [0]=>
  unicode(0) ""
  [1]=>
  array(1) {
    [0]=>
    unicode(1) "a"
  }
}
array(2) {
  [0]=>
  unicode(0) ""
  [1]=>
  array(1) {
    [0]=>
    array(0) {
    }
  }
}
array(2) {
  [0]=>
  unicode(0) ""
  [1]=>
  array(1) {
    [0]=>
    NULL
  }
}
array(2) {
  [0]=>
  unicode(0) ""
  [1]=>
  array(1) {
    [0]=>
    int(1)
  }
}
array(2) {
  [0]=>
  unicode(0) ""
  [1]=>
  array(0) {
  }
}
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.