Skip to content

Commit

Permalink
Backport #1731 from the upstream
Browse files Browse the repository at this point in the history
Fixed "require" regression introduced in the 0.10.12
  • Loading branch information
sergeyklay committed Nov 18, 2018
1 parent 664381e commit 50907cb
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 27 deletions.
36 changes: 9 additions & 27 deletions kernels/ZendEngine3/require.c
Original file line number Diff line number Diff line change
@@ -1,22 +1,13 @@

/*
+------------------------------------------------------------------------+
| Zephir Language |
+------------------------------------------------------------------------+
| Copyright (c) 2011-2017 Zephir Team (http://www.zephir-lang.com) |
+------------------------------------------------------------------------+
| This source file is subject to the New BSD License that is bundled |
| with this package in the file docs/LICENSE.txt. |
| |
| If you did not receive a copy of the license and are unable to |
| obtain it through the world-wide-web, please send an email |
| to [email protected] so we can send you a copy immediately. |
+------------------------------------------------------------------------+
| Authors: Andres Gutierrez <[email protected]> |
| Eduar Carvajal <[email protected]> |
| Vladimir Kolesnikov <[email protected]> |
+------------------------------------------------------------------------+
*/
* This file is part of the Zephir.
*
* (c) Zephir Team <[email protected]>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code. If you did not receive
* a copy of the license it is available through the world-wide-web at the
* following url: https://docs.zephir-lang.com/en/latest/license
*/

#ifdef HAVE_CONFIG_H
#include "config.h"
Expand All @@ -42,17 +33,8 @@ int zephir_require_ret(zval *return_value_ptr, const char *require_path)
zend_file_handle file_handle;
zend_op_array *new_op_array;
zval dummy, local_retval;
char realpath[MAXPATHLEN];
int ret;

if (UNEXPECTED(!VCWD_REALPATH(require_path, realpath))) {
#ifndef ZEPHIR_RELEASE
fprintf(stderr, "%s: Failed opening file %s", __func__, require_path);
zephir_print_backtrace();
#endif
return FAILURE;
}

ZVAL_UNDEF(&local_retval);

#ifndef ZEPHIR_RELEASE
Expand Down
14 changes: 14 additions & 0 deletions unit-tests/Extension/RequiresTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,4 +39,18 @@ public function testRequireExternal3()
$r->requireExternal3(__DIR__ . '/../fixtures/require-me-3.php')
);
}

/**
* @test
* @issue https://github.com/phalcon/zephir/issues/1713
*/
public function shouldRequirePhar()
{
$r = new Requires();

$this->assertEquals(
"I'm in",
$r->requireExternal1('phar://' . __DIR__ . '/../fixtures/requires/myapp.phar/index.php')
);
}
}
Binary file added unit-tests/fixtures/requires/myapp.phar
Binary file not shown.

0 comments on commit 50907cb

Please sign in to comment.