Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
version 1.3.3:
  - Remove methods findAll in the class Yod_Model
  - Remove methods config, import, plugin, model and dbmodel in the class Yod_Model
  - Remove methods config, import, plugin, model and dbmodel in the class Yod_Controller
  - Fixed a bug in yod_application_autoload with namespace in PHP
  - Change the default value of constant YOD_EXTPATH
  - Modify the method autoload, plugin and import of class Yod_Application
  - Fixed a bug in yod_init_compile_file (support zend_exception_error)
  • Loading branch information
zmrnet committed Oct 16, 2014
1 parent 3027d95 commit 7294354
Show file tree
Hide file tree
Showing 59 changed files with 85 additions and 461 deletions.
12 changes: 11 additions & 1 deletion Changelog
@@ -1,4 +1,14 @@
This file documents changes for Yod Framework release 1.3.2 and earlier.
This file documents changes for Yod Framework release 1.3.3 and earlier.

version 1.3.3:

- Remove methods findAll in the class Yod_Model
- Remove methods config, import, plugin, model and dbmodel in the class Yod_Model
- Remove methods config, import, plugin, model and dbmodel in the class Yod_Controller
- Fixed a bug in yod_application_autoload with namespace in PHP
- Change the default value of constant YOD_EXTPATH
- Modify the method autoload, plugin and import of class Yod_Application
- Fixed a bug in yod_init_compile_file (support zend_exception_error)

version 1.3.2:

Expand Down
2 changes: 1 addition & 1 deletion README.md
Expand Up @@ -101,7 +101,7 @@ class HelloController extends Yod_Controller
{
public function indexAction()
{
$this->assign('content', $this->model('Hello')->content());
$this->assign('content', Yod::model('Hello')->content());
$this->display('/index/index');
}

Expand Down
Binary file removed dll/php_yod-1.3.2-5.3-nts-vc9-x64-debug.dll
Binary file not shown.
Binary file removed dll/php_yod-1.3.2-5.3-nts-vc9-x64.dll
Binary file not shown.
Binary file removed dll/php_yod-1.3.2-5.3-nts-vc9-x86-debug.dll
Binary file not shown.
Binary file removed dll/php_yod-1.3.2-5.3-nts-vc9-x86.dll
Binary file not shown.
Binary file removed dll/php_yod-1.3.2-5.3-vc9-x64-debug.dll
Binary file not shown.
Binary file removed dll/php_yod-1.3.2-5.3-vc9-x64.dll
Binary file not shown.
Binary file removed dll/php_yod-1.3.2-5.3-vc9-x86-debug.dll
Binary file not shown.
Binary file removed dll/php_yod-1.3.2-5.3-vc9-x86.dll
Binary file not shown.
Binary file removed dll/php_yod-1.3.2-5.4-nts-vc9-x64-debug.dll
Binary file not shown.
Binary file removed dll/php_yod-1.3.2-5.4-nts-vc9-x64.dll
Binary file not shown.
Binary file removed dll/php_yod-1.3.2-5.4-nts-vc9-x86-debug.dll
Binary file not shown.
Binary file removed dll/php_yod-1.3.2-5.4-nts-vc9-x86.dll
Binary file not shown.
Binary file removed dll/php_yod-1.3.2-5.4-vc9-x64-debug.dll
Binary file not shown.
Binary file removed dll/php_yod-1.3.2-5.4-vc9-x64.dll
Binary file not shown.
Binary file removed dll/php_yod-1.3.2-5.4-vc9-x86-debug.dll
Binary file not shown.
Binary file removed dll/php_yod-1.3.2-5.4-vc9-x86.dll
Binary file not shown.
Binary file removed dll/php_yod-1.3.2-5.5-nts-vc11-x64-debug.dll
Binary file not shown.
Binary file removed dll/php_yod-1.3.2-5.5-nts-vc11-x64.dll
Binary file not shown.
Binary file removed dll/php_yod-1.3.2-5.5-nts-vc11-x86-debug.dll
Binary file not shown.
Binary file removed dll/php_yod-1.3.2-5.5-nts-vc11-x86.dll
Binary file not shown.
Binary file removed dll/php_yod-1.3.2-5.5-vc11-x64-debug.dll
Binary file not shown.
Binary file removed dll/php_yod-1.3.2-5.5-vc11-x64.dll
Binary file not shown.
Binary file removed dll/php_yod-1.3.2-5.5-vc11-x86-debug.dll
Binary file not shown.
Binary file removed dll/php_yod-1.3.2-5.5-vc11-x86.dll
Binary file not shown.
Binary file added dll/php_yod-1.3.3-5.3-nts-vc9-x64-debug.dll
Binary file not shown.
Binary file added dll/php_yod-1.3.3-5.3-nts-vc9-x64.dll
Binary file not shown.
Binary file added dll/php_yod-1.3.3-5.3-nts-vc9-x86-debug.dll
Binary file not shown.
Binary file added dll/php_yod-1.3.3-5.3-nts-vc9-x86.dll
Binary file not shown.
Binary file added dll/php_yod-1.3.3-5.3-vc9-x64-debug.dll
Binary file not shown.
Binary file added dll/php_yod-1.3.3-5.3-vc9-x64.dll
Binary file not shown.
Binary file added dll/php_yod-1.3.3-5.3-vc9-x86-debug.dll
Binary file not shown.
Binary file added dll/php_yod-1.3.3-5.3-vc9-x86.dll
Binary file not shown.
Binary file added dll/php_yod-1.3.3-5.4-nts-vc9-x64-debug.dll
Binary file not shown.
Binary file added dll/php_yod-1.3.3-5.4-nts-vc9-x64.dll
Binary file not shown.
Binary file added dll/php_yod-1.3.3-5.4-nts-vc9-x86-debug.dll
Binary file not shown.
Binary file added dll/php_yod-1.3.3-5.4-nts-vc9-x86.dll
Binary file not shown.
Binary file added dll/php_yod-1.3.3-5.4-vc9-x64-debug.dll
Binary file not shown.
Binary file added dll/php_yod-1.3.3-5.4-vc9-x64.dll
Binary file not shown.
Binary file added dll/php_yod-1.3.3-5.4-vc9-x86-debug.dll
Binary file not shown.
Binary file added dll/php_yod-1.3.3-5.4-vc9-x86.dll
Binary file not shown.
Binary file added dll/php_yod-1.3.3-5.5-nts-vc11-x64-debug.dll
Binary file not shown.
Binary file added dll/php_yod-1.3.3-5.5-nts-vc11-x64.dll
Binary file not shown.
Binary file added dll/php_yod-1.3.3-5.5-nts-vc11-x86-debug.dll
Binary file not shown.
Binary file added dll/php_yod-1.3.3-5.5-nts-vc11-x86.dll
Binary file not shown.
Binary file added dll/php_yod-1.3.3-5.5-vc11-x64-debug.dll
Binary file not shown.
Binary file added dll/php_yod-1.3.3-5.5-vc11-x64.dll
Binary file not shown.
Binary file added dll/php_yod-1.3.3-5.5-vc11-x86-debug.dll
Binary file not shown.
Binary file added dll/php_yod-1.3.3-5.5-vc11-x86.dll
Binary file not shown.
4 changes: 2 additions & 2 deletions yod/php_yod.h
Expand Up @@ -51,10 +51,10 @@ extern zend_module_entry yod_module_entry;
#endif

#if PHP_YOD_DEBUG
#define YOD_VERSION "1.3.2-dev"
#define YOD_VERSION "1.3.3-dev"
#define YOD_RUNMODE 7
#else
#define YOD_VERSION "1.3.2"
#define YOD_VERSION "1.3.3"
#define YOD_RUNMODE 3
#endif

Expand Down
1 change: 0 additions & 1 deletion yod/tests/004.phpt
Expand Up @@ -19,7 +19,6 @@ class IndexController extends Yod_Controller
{
public function indexAction()
{
\$this->import('Tests');
Tests::yodphp();
\$this->assign(array('yodphp' => 'Yod PHP Framework', 'hello' => 'Hello World!'));
\$this->display('/tests/widget');
Expand Down
1 change: 0 additions & 1 deletion yod/tests/005.phpt
Expand Up @@ -20,7 +20,6 @@ class IndexAction extends Yod_Action
{
public function run()
{
\$this->import('Tests');
Tests::yodphp();
\$this->assign(array(
'yodphp' => 'Yod PHP Framework',
Expand Down
6 changes: 3 additions & 3 deletions yod/tests/006.phpt
Expand Up @@ -57,13 +57,13 @@ class IndexController extends Yod_Controller
{
public function indexAction()
{
$tests = $this->model('Tests');
$tests = Yod::model('Tests');
$tests->yodphp();

$tests = $this->model('Tests');
$tests = Yod::model('Tests');
$tests->show();

$hello = $this->model('Hello');
$hello = Yod::model('Hello');
$hello->show();
}
}
Expand Down
12 changes: 11 additions & 1 deletion yod/yod.c
Expand Up @@ -24,6 +24,7 @@
#include "php_ini.h"
#include "main/SAPI.h"
#include "Zend/zend_interfaces.h"
#include "Zend/zend_exceptions.h"
#include "ext/standard/info.h"
#include "ext/standard/php_string.h"

Expand Down Expand Up @@ -447,7 +448,7 @@ char *yod_runpath(TSRMLS_D) {
/** {{{ char *yod_extpath(TSRMLS_D)
*/
char *yod_extpath(TSRMLS_D) {
zval extpath;
zval extpath, runpath;
uint extpath_len;
char *runfile;

Expand All @@ -456,6 +457,10 @@ char *yod_extpath(TSRMLS_D) {
convert_to_string(&extpath);
YOD_G(extpath) = estrndup(Z_STRVAL(extpath), Z_STRLEN(extpath));
zval_dtor(&extpath);
} else if (zend_get_constant(ZEND_STRL("YOD_RUNPATH"), &runpath TSRMLS_CC)) {
convert_to_string(&runpath);
YOD_G(extpath) = estrndup(Z_STRVAL(runpath), Z_STRLEN(runpath));
zval_dtor(&runpath);
} else {
INIT_ZVAL(extpath);
runfile = yod_runfile(TSRMLS_C);
Expand Down Expand Up @@ -573,6 +578,7 @@ int yod_include(char *filepath, zval **retval, int dtor TSRMLS_DC) {
zval_ptr_dtor(EG(return_value_ptr_ptr));
}
}

} zend_end_try();

YOD_RESTORE_EG_ENVIRON();
Expand Down Expand Up @@ -626,6 +632,10 @@ static zend_op_array *yod_init_compile_file(zend_file_handle *file_handle, int t
}
}

if (EG(exception)) {
zend_exception_error(EG(exception), E_ERROR TSRMLS_CC);
}

yod_application_autorun(TSRMLS_C);

return NULL;
Expand Down
72 changes: 54 additions & 18 deletions yod/yod_application.c
Expand Up @@ -367,9 +367,10 @@ int yod_application_config(char *name, uint name_len, zval *result TSRMLS_DC) {
*/
int yod_application_import(char *alias, uint alias_len, char *classext, uint classext_len TSRMLS_DC) {
zval **ppval;
char *classfile, *classname, *classpath;
char *classfile, *classfile1, *classfile2, *classname, *classpath;
size_t classfile_len, classname_len;
zend_class_entry **pce = NULL;
int depth = 0, depth1 = 0;

if (!YOD_G(loading)) {
yod_loading(TSRMLS_C);
Expand All @@ -379,12 +380,13 @@ int yod_application_import(char *alias, uint alias_len, char *classext, uint cla
return 0;
}

classfile = estrndup(alias, alias_len);
classfile1 = classfile = estrndup(alias, alias_len);
classfile_len = 0;

while (*classfile != '\0') {
if (*classfile == '.' || *classfile == '\\') {
*classfile = '/';
depth++;
}
classfile++;
classfile_len++;
Expand All @@ -393,13 +395,24 @@ int yod_application_import(char *alias, uint alias_len, char *classext, uint cla
while (*classfile == '/') {
classfile--;
classfile_len--;
depth--;
}

classfile = classfile - classfile_len;

while (*classfile == '/') {
classfile++;
classfile_len--;
depth--;
}

classfile2 = classfile;
while (depth1 < depth) {
if (*classfile2 == '/') {
depth1++;
}
*classfile2 = tolower(*classfile2);
classfile2++;
}

php_basename(classfile, classfile_len, NULL, 0, &classname, &classname_len TSRMLS_CC);
Expand All @@ -413,7 +426,7 @@ int yod_application_import(char *alias, uint alias_len, char *classext, uint cla
add_assoc_bool_ex(YOD_G(imports), alias, alias_len + 1, 1);
zend_update_static_property(yod_application_ce, ZEND_STRL("_imports"), YOD_G(imports) TSRMLS_CC);

efree(classfile);
efree(classfile1);
efree(classname);
return 1;
}
Expand All @@ -440,7 +453,7 @@ int yod_application_import(char *alias, uint alias_len, char *classext, uint cla
add_assoc_string_ex(YOD_G(imports), alias, alias_len + 1, classpath, 1);
zend_update_static_property(yod_application_ce, ZEND_STRL("_imports"), YOD_G(imports) TSRMLS_CC);
}
efree(classfile);
efree(classfile1);

#if PHP_API_VERSION < 20100412
if (zend_lookup_class_ex(classname, classname_len, 0, &pce TSRMLS_CC) == SUCCESS) {
Expand All @@ -459,9 +472,10 @@ int yod_application_import(char *alias, uint alias_len, char *classext, uint cla
*/
int yod_application_plugin(char *alias, uint alias_len, char *classext, uint classext_len, zval *result TSRMLS_DC) {
zval *config1, **ppval, *object = NULL;
char *aliaspath, *classfile, *classname, *classfile1, *classname1, *classpath, *loweralias;
char *aliaspath, *classfile, *classfile1, *classfile2, *classname, *classname1, *classpath, *loweralias;
size_t aliaspath_len, classfile_len, classname_len;
zend_class_entry **pce = NULL;
int depth = 0, depth1 = 0;

if (!YOD_G(loading)) {
yod_loading(TSRMLS_C);
Expand All @@ -471,12 +485,13 @@ int yod_application_plugin(char *alias, uint alias_len, char *classext, uint cla
return 0;
}

classfile = estrndup(alias, alias_len);
classfile1 = classfile = estrndup(alias, alias_len);
classfile_len = 0;

while (*classfile != '\0') {
if (*classfile == '.' || *classfile == '\\') {
*classfile = '/';
depth++;
}
classfile++;
classfile_len++;
Expand All @@ -485,13 +500,24 @@ int yod_application_plugin(char *alias, uint alias_len, char *classext, uint cla
while (*classfile == '/') {
classfile--;
classfile_len--;
depth--;
}

classfile = classfile - classfile_len;

while (*classfile == '/') {
classfile++;
classfile_len--;
depth--;
}

classfile2 = classfile;
while (depth1 < depth) {
if (*classfile2 == '/') {
depth1++;
}
*classfile2 = tolower(*classfile2);
classfile2++;
}

php_basename(classfile, classfile_len, NULL, 0, &classname, &classname_len TSRMLS_CC);
Expand All @@ -501,7 +527,7 @@ int yod_application_plugin(char *alias, uint alias_len, char *classext, uint cla
ZVAL_ZVAL(result, *ppval, 1, 0);
}

efree(classfile);
efree(classfile1);
efree(classname);
return 1;
}
Expand All @@ -514,7 +540,7 @@ int yod_application_plugin(char *alias, uint alias_len, char *classext, uint cla
if (classfile_len > 4 && strncasecmp(classfile, "yod/", 4) == 0) {
if (strncasecmp(classname, "Yod_", 4)) {
classname_len = spprintf(&classname1, 0, "Yod_%s", classname);
efree(classname);
efree(classfile1);
classname = classname1;
}
if (classext_len) {
Expand All @@ -523,13 +549,13 @@ int yod_application_plugin(char *alias, uint alias_len, char *classext, uint cla
spprintf(&classpath, 0, "%s/plugins/%s.class.php", yod_extpath(TSRMLS_C), classfile + 4);
}
} else if (strncasecmp(classname, "Yod_", 4) == 0) {
classfile1 = estrndup(classfile, classfile_len - classname_len);
classfile2 = estrndup(classfile, classfile_len - classname_len);
if (classext_len) {
spprintf(&classpath, 0, "%s/plugins/%s%s%s", yod_extpath(TSRMLS_C), classfile1, classname + 4, classext);
spprintf(&classpath, 0, "%s/plugins/%s%s%s", yod_extpath(TSRMLS_C), classfile2, classname + 4, classext);
} else {
spprintf(&classpath, 0, "%s/plugins/%s%s.class.php", yod_extpath(TSRMLS_C), classfile1, classname + 4);
spprintf(&classpath, 0, "%s/plugins/%s%s.class.php", yod_extpath(TSRMLS_C), classfile2, classname + 4);
}
efree(classfile1);
efree(classfile2);
} else {
if (classext_len) {
spprintf(&classpath, 0, "%s/plugins/%s%s", yod_runpath(TSRMLS_C), classfile, classext);
Expand All @@ -545,7 +571,7 @@ int yod_application_plugin(char *alias, uint alias_len, char *classext, uint cla
}
efree(classpath);
}
efree(classfile);
efree(classfile1);

#if PHP_API_VERSION < 20100412
if (zend_lookup_class_ex(classname, classname_len, 0, &pce TSRMLS_CC) == SUCCESS) {
Expand Down Expand Up @@ -637,22 +663,32 @@ void yod_application_autorun(TSRMLS_D) {
*/
static int yod_application_autoload(char *classname, uint classname_len TSRMLS_DC) {
zend_class_entry **pce = NULL;
char *classfile, *classpath;
char *classfile, *classfile1, *classfile2, *classpath;
int depth = 0, depth1 = 0;

#if PHP_YOD_DEBUG
yod_debugf("yod_application_autoload(%s)", classname);
#endif

classfile = estrndup(classname, classname_len);
classfile1 = classfile = estrndup(classname, classname_len);
/* class name with namespace in PHP 5.3 */
if (strstr(classname, "\\")) {
while (*classfile != '\0') {
if (*classfile == '\\') {
*classfile = '_';
*classfile = '/';
depth++;
}
classfile++;
}
classfile2 = classfile = classfile - classname_len;
while (depth1 < depth) {
if (*classfile == '/') {
depth1++;
}
*classfile = tolower(*classfile);
classfile++;
}
classfile = classfile - classname_len + 1;
classfile = classfile2;
}

if (strncasecmp(classfile, "Yod_", 4) == 0) { /* yodphp extends class */
Expand All @@ -670,7 +706,7 @@ static int yod_application_autoload(char *classname, uint classname_len TSRMLS_D
spprintf(&classpath, 0, "%s/extends/%s.class.php", yod_runpath(TSRMLS_C), classfile);
}
}
efree(classfile);
efree(classfile1);

if (VCWD_ACCESS(classpath, F_OK) == 0) {
yod_include(classpath, NULL, 1 TSRMLS_CC);
Expand Down

0 comments on commit 7294354

Please sign in to comment.